test: Update tests to use the skip feature
Some tests currently return 0 when they want to be skipped. Update them to return -EAGAIN instead, so they are counted as skipped. A few tests are in two parts, with the latter part being skipped in certain situations. Split these into two and use the correct condition for the second part. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
1facaadea1
commit
c43635bdbc
@ -330,7 +330,7 @@ static int bootflow_system(struct unit_test_state *uts)
|
|||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
|
|
||||||
if (!IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR))
|
if (!IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR))
|
||||||
return 0;
|
return -EAGAIN;
|
||||||
ut_assertok(uclass_get_device_by_name(UCLASS_BOOTMETH, "efi_mgr",
|
ut_assertok(uclass_get_device_by_name(UCLASS_BOOTMETH, "efi_mgr",
|
||||||
&dev));
|
&dev));
|
||||||
sandbox_set_fake_efi_mgr_dev(dev, true);
|
sandbox_set_fake_efi_mgr_dev(dev, true);
|
||||||
@ -395,7 +395,7 @@ BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
|||||||
static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
|
static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
|
||||||
{
|
{
|
||||||
if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
|
if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
|
||||||
return 0;
|
return -EAGAIN;
|
||||||
|
|
||||||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||||
|
|
||||||
|
@ -103,10 +103,17 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
|
|||||||
ut_asserteq_str("efi syslinux", env_get("bootmeths"));
|
ut_asserteq_str("efi syslinux", env_get("bootmeths"));
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
/* Try with global bootmeths */
|
return 0;
|
||||||
if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
|
}
|
||||||
return 0;
|
BOOTSTD_TEST(bootmeth_cmd_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
||||||
|
|
||||||
|
/* Check 'bootmeth order' command with global bootmeths */
|
||||||
|
static int bootmeth_cmd_order_glob(struct unit_test_state *uts)
|
||||||
|
{
|
||||||
|
if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
|
||||||
|
return -EAGAIN;
|
||||||
|
|
||||||
|
console_record_reset_enable();
|
||||||
ut_assertok(run_command("bootmeth order \"efi firmware0\"", 0));
|
ut_assertok(run_command("bootmeth order \"efi firmware0\"", 0));
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
ut_assertok(run_command("bootmeth list", 0));
|
ut_assertok(run_command("bootmeth list", 0));
|
||||||
@ -122,7 +129,7 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BOOTSTD_TEST(bootmeth_cmd_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
BOOTSTD_TEST(bootmeth_cmd_order_glob, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
||||||
|
|
||||||
/* Check 'bootmeths' env var */
|
/* Check 'bootmeths' env var */
|
||||||
static int bootmeth_env(struct unit_test_state *uts)
|
static int bootmeth_env(struct unit_test_state *uts)
|
||||||
|
@ -26,7 +26,7 @@ static int vbe_test_fixup(struct unit_test_state *uts)
|
|||||||
* flat tree, since device tree fix-ups do not yet support live tree.
|
* flat tree, since device tree fix-ups do not yet support live tree.
|
||||||
*/
|
*/
|
||||||
if (!working_fdt)
|
if (!working_fdt)
|
||||||
return 0;
|
return -EAGAIN;
|
||||||
|
|
||||||
tree = oftree_from_fdt(working_fdt);
|
tree = oftree_from_fdt(working_fdt);
|
||||||
ut_assert(oftree_valid(tree));
|
ut_assert(oftree_valid(tree));
|
||||||
|
@ -150,7 +150,7 @@ static int dm_test_of_plat_dev(struct unit_test_state *uts)
|
|||||||
|
|
||||||
/* Skip this test if there is no platform data */
|
/* Skip this test if there is no platform data */
|
||||||
if (!CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT))
|
if (!CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT))
|
||||||
return 0;
|
return -EAGAIN;
|
||||||
|
|
||||||
/* Record the indexes that are found */
|
/* Record the indexes that are found */
|
||||||
memset(found, '\0', sizeof(found));
|
memset(found, '\0', sizeof(found));
|
||||||
|
@ -753,10 +753,7 @@ static int make_ofnode_fdt(struct unit_test_state *uts, void *fdt, int size,
|
|||||||
|
|
||||||
static int dm_test_ofnode_root(struct unit_test_state *uts)
|
static int dm_test_ofnode_root(struct unit_test_state *uts)
|
||||||
{
|
{
|
||||||
char fdt[256];
|
|
||||||
oftree tree;
|
|
||||||
ofnode node;
|
ofnode node;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Check that aliases work on the control FDT */
|
/* Check that aliases work on the control FDT */
|
||||||
node = ofnode_get_aliases_node("ethernet3");
|
node = ofnode_get_aliases_node("ethernet3");
|
||||||
@ -765,14 +762,22 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
|
|||||||
|
|
||||||
ut_assert(!oftree_valid(oftree_null()));
|
ut_assert(!oftree_valid(oftree_null()));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT);
|
||||||
|
|
||||||
|
static int dm_test_ofnode_root_mult(struct unit_test_state *uts)
|
||||||
|
{
|
||||||
|
char fdt[256];
|
||||||
|
oftree tree;
|
||||||
|
ofnode node;
|
||||||
|
|
||||||
|
/* skip this test if multiple FDTs are not supported */
|
||||||
|
if (!IS_ENABLED(CONFIG_OFNODE_MULTI_TREE))
|
||||||
|
return -EAGAIN;
|
||||||
|
|
||||||
ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0));
|
ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0));
|
||||||
ret = get_oftree(uts, fdt, &tree);
|
ut_assertok(get_oftree(uts, fdt, &tree));
|
||||||
|
|
||||||
/* skip the rest of this test if multiple FDTs are not supported */
|
|
||||||
if (ret == -EOVERFLOW)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ut_assertok(ret);
|
|
||||||
ut_assert(oftree_valid(tree));
|
ut_assert(oftree_valid(tree));
|
||||||
|
|
||||||
/* Make sure they don't work on this new tree */
|
/* Make sure they don't work on this new tree */
|
||||||
@ -791,7 +796,7 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT);
|
DM_TEST(dm_test_ofnode_root_mult, UT_TESTF_SCAN_FDT);
|
||||||
|
|
||||||
static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
|
static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user