+ * Test that the app doesn't run with invalid whitelist option.
+ * Final tests ensures it does run with valid options as sanity check (one
+ * test for with Domain+BDF, second for just with BDF)
+ */
+static int
+test_whitelist_flag(void)
+{
+ unsigned i;
+#ifdef RTE_EXEC_ENV_BSDAPP
+ /* 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;
+ }
+ rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
+#endif
+
+ const char *wlinval[][11] = {
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "error", "", ""},
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "0:0:0", "", ""},
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "0:error:0.1", "", ""},
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "0:0:0.1error", "", ""},
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "error0:0:0.1", "", ""},
+ {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "0:0:0.1.2", "", ""},
+ };
+ /* Test with valid whitelist option */
+ const char *wlval1[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "00FF:09:0B.3"};
+ const char *wlval2[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "09:0B.3", pci_whitelist, "0a:0b.1"};
+ const char *wlval3[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
+ pci_whitelist, "09:0B.3,type=test",
+ pci_whitelist, "08:00.1,type=normal",
+#ifdef CONFIG_RTE_LIBRTE_PMD_RING
+ vdev, "eth_ring,arg=test",
+#endif
+ };
+
+ for (i = 0; i < sizeof(wlinval) / sizeof(wlinval[0]); i++) {
+ if (launch_proc(wlinval[i]) == 0) {
+ printf("Error - process did run ok with invalid "
+ "whitelist parameter\n");
+ return -1;
+ }
+ }
+ if (launch_proc(wlval1) != 0 ) {
+ printf("Error - process did not run ok with valid whitelist\n");
+ return -1;
+ }
+ if (launch_proc(wlval2) != 0 ) {
+ printf("Error - process did not run ok with valid whitelist value set\n");
+ return -1;
+ }
+ if (launch_proc(wlval3) != 0 ) {
+ printf("Error - process did not run ok with valid whitelist + args\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Test that the app doesn't run with invalid blacklist option.