X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_eal_flags.c;h=d9c0d93cbce782f2af61565bbcfa40313d468c2c;hb=1e0b51fd4b75790313045cfbb8ba059e7907bc44;hp=e0aee2df2875aa98b9f9bdc253898ab6fe2df0c0;hpb=c4d404d7c1257465176deb5bb8c84e627d2d5eee;p=dpdk.git diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index e0aee2df28..d9c0d93cbc 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -674,13 +674,13 @@ test_master_lcore_flag(void) } /* - * Test that the app doesn't run without the -n flag. In all cases - * should give an error and fail to run. + * Test that the app doesn't run with invalid -n flag option. + * Final test ensures it does run with valid options as sanity check * Since -n is not compulsory for MP, we instead use --no-huge and --no-shconf * flags. */ static int -test_missing_n_flag(void) +test_invalid_n_flag(void) { #ifdef RTE_EXEC_ENV_BSDAPP /* BSD target doesn't support prefixes at this point */ @@ -696,26 +696,31 @@ test_missing_n_flag(void) /* -n flag but no value */ const char *argv1[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n"}; - /* No -n flag at all */ - const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"}; /* bad numeric value */ - const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" }; + const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" }; /* out-of-range value */ - const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "9" }; + const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "9" }; /* sanity test - check with good value */ - const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" }; + const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" }; + /* sanity test - check with no -n flag */ + const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"}; if (launch_proc(argv1) == 0 || launch_proc(argv2) == 0 - || launch_proc(argv3) == 0 - || launch_proc(argv4) == 0) { - printf("Error - process ran without error when missing -n flag\n"); + || launch_proc(argv3) == 0) { + printf("Error - process ran without error when" + "invalid -n flag\n"); return -1; } - if (launch_proc(argv5) != 0) { + if (launch_proc(argv4) != 0) { printf("Error - process did not run ok with valid num-channel value\n"); return -1; } + if (launch_proc(argv5) != 0) { + printf("Error - process did not run ok without -n flag\n"); + return -1; + } + return 0; } @@ -1368,9 +1373,9 @@ test_eal_flags(void) return ret; } - ret = test_missing_n_flag(); + ret = test_invalid_n_flag(); if (ret < 0) { - printf("Error in test_missing_n_flag()\n"); + printf("Error in test_invalid_n_flag()\n"); return ret; }