mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 19:34:35 +00:00
test: Expand implementation of ut_list_has_dm_tests()
This function assumes that all tests in a suite are being run. This means that it can sometimes call dm_test_restore() when it should not. The impact of this is that it is not possible, for example, to run 'ut bootstd bootflow_cros' and then check the state of bootstd afterwards, since all devices are removed and recreated. Update the function to take account of any selected test, to avoid this problem. Add a comment for test_insert while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5224aa1dad
commit
fbdac8155c
1 changed files with 14 additions and 4 deletions
|
@ -240,15 +240,22 @@ static bool test_matches(const char *prefix, const char *test_name,
|
||||||
* ut_list_has_dm_tests() - Check if a list of tests has driver model ones
|
* ut_list_has_dm_tests() - Check if a list of tests has driver model ones
|
||||||
*
|
*
|
||||||
* @tests: List of tests to run
|
* @tests: List of tests to run
|
||||||
* @count: Number of tests to ru
|
* @count: Number of tests to run
|
||||||
|
* @prefix: String prefix for the tests. Any tests that have this prefix will be
|
||||||
|
* printed without the prefix, so that it is easier to see the unique part
|
||||||
|
* of the test name. If NULL, no prefix processing is done
|
||||||
|
* @select_name: Name of a single test being run (from the list provided). If
|
||||||
|
* NULL all tests are being run
|
||||||
* Return: true if any of the tests have the UTF_DM flag
|
* Return: true if any of the tests have the UTF_DM flag
|
||||||
*/
|
*/
|
||||||
static bool ut_list_has_dm_tests(struct unit_test *tests, int count)
|
static bool ut_list_has_dm_tests(struct unit_test *tests, int count,
|
||||||
|
const char *prefix, const char *select_name)
|
||||||
{
|
{
|
||||||
struct unit_test *test;
|
struct unit_test *test;
|
||||||
|
|
||||||
for (test = tests; test < tests + count; test++) {
|
for (test = tests; test < tests + count; test++) {
|
||||||
if (test->flags & UTF_DM)
|
if (test_matches(prefix, test->name, select_name) &&
|
||||||
|
(test->flags & UTF_DM))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,6 +557,9 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,
|
||||||
* @count: Number of tests to run
|
* @count: Number of tests to run
|
||||||
* @select_name: Name of a single test to run (from the list provided). If NULL
|
* @select_name: Name of a single test to run (from the list provided). If NULL
|
||||||
* then all tests are run
|
* then all tests are run
|
||||||
|
* @test_insert: String describing a test to run after n other tests run, in the
|
||||||
|
* format n:name where n is the number of tests to run before this one and
|
||||||
|
* name is the name of the test to run
|
||||||
* Return: 0 if all tests passed, -ENOENT if test @select_name was not found,
|
* Return: 0 if all tests passed, -ENOENT if test @select_name was not found,
|
||||||
* -EBADF if any failed
|
* -EBADF if any failed
|
||||||
*/
|
*/
|
||||||
|
@ -646,7 +656,7 @@ int ut_run_list(const char *category, const char *prefix,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
|
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
|
||||||
ut_list_has_dm_tests(tests, count)) {
|
ut_list_has_dm_tests(tests, count, prefix, select_name)) {
|
||||||
has_dm_tests = true;
|
has_dm_tests = true;
|
||||||
/*
|
/*
|
||||||
* If we have no device tree, or it only has a root node, then
|
* If we have no device tree, or it only has a root node, then
|
||||||
|
|
Loading…
Add table
Reference in a new issue