2018-05-07 06:58:06 +09:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-02-27 07:59:21 +09:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2015-05-21 04:27:29 +09:00
|
|
|
#include <command.h>
|
2015-11-09 15:47:45 +09:00
|
|
|
#include <console.h>
|
2014-02-27 07:59:21 +09:00
|
|
|
#include <dm.h>
|
|
|
|
#include <errno.h>
|
2020-05-11 02:40:05 +09:00
|
|
|
#include <log.h>
|
2014-10-05 02:29:50 +09:00
|
|
|
#include <malloc.h>
|
2020-10-31 12:38:53 +09:00
|
|
|
#include <asm/global_data.h>
|
2015-11-09 15:47:44 +09:00
|
|
|
#include <asm/state.h>
|
2014-02-27 07:59:21 +09:00
|
|
|
#include <dm/root.h>
|
|
|
|
#include <dm/uclass-internal.h>
|
2020-07-20 01:15:37 +09:00
|
|
|
#include <test/test.h>
|
|
|
|
#include <test/test.h>
|
2015-05-21 04:27:27 +09:00
|
|
|
#include <test/ut.h>
|
2014-02-27 07:59:21 +09:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2021-03-08 09:35:12 +09: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-27 07:59:21 +09:00
|
|
|
{
|
2021-03-08 09:35:10 +09:00
|
|
|
struct unit_test *tests = UNIT_TEST_SUITE_START(dm_test);
|
|
|
|
const int n_ents = UNIT_TEST_SUITE_COUNT(dm_test);
|
2021-03-08 09:35:06 +09:00
|
|
|
int ret;
|
2016-01-28 15:57:46 +09:00
|
|
|
|
2021-03-08 09:35:06 +09:00
|
|
|
ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name);
|
2014-02-27 07:59:21 +09:00
|
|
|
|
2021-03-08 09:35:06 +09:00
|
|
|
return ret ? CMD_RET_FAILURE : 0;
|
2014-02-27 07:59:21 +09:00
|
|
|
}
|
2015-05-21 04:27:29 +09:00
|
|
|
|
2020-05-11 02:40:03 +09:00
|
|
|
int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
2015-05-21 04:27:29 +09:00
|
|
|
{
|
|
|
|
const char *test_name = NULL;
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
test_name = argv[1];
|
|
|
|
|
2021-03-08 09:34:46 +09:00
|
|
|
return dm_test_run(test_name);
|
2015-05-21 04:27:29 +09:00
|
|
|
}
|