1 // 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>
10 #include <test/test.h>
11 #include <test/ut.h>
12
13 /* Basic test of the smem uclass */
dm_test_smem_base(struct unit_test_state * uts)14 static 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 }
27 DM_TEST(dm_test_smem_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
28
29