diff mbox series

[11/14] test/eal: check number of cores before running subtests

Message ID 1559638792-8608-12-git-send-email-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Unit tests fixes for CI | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

David Marchand June 4, 2019, 8:59 a.m. UTC
From: Michael Santana <msantana@redhat.com>

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 <msantana@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_eal_flags.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Aaron Conole June 4, 2019, 1:26 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> From: Michael Santana <msantana@redhat.com>
>
> 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 <msantana@redhat.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>
Burakov, Anatoly June 26, 2019, 9:47 a.m. UTC | #2
On 04-Jun-19 9:59 AM, David Marchand wrote:
> From: Michael Santana <msantana@redhat.com>
> 
> 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 <msantana@redhat.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

While i think it's OK to skip tests we *can't* run without having many 
cores, maybe we should also look into reducing core consumption in our 
tests - i'm pretty sure we'll find cases where we don't really need 
those 8+ cores running our tests.

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
diff mbox series

Patch

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 5e11b9f..cfa8a61 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -19,7 +19,7 @@ 
 #include <limits.h>
 #include <fcntl.h>
 
-#include <rte_per_lcore.h>
+#include <rte_lcore.h>
 #include <rte_debug.h>
 #include <rte_string_fns.h>
 
@@ -560,7 +560,9 @@  enum hugepage_action {
 		       "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 @@  enum hugepage_action {
 		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 @@  enum hugepage_action {
 	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"};