+ 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;
+ }
+
+ /* start --lcores tests */
+ if (launch_proc(argv16) == 0 || launch_proc(argv17) == 0 ||
+ launch_proc(argv18) == 0 || launch_proc(argv19) == 0 ||
+ launch_proc(argv20) == 0 || launch_proc(argv21) == 0 ||
+ launch_proc(argv22) == 0 || launch_proc(argv23) == 0 ||
+ launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
+ launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
+ launch_proc(argv28) == 0) {
+ printf("Error - "
+ "process ran without error with invalid --lcore flag\n");
+ return -1;
+ }
+
+ 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;
+ }
+
+ return 0;
+}
+
+/*
+ * Test --master-lcore option with matching coremask
+ */
+static int
+test_master_lcore_flag(void)
+{
+#ifdef RTE_EXEC_ENV_FREEBSD
+ /* BSD target doesn't support prefixes at this point */
+ const char *prefix = "";
+#else
+ 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);
+#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"};
+ /* --master-lcore flag with invalid value */
+ const char *argv2[] = { prgname, prefix, mp_flag,
+ "-c", "3", "--master-lcore", "-1"};
+ const char *argv3[] = { prgname, prefix, mp_flag,
+ "-c", "3", "--master-lcore", "X"};
+ /* master lcore not in coremask */
+ const char *argv4[] = { prgname, prefix, mp_flag,
+ "-c", "3", "--master-lcore", "2"};
+ /* valid value */
+ const char *argv5[] = { prgname, prefix, mp_flag,
+ "-c", "3", "--master-lcore", "1"};
+ /* valid value set before coremask */
+ const char *argv6[] = { prgname, prefix, mp_flag,
+ "--master-lcore", "1", "-c", "3"};
+
+ if (launch_proc(argv1) == 0
+ || launch_proc(argv2) == 0
+ || launch_proc(argv3) == 0
+ || launch_proc(argv4) == 0) {
+ printf("Error - process ran without error with wrong --master-lcore\n");
+ return -1;
+ }
+ if (launch_proc(argv5) != 0
+ || launch_proc(argv6) != 0) {
+ printf("Error - process did not run ok with valid --master-lcore\n");