Ramon Fried | 20e7705 | 2018-07-02 02:58:00 +0300 | [diff] [blame] | 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> |
Simon Glass | 0e1fad4 | 2020-07-19 10:15:37 -0600 | [diff] [blame] | 10 | #include <test/test.h> |
Ramon Fried | 20e7705 | 2018-07-02 02:58:00 +0300 | [diff] [blame] | 11 | #include <test/ut.h> |
| 12 | |
| 13 | /* Basic test of the smem uclass */ |
| 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 | } |
Simon Glass | e180c2b | 2020-07-28 19:41:12 -0600 | [diff] [blame] | 27 | DM_TEST(dm_test_smem_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |
Ramon Fried | 20e7705 | 2018-07-02 02:58:00 +0300 | [diff] [blame] | 28 | |