[PATCH v6 4/9] test: use unit test runner for eal flags

Stephen Hemminger
2025-11-23T17:45:33Z

Make the sub tests in eal flags suite into a group
so that they are not individual tests.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
app/test/test_eal_flags.c | 46 +++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 0aebb5f611..ba25f8e1c8 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -755,7 +755,7 @@ static int
test_no_hpet_flag(void)
{
#ifdef RTE_EXEC_ENV_FREEBSD
- return 0;
+ return TEST_SKIPPED;
#else
const char *prefix = get_file_prefix();
if (prefix == NULL)
@@ -774,8 +774,8 @@ test_no_hpet_flag(void)
printf("Error - process did not run ok without --no-hpet flag\n");
return -1;
}
-#
return 0;
+#endif
}

/*
@@ -844,7 +844,7 @@ test_no_huge_flag(void)
printf("Error - process run ok with --no-huge and --huge-worker-stack=size flags");
return -1;
}
-#endif
+
return 0;
}

@@ -1179,7 +1179,7 @@ test_file_prefix(void)
char prefix[PATH_MAX] = "";

#ifdef RTE_EXEC_ENV_FREEBSD
- return 0;
+ return TEST_SKIPPED;
#else
if (get_current_prefix(prefix, sizeof(prefix)) == NULL) {
printf("Error - unable to get current prefix!\n");
@@ -1621,15 +1621,29 @@ test_memory_flags(void)

#endif /* !RTE_EXEC_ENV_WINDOWS */

-REGISTER_FAST_TEST(eal_flags_c_opt_autotest, false, false, test_missing_c_flag);
-REGISTER_FAST_TEST(eal_flags_main_opt_autotest, false, false, test_main_lcore_flag);
-REGISTER_FAST_TEST(eal_flags_n_opt_autotest, false, false, test_invalid_n_flag);
-REGISTER_FAST_TEST(eal_flags_hpet_autotest, false, false, test_no_hpet_flag);
-REGISTER_FAST_TEST(eal_flags_no_huge_autotest, false, false, test_no_huge_flag);
-REGISTER_FAST_TEST(eal_flags_a_opt_autotest, false, false, test_allow_flag);
-REGISTER_FAST_TEST(eal_flags_b_opt_autotest, false, false, test_invalid_b_flag);
-REGISTER_FAST_TEST(eal_flags_vdev_opt_autotest, false, false, test_invalid_vdev_flag);
-REGISTER_FAST_TEST(eal_flags_r_opt_autotest, false, false, test_invalid_r_flag);
-REGISTER_FAST_TEST(eal_flags_mem_autotest, false, false, test_memory_flags);
-REGISTER_FAST_TEST(eal_flags_file_prefix_autotest, false, false, test_file_prefix);
-REGISTER_FAST_TEST(eal_flags_misc_autotest, false, false, test_misc_flags);
+static struct unit_test_suite eal_flags_test_suite = {
+ .suite_name = "EAL flags unit test suite",
+ .unit_test_cases = {
+ TEST_CASE(test_missing_c_flag),
+ TEST_CASE(test_main_lcore_flag),
+ TEST_CASE(test_invalid_n_flag),
+ TEST_CASE(test_no_hpet_flag),
+ TEST_CASE(test_no_huge_flag),
+ TEST_CASE(test_allow_flag),
+ TEST_CASE(test_invalid_b_flag),
+ TEST_CASE(test_invalid_vdev_flag),
+ TEST_CASE(test_invalid_r_flag),
+ TEST_CASE(test_memory_flags),
+ TEST_CASE(test_file_prefix),
+ TEST_CASE(test_misc_flags),
+ TEST_CASES_END()
+ }
+};
+
+static int
+test_eal_flags(void)
+{
+ return unit_test_suite_runner(&eal_flags_test_suite);
+}
+
+REGISTER_FAST_TEST(eal_flags_autotest, false, false, test_eal_flags);
--
2.51.0