From: Michael Santana Date: Sat, 15 Jun 2019 06:42:27 +0000 (+0200) Subject: test/eal: check number of cores before running subtests X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b0209034f2bb99a91b25acb3042476cb14e0c28f;p=dpdk.git test/eal: check number of cores before running subtests The eal flags unit test assumes that a certain number of cores are available (4 and 8 cores), however this may not always be the case. Individual developers may run the unit test on their local desktop which typically have 2 to 4 cores, in said case the test is bound to fail for lacking 4 or 8 cores. Additionally, as we push forward introducing CI into DPDK we are limited to the hardware specification of CI services (e.g. Travis CI) that only have 2 cores on their servers, in which case the test would fail. To fix this we check available cores before running a subtest. This applies to subtests that are dedicated to test that the -l and --lcore flags work correctly. If not enough cores are available the subtest is simply skipped, otherwise the subtest is run. Signed-off-by: Michael Santana Signed-off-by: David Marchand Acked-by: Aaron Conole --- diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 5e11b9f2bd..cfa8a61f34 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -560,7 +560,9 @@ test_missing_c_flag(void) "process ran without error with invalid -l flag\n"); return -1; } - if (launch_proc(argv15) != 0) { + if (rte_lcore_is_enabled(0) && rte_lcore_is_enabled(1) && + rte_lcore_is_enabled(2) && rte_lcore_is_enabled(3) && + launch_proc(argv15) != 0) { printf("Error - " "process did not run ok with valid corelist value\n"); return -1; @@ -579,7 +581,11 @@ test_missing_c_flag(void) return -1; } - if (launch_proc(argv29) != 0) { + if (rte_lcore_is_enabled(0) && rte_lcore_is_enabled(1) && + rte_lcore_is_enabled(2) && rte_lcore_is_enabled(3) && + rte_lcore_is_enabled(3) && rte_lcore_is_enabled(5) && + rte_lcore_is_enabled(4) && rte_lcore_is_enabled(7) && + launch_proc(argv29) != 0) { printf("Error - " "process did not run ok with valid corelist value\n"); return -1; @@ -606,6 +612,9 @@ test_master_lcore_flag(void) snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); #endif + if (!rte_lcore_is_enabled(0) || !rte_lcore_is_enabled(1)) + return TEST_SKIPPED; + /* --master-lcore flag but no value */ const char *argv1[] = { prgname, prefix, mp_flag, "-c", "3", "--master-lcore"};