blob: 729becf57b2e5ffd69856f683c1a2c45f620c4e6 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass2e7d35d2014-02-26 15:59:21 -07002/*
3 * Copyright (c) 2013 Google, Inc
Simon Glass2e7d35d2014-02-26 15:59:21 -07004 */
5
6#include <common.h>
Joe Hershberger40441e02015-05-20 14:27:29 -05007#include <command.h>
Simon Glass24b852a2015-11-08 23:47:45 -07008#include <console.h>
Simon Glass2e7d35d2014-02-26 15:59:21 -07009#include <dm.h>
10#include <errno.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060011#include <log.h>
Simon Glass756ac0b2014-10-04 11:29:50 -060012#include <malloc.h>
Simon Glass401d1c42020-10-30 21:38:53 -060013#include <asm/global_data.h>
Simon Glass3884c982015-11-08 23:47:44 -070014#include <asm/state.h>
Simon Glass2e7d35d2014-02-26 15:59:21 -070015#include <dm/root.h>
16#include <dm/uclass-internal.h>
Simon Glass0e1fad42020-07-19 10:15:37 -060017#include <test/test.h>
18#include <test/test.h>
Joe Hershbergere721b882015-05-20 14:27:27 -050019#include <test/ut.h>
Simon Glass2e7d35d2014-02-26 15:59:21 -070020
21DECLARE_GLOBAL_DATA_PTR;
22
Simon Glass409f4a22021-03-07 17:34:46 -070023int dm_test_run(const char *test_name)
Simon Glass2e7d35d2014-02-26 15:59:21 -070024{
Simon Glassa7a98752021-03-07 17:35:10 -070025 struct unit_test *tests = UNIT_TEST_SUITE_START(dm_test);
26 const int n_ents = UNIT_TEST_SUITE_COUNT(dm_test);
Simon Glass45d191a2021-03-07 17:35:06 -070027 int ret;
Stephen Warren26e1bec2016-01-27 23:57:46 -070028
Simon Glass45d191a2021-03-07 17:35:06 -070029 ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name);
Simon Glass2e7d35d2014-02-26 15:59:21 -070030
Simon Glass45d191a2021-03-07 17:35:06 -070031 return ret ? CMD_RET_FAILURE : 0;
Simon Glass2e7d35d2014-02-26 15:59:21 -070032}
Joe Hershberger40441e02015-05-20 14:27:29 -050033
Simon Glass09140112020-05-10 11:40:03 -060034int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Joe Hershberger40441e02015-05-20 14:27:29 -050035{
36 const char *test_name = NULL;
37
38 if (argc > 1)
39 test_name = argv[1];
40
Simon Glass409f4a22021-03-07 17:34:46 -070041 return dm_test_run(test_name);
Joe Hershberger40441e02015-05-20 14:27:29 -050042}