blob: 89e74cccc57475931d4b951a52a9b5bfa2b48c85 [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
Ramon Friede8826f52018-07-02 02:58:00 +03006#include <dm.h>
7#include <smem.h>
8#include <dm/test.h>
Simon Glass75c4d412020-07-19 10:15:37 -06009#include <test/test.h>
Ramon Friede8826f52018-07-02 02:58:00 +030010#include <test/ut.h>
11
12/* Basic test of the smem uclass */
13static 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 Glass1a92f832024-08-22 07:57:48 -060026DM_TEST(dm_test_smem_base, UTF_SCAN_PDATA | UTF_SCAN_FDT);