blob: 4099a5f66c49ac3562ac6696df0693a661aa5a2f [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>
10#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}
26DM_TEST(dm_test_smem_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
27