blob: 289fb59ba1367b44a97a95e200d95ab9c2db3c9e [file] [log] [blame]
Ramon Friede8826f52018-07-02 02:58:00 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2018 Ramon Fried <ramon.fried@gmail.com>
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <smem.h>
9#include <dm/test.h>
Simon Glass75c4d412020-07-19 10:15:37 -060010#include <test/test.h>
Ramon Friede8826f52018-07-02 02:58:00 +030011#include <test/ut.h>
12
13/* Basic test of the smem uclass */
14static int dm_test_smem_base(struct unit_test_state *uts)
15{
16 struct udevice *dev;
17 size_t size;
18
19 ut_assertok(uclass_get_device(UCLASS_SMEM, 0, &dev));
20 ut_assertnonnull(dev);
21 ut_assertok(smem_alloc(dev, -1, 0, 16));
22 ut_asserteq(0, smem_get_free_space(dev, -1));
23 ut_assertnull(smem_get(dev, -1, 0, &size));
24
25 return 0;
26}
Simon Glass974dccd2020-07-28 19:41:12 -060027DM_TEST(dm_test_smem_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);