[dpdk-dev] [PATCH v1 07/10] app/test: convert current pci_test into a single test case

Jan Viktorin viktorin at rehivetech.com
Fri May 6 12:48:37 CEST 2016


The current test_pci is just a single test case that tests the blacklisting
of devices. Rename it to test_pci_blacklist and call it from the test_pci.

Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
---
 app/test/test_pci.c | 85 +++++++++++++++++++++++++++++------------------------
 1 file changed, 47 insertions(+), 38 deletions(-)

diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 9d53ba5..2e2fd70 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -144,51 +144,14 @@ static void free_devargs_list(void)
 	}
 }
 
-/* real drivers (not used for testing) */
-struct pci_driver_list real_pci_driver_list =
-	TAILQ_HEAD_INITIALIZER(real_pci_driver_list);
-
 static int
-test_pci_setup(void)
-{
-	struct rte_pci_driver *dr;
-
-	/* Unregister original driver list */
-	while (!TAILQ_EMPTY(&pci_driver_list)) {
-		dr = TAILQ_FIRST(&pci_driver_list);
-		rte_eal_pci_unregister(dr);
-		TAILQ_INSERT_TAIL(&real_pci_driver_list, dr, next);
-	}
-
-	return 0;
-}
-
-static int
-test_pci_cleanup(void)
-{
-	struct rte_pci_driver *dr;
-
-	/* Restore original driver list */
-	while (!TAILQ_EMPTY(&real_pci_driver_list)) {
-		dr = TAILQ_FIRST(&real_pci_driver_list);
-		TAILQ_REMOVE(&real_pci_driver_list, dr, next);
-		rte_eal_pci_register(dr);
-	}
-
-	return 0;
-}
-
-int
-test_pci(void)
+test_pci_blacklist(void)
 {
 	struct rte_devargs_list save_devargs_list;
 
 	printf("Dump all devices\n");
 	rte_eal_pci_dump(stdout);
 
-	if (test_pci_setup())
-		return -1;
-
 	rte_eal_pci_register(&my_driver);
 	rte_eal_pci_register(&my_driver2);
 
@@ -224,6 +187,52 @@ test_pci(void)
 	rte_eal_pci_unregister(&my_driver);
 	rte_eal_pci_unregister(&my_driver2);
 
+	return 0;
+}
+
+/* real drivers (not used for testing) */
+struct pci_driver_list real_pci_driver_list =
+	TAILQ_HEAD_INITIALIZER(real_pci_driver_list);
+
+static int
+test_pci_setup(void)
+{
+	struct rte_pci_driver *dr;
+
+	/* Unregister original driver list */
+	while (!TAILQ_EMPTY(&pci_driver_list)) {
+		dr = TAILQ_FIRST(&pci_driver_list);
+		rte_eal_pci_unregister(dr);
+		TAILQ_INSERT_TAIL(&real_pci_driver_list, dr, next);
+	}
+
+	return 0;
+}
+
+static int
+test_pci_cleanup(void)
+{
+	struct rte_pci_driver *dr;
+
+	/* Restore original driver list */
+	while (!TAILQ_EMPTY(&real_pci_driver_list)) {
+		dr = TAILQ_FIRST(&real_pci_driver_list);
+		TAILQ_REMOVE(&real_pci_driver_list, dr, next);
+		rte_eal_pci_register(dr);
+	}
+
+	return 0;
+}
+
+int
+test_pci(void)
+{
+	if (test_pci_setup())
+		return -1;
+
+	if (test_pci_blacklist())
+		return -1;
+
 	if (test_pci_cleanup())
 		return -1;
 
-- 
2.8.0



More information about the dev mailing list