Ramon Fried | e8826f5 | 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 | |
Ramon Fried | e8826f5 | 2018-07-02 02:58:00 +0300 | [diff] [blame] | 6 | #include <dm.h> |
| 7 | #include <smem.h> |
| 8 | #include <dm/test.h> |
Simon Glass | 75c4d41 | 2020-07-19 10:15:37 -0600 | [diff] [blame] | 9 | #include <test/test.h> |
Ramon Fried | e8826f5 | 2018-07-02 02:58:00 +0300 | [diff] [blame] | 10 | #include <test/ut.h> |
| 11 | |
| 12 | /* Basic test of the smem uclass */ |
| 13 | static int dm_test_smem_base(struct unit_test_state *uts) |
| 14 | { |
| 15 | struct udevice *dev; |
| 16 | size_t size; |
| 17 | |
| 18 | ut_assertok(uclass_get_device(UCLASS_SMEM, 0, &dev)); |
| 19 | ut_assertnonnull(dev); |
| 20 | ut_assertok(smem_alloc(dev, -1, 0, 16)); |
| 21 | ut_asserteq(0, smem_get_free_space(dev, -1)); |
| 22 | ut_assertnull(smem_get(dev, -1, 0, &size)); |
| 23 | |
| 24 | return 0; |
| 25 | } |
Simon Glass | 1a92f83 | 2024-08-22 07:57:48 -0600 | [diff] [blame] | 26 | DM_TEST(dm_test_smem_base, UTF_SCAN_PDATA | UTF_SCAN_FDT); |