2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-02-26 22:59:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2015-05-20 19:27:29 +00:00
|
|
|
#include <command.h>
|
2015-11-09 06:47:45 +00:00
|
|
|
#include <console.h>
|
2014-02-26 22:59:21 +00:00
|
|
|
#include <dm.h>
|
|
|
|
#include <errno.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2014-10-04 17:29:50 +00:00
|
|
|
#include <malloc.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2015-11-09 06:47:44 +00:00
|
|
|
#include <asm/state.h>
|
2014-02-26 22:59:21 +00:00
|
|
|
#include <dm/root.h>
|
|
|
|
#include <dm/uclass-internal.h>
|
2020-07-19 16:15:37 +00:00
|
|
|
#include <test/test.h>
|
|
|
|
#include <test/test.h>
|
2015-05-20 19:27:27 +00:00
|
|
|
#include <test/ut.h>
|
2014-02-26 22:59:21 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2021-03-08 00:35:12 +00:00
|
|
|
/**
|
|
|
|
* dm_test_run() - Run driver model tests
|
|
|
|
*
|
|
|
|
* Run all the available driver model tests, or a selection
|
|
|
|
*
|
|
|
|
* @test_name: Name of single test to run (e.g. "dm_test_fdt_pre_reloc" or just
|
|
|
|
* "fdt_pre_reloc"), or NULL to run all
|
|
|
|
* @return 0 if all tests passed, 1 if not
|
|
|
|
*/
|
|
|
|
static int dm_test_run(const char *test_name)
|
2014-02-26 22:59:21 +00:00
|
|
|
{
|
2021-03-08 00:35:10 +00:00
|
|
|
struct unit_test *tests = UNIT_TEST_SUITE_START(dm_test);
|
|
|
|
const int n_ents = UNIT_TEST_SUITE_COUNT(dm_test);
|
2021-03-08 00:35:06 +00:00
|
|
|
int ret;
|
2016-01-28 06:57:46 +00:00
|
|
|
|
2021-03-08 00:35:06 +00:00
|
|
|
ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name);
|
2014-02-26 22:59:21 +00:00
|
|
|
|
2021-03-08 00:35:06 +00:00
|
|
|
return ret ? CMD_RET_FAILURE : 0;
|
2014-02-26 22:59:21 +00:00
|
|
|
}
|
2015-05-20 19:27:29 +00:00
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
2015-05-20 19:27:29 +00:00
|
|
|
{
|
|
|
|
const char *test_name = NULL;
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
test_name = argv[1];
|
|
|
|
|
2021-03-08 00:34:46 +00:00
|
|
|
return dm_test_run(test_name);
|
2015-05-20 19:27:29 +00:00
|
|
|
}
|