net/mlx5: resize a full counter container
[dpdk.git] / app / test / test_eal_flags.c
index 5e11b9f..672ca0a 100644 (file)
@@ -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>
 
@@ -342,10 +342,10 @@ test_invalid_b_flag(void)
  *  Test that the app doesn't run with invalid vdev option.
  *  Final test ensures it does run with valid options as sanity check
  */
-#ifdef RTE_LIBRTE_PMD_RING
 static int
 test_invalid_vdev_flag(void)
 {
+#ifdef RTE_LIBRTE_PMD_RING
 #ifdef RTE_EXEC_ENV_FREEBSD
        /* BSD target doesn't support prefixes at this point, and we also need to
         * run another primary process here */
@@ -391,8 +391,10 @@ test_invalid_vdev_flag(void)
                return -1;
        }
        return 0;
-}
+#else
+       return TEST_SKIPPED;
 #endif
+}
 
 /*
  * Test that the app doesn't run with invalid -r option.
@@ -560,7 +562,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 +583,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 +614,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"};
@@ -892,6 +903,18 @@ test_misc_flags(void)
        const char *argv15[] = {prgname, "--file-prefix=intr",
                        "--vfio-intr=invalid"};
 
+       /* With process type as auto-detect */
+       const char * const argv16[] = {prgname, "--file-prefix=auto",
+                       "--proc-type=auto"};
+
+       /* With process type as auto-detect with no-shconf */
+       const char * const argv17[] = {prgname, "--proc-type=auto",
+                       no_shconf, nosh_prefix, no_huge};
+
+       /* With process type as --create-uio-dev flag */
+       const char * const argv18[] = {prgname, "--file-prefix=uiodev",
+                       "--create-uio-dev"};
+
        /* run all tests also applicable to FreeBSD first */
 
        if (launch_proc(argv0) == 0) {
@@ -968,6 +991,22 @@ test_misc_flags(void)
                                "--vfio-intr invalid parameter\n");
                return -1;
        }
+       if (launch_proc(argv16) != 0) {
+               printf("Error - process did not run ok with "
+                               "--proc-type as auto parameter\n");
+               return -1;
+       }
+       if (launch_proc(argv17) != 0) {
+               printf("Error - process did not run ok with "
+                               "--proc-type and --no-shconf parameter\n");
+               return -1;
+       }
+       if (launch_proc(argv18) != 0) {
+               printf("Error - process did not run ok with "
+                               "--create-uio-dev parameter\n");
+               return -1;
+       }
+
        return 0;
 }
 
@@ -1022,6 +1061,24 @@ test_file_prefix(void)
        const char *argv4[] = {prgname, "-m",
                        DEFAULT_MEM_SIZE, "--file-prefix=" memtest2 };
 
+       /* primary process with --in-memory mode */
+       const char * const argv5[] = {prgname, "-m",
+               DEFAULT_MEM_SIZE, "--in-memory" };
+
+       /* primary process with memtest1 and --in-memory mode */
+       const char * const argv6[] = {prgname, "-m",
+               DEFAULT_MEM_SIZE, "--in-memory",
+               "--file-prefix=" memtest1 };
+
+       /* primary process with parent file-prefix and --in-memory mode */
+       const char * const argv7[] = {prgname, "-m",
+               DEFAULT_MEM_SIZE, "--in-memory", "--file-prefix", prefix };
+
+       /* primary process with memtest1 and --single-file-segments mode */
+       const char * const argv8[] = {prgname, "-m",
+               DEFAULT_MEM_SIZE, "--single-file-segments",
+               "--file-prefix=" memtest1 };
+
        /* check if files for current prefix are present */
        if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) {
                printf("Error - hugepage files for %s were not created!\n", prefix);
@@ -1142,6 +1199,54 @@ test_file_prefix(void)
                return -1;
        }
 
+       /* this process will run in --in-memory mode, so it should not leave any
+        * hugepage files behind.
+        */
+
+       /* test case to check eal-options with --in-memory mode */
+       if (launch_proc(argv5) != 0) {
+               printf("Error - failed to run with --in-memory mode\n");
+               return -1;
+       }
+
+       /*test case to check eal-options with --in-memory mode with
+        * custom file-prefix.
+        */
+       if (launch_proc(argv6) != 0) {
+               printf("Error - failed to run with --in-memory mode\n");
+               return -1;
+       }
+
+       /* check if hugefiles for memtest1 are present */
+       if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 0) {
+               printf("Error - hugepage files for %s were created and not deleted!\n",
+                               memtest1);
+               return -1;
+       }
+
+       /* test case to check eal-options with --in-memory mode with
+        * parent file-prefix.
+        */
+       if (launch_proc(argv7) != 0) {
+               printf("Error - failed to run with --file-prefix=%s\n", prefix);
+               return -1;
+       }
+
+       /* this process will run in --single-file-segments mode,
+        * so it should not leave any hugepage files behind.
+        */
+       if (launch_proc(argv8) != 0) {
+               printf("Error - failed to run with --single-file-segments mode\n");
+               return -1;
+       }
+
+       /* check if hugefiles for memtest1 are present */
+       if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 0) {
+               printf("Error - hugepage files for %s were not deleted!\n",
+                               memtest1);
+               return -1;
+       }
+
        return 0;
 }
 
@@ -1404,3 +1509,17 @@ test_eal_flags(void)
 }
 
 REGISTER_TEST_COMMAND(eal_flags_autotest, test_eal_flags);
+
+/* subtests used in meson for CI */
+REGISTER_TEST_COMMAND(eal_flags_c_opt_autotest, test_missing_c_flag);
+REGISTER_TEST_COMMAND(eal_flags_master_opt_autotest, test_master_lcore_flag);
+REGISTER_TEST_COMMAND(eal_flags_n_opt_autotest, test_invalid_n_flag);
+REGISTER_TEST_COMMAND(eal_flags_hpet_autotest, test_no_hpet_flag);
+REGISTER_TEST_COMMAND(eal_flags_no_huge_autotest, test_no_huge_flag);
+REGISTER_TEST_COMMAND(eal_flags_w_opt_autotest, test_whitelist_flag);
+REGISTER_TEST_COMMAND(eal_flags_b_opt_autotest, test_invalid_b_flag);
+REGISTER_TEST_COMMAND(eal_flags_vdev_opt_autotest, test_invalid_vdev_flag);
+REGISTER_TEST_COMMAND(eal_flags_r_opt_autotest, test_invalid_r_flag);
+REGISTER_TEST_COMMAND(eal_flags_mem_autotest, test_memory_flags);
+REGISTER_TEST_COMMAND(eal_flags_file_prefix_autotest, test_file_prefix);
+REGISTER_TEST_COMMAND(eal_flags_misc_autotest, test_misc_flags);