X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest%2Ftest_eal_flags.c;h=e82bb963a0b58aaf096ffc3c9a86946a65967ab1;hb=6e7cbd63706f3435b9d9a2057a37db1da01db9a7;hp=91b40664baae326969bdf72a990b84f8512c8c60;hpb=7595afa4d30097c1177b69257118d8ad89a539be;p=deb_dpdk.git diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c index 91b40664..e82bb963 100644 --- a/test/test/test_eal_flags.c +++ b/test/test/test_eal_flags.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -52,11 +51,7 @@ #include "process.h" -#ifdef RTE_LIBRTE_XEN_DOM0 -#define DEFAULT_MEM_SIZE "30" -#else #define DEFAULT_MEM_SIZE "18" -#endif #define mp_flag "--proc-type=secondary" #define no_hpet "--no-hpet" #define no_huge "--no-huge" @@ -66,7 +61,7 @@ #define memtest "memtest" #define memtest1 "memtest1" #define memtest2 "memtest2" -#define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10) +#define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 20) #define launch_proc(ARGV) process_dup(ARGV, \ sizeof(ARGV)/(sizeof(ARGV[0])), __func__) @@ -409,17 +404,17 @@ test_invalid_vdev_flag(void) #endif /* Test with invalid vdev option */ - const char *vdevinval[] = {prgname, prefix, "-n", "1", + const char *vdevinval[] = {prgname, prefix, no_huge, "-n", "1", "-c", "1", vdev, "eth_dummy"}; /* Test with valid vdev option */ - const char *vdevval1[] = {prgname, prefix, "-n", "1", + const char *vdevval1[] = {prgname, prefix, no_huge, "-n", "1", "-c", "1", vdev, "net_ring0"}; - const char *vdevval2[] = {prgname, prefix, "-n", "1", + const char *vdevval2[] = {prgname, prefix, no_huge, "-n", "1", "-c", "1", vdev, "net_ring0,args=test"}; - const char *vdevval3[] = {prgname, prefix, "-n", "1", + const char *vdevval3[] = {prgname, prefix, no_huge, "-n", "1", "-c", "1", vdev, "net_ring0,nodeaction=r1:0:CREATE"}; if (launch_proc(vdevinval) == 0) { @@ -810,72 +805,6 @@ test_no_huge_flag(void) return 0; } -#ifdef RTE_LIBRTE_XEN_DOM0 -static int -test_dom0_misc_flags(void) -{ - char prefix[PATH_MAX], tmp[PATH_MAX]; - - if (get_current_prefix(tmp, sizeof(tmp)) == NULL) { - printf("Error - unable to get current prefix!\n"); - return -1; - } - snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); - - /* check that some general flags don't prevent things from working. - * All cases, apart from the first, app should run. - * No futher testing of output done. - */ - /* sanity check - failure with invalid option */ - const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"}; - - /* With --no-pci */ - const char *argv1[] = {prgname, prefix, mp_flag, "-c", "1", "--no-pci"}; - /* With -v */ - const char *argv2[] = {prgname, prefix, mp_flag, "-c", "1", "-v"}; - /* With valid --syslog */ - const char *argv3[] = {prgname, prefix, mp_flag, "-c", "1", - "--syslog", "syslog"}; - /* With empty --syslog (should fail) */ - const char *argv4[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog"}; - /* With invalid --syslog */ - const char *argv5[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog", "error"}; - /* With no-sh-conf */ - const char *argv6[] = {prgname, "-c", "1", "-n", "2", "-m", "20", - "--no-shconf", "--file-prefix=noshconf" }; - - if (launch_proc(argv0) == 0) { - printf("Error - process ran ok with invalid flag\n"); - return -1; - } - if (launch_proc(argv1) != 0) { - printf("Error - process did not run ok with --no-pci flag\n"); - return -1; - } - if (launch_proc(argv2) != 0) { - printf("Error - process did not run ok with -v flag\n"); - return -1; - } - if (launch_proc(argv3) != 0) { - printf("Error - process did not run ok with --syslog flag\n"); - return -1; - } - if (launch_proc(argv4) == 0) { - printf("Error - process run ok with empty --syslog flag\n"); - return -1; - } - if (launch_proc(argv5) == 0) { - printf("Error - process run ok with invalid --syslog flag\n"); - return -1; - } - if (launch_proc(argv6) != 0) { - printf("Error - process did not run ok with --no-shconf flag\n"); - return -1; - } - - return 0; -} -#else static int test_misc_flags(void) { @@ -932,7 +861,7 @@ test_misc_flags(void) /* check that some general flags don't prevent things from working. * All cases, apart from the first, app should run. - * No futher testing of output done. + * No further testing of output done. */ /* sanity check - failure with invalid option */ const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"}; @@ -948,13 +877,10 @@ test_misc_flags(void) const char *argv4[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog"}; /* With invalid --syslog */ const char *argv5[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog", "error"}; - /* With no-sh-conf */ + /* With no-sh-conf, also use no-huge to ensure this test runs on BSD */ const char *argv6[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE, - no_shconf, nosh_prefix }; + no_shconf, nosh_prefix, no_huge}; -#ifdef RTE_EXEC_ENV_BSDAPP - return 0; -#endif /* With --huge-dir */ const char *argv7[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE, "--file-prefix=hugedir", "--huge-dir", hugepath}; @@ -988,6 +914,7 @@ test_misc_flags(void) const char *argv15[] = {prgname, "--file-prefix=intr", "-c", "1", "-n", "2", "--vfio-intr=invalid"}; + /* run all tests also applicable to FreeBSD first */ if (launch_proc(argv0) == 0) { printf("Error - process ran ok with invalid flag\n"); @@ -1001,6 +928,16 @@ test_misc_flags(void) printf("Error - process did not run ok with -v flag\n"); return -1; } + if (launch_proc(argv6) != 0) { + printf("Error - process did not run ok with --no-shconf flag\n"); + return -1; + } + +#ifdef RTE_EXEC_ENV_BSDAPP + /* no more tests to be done on FreeBSD */ + return 0; +#endif + if (launch_proc(argv3) != 0) { printf("Error - process did not run ok with --syslog flag\n"); return -1; @@ -1013,13 +950,6 @@ test_misc_flags(void) printf("Error - process run ok with invalid --syslog flag\n"); return -1; } - if (launch_proc(argv6) != 0) { - printf("Error - process did not run ok with --no-shconf flag\n"); - return -1; - } -#ifdef RTE_EXEC_ENV_BSDAPP - return 0; -#endif if (launch_proc(argv7) != 0) { printf("Error - process did not run ok with --huge-dir flag\n"); return -1; @@ -1062,7 +992,6 @@ test_misc_flags(void) } return 0; } -#endif static int test_file_prefix(void) @@ -1099,9 +1028,6 @@ test_file_prefix(void) printf("Error - unable to get current prefix!\n"); return -1; } -#ifdef RTE_LIBRTE_XEN_DOM0 - return 0; -#endif /* check if files for current prefix are present */ if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) { @@ -1241,10 +1167,11 @@ test_memory_flags(void) #ifdef RTE_EXEC_ENV_BSDAPP int i, num_sockets = 1; #else - int i, num_sockets = get_number_of_sockets(); + int i, num_sockets = RTE_MIN(get_number_of_sockets(), + RTE_MAX_NUMA_NODES); #endif - if (num_sockets <= 0 || num_sockets > RTE_MAX_NUMA_NODES) { + if (num_sockets <= 0) { printf("Error - cannot get number of sockets!\n"); return -1; } @@ -1300,9 +1227,6 @@ test_memory_flags(void) printf("Error - process failed with valid -m flag!\n"); return -1; } -#ifdef RTE_LIBRTE_XEN_DOM0 - return 0; -#endif if (launch_proc(argv2) == 0) { printf("Error - process run ok with invalid (zero) --socket-mem!\n"); return -1; @@ -1428,11 +1352,7 @@ test_eal_flags(void) return ret; } -#ifdef RTE_LIBRTE_XEN_DOM0 - ret = test_dom0_misc_flags(); -#else ret = test_misc_flags(); -#endif if (ret < 0) { printf("Error in test_misc_flags()"); return ret;