[dpdk-dev] [PATCH 4/5] app: no more bare metal environment

Thomas Monjalon thomas.monjalon at 6wind.com
Fri Sep 26 16:04:01 CEST 2014


From: David Marchand <david.marchand at 6wind.com>

Signed-off-by: David Marchand <david.marchand at 6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 app/cmdline_test/cmdline_test.h |  7 ------
 app/dump_cfg/main.c             |  4 +---
 app/dump_cfg/main.h             | 45 -------------------------------------
 app/test-acl/main.c             |  6 +++--
 app/test-acl/main.h             | 50 -----------------------------------------
 app/test-pipeline/main.c        |  2 +-
 app/test-pipeline/main.h        |  8 -------
 app/test-pmd/cmdline.c          |  2 +-
 app/test-pmd/testpmd.c          |  4 ----
 app/test-pmd/testpmd.h          |  6 -----
 app/test/Makefile               |  4 ----
 app/test/autotest.py            |  8 +------
 app/test/autotest_runner.py     | 33 ++++++++++-----------------
 app/test/process.h              |  4 ----
 app/test/test.c                 |  4 ----
 app/test/test.h                 |  7 ------
 app/test/test_debug.c           | 28 ++---------------------
 app/test/test_interrupts.c      |  2 +-
 app/test/test_mbuf.c            | 14 +-----------
 19 files changed, 24 insertions(+), 214 deletions(-)
 delete mode 100644 app/dump_cfg/main.h
 delete mode 100644 app/test-acl/main.h

diff --git a/app/cmdline_test/cmdline_test.h b/app/cmdline_test/cmdline_test.h
index 796fe20..1c9af12 100644
--- a/app/cmdline_test/cmdline_test.h
+++ b/app/cmdline_test/cmdline_test.h
@@ -34,13 +34,6 @@
 #ifndef _CMDLINE_TEST_H_
 #define _CMDLINE_TEST_H_
 
-/* icc on baremetal gives us troubles with function named 'main' */
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define main _main
-#endif
-
 extern cmdline_parse_ctx_t main_ctx[];
 
-int main(int argc, char **argv);
-
 #endif
diff --git a/app/dump_cfg/main.c b/app/dump_cfg/main.c
index c9b40d1..127dbb1 100644
--- a/app/dump_cfg/main.c
+++ b/app/dump_cfg/main.c
@@ -53,10 +53,8 @@
 #include <rte_branch_prediction.h>
 #include <rte_string_fns.h>
 
-#include "main.h"
-
 int
-MAIN(int argc, char **argv)
+main(int argc, char **argv)
 {
 	int ret;
 	int i;
diff --git a/app/dump_cfg/main.h b/app/dump_cfg/main.h
deleted file mode 100644
index f54938b..0000000
--- a/app/dump_cfg/main.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MAIN_H_
-#define _MAIN_H_
-
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define MAIN _main
-#else
-#define MAIN main
-#endif
-
-int MAIN(int argc, char **argv);
-
-#endif /* _MAIN_H_ */
diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 44add10..9d4dce6 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -62,7 +62,9 @@
 
 #endif /*RTE_LIBRTE_ACL_STANDALONE */
 
-#include "main.h"
+#define	RTE_LOGTYPE_TESTACL	RTE_LOGTYPE_USER1
+
+#define	APP_NAME	"TESTACL"
 
 #define GET_CB_FIELD(in, fd, base, lim, dlm)	do {            \
 	unsigned long val;                                      \
@@ -1012,7 +1014,7 @@ get_input_opts(int argc, char **argv)
 }
 
 int
-MAIN(int argc, char **argv)
+main(int argc, char **argv)
 {
 	int ret;
 	uint32_t lcore;
diff --git a/app/test-acl/main.h b/app/test-acl/main.h
deleted file mode 100644
index cec0408..0000000
--- a/app/test-acl/main.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MAIN_H_
-#define _MAIN_H_
-
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define MAIN _main
-#else
-#define MAIN main
-#endif
-
-#define	RTE_LOGTYPE_TESTACL	RTE_LOGTYPE_USER1
-
-#define	APP_NAME	"TESTACL"
-
-
-int MAIN(int argc, char **argv);
-
-#endif /* _MAIN_H_ */
diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c
index 0a2a597..129b1fc 100644
--- a/app/test-pipeline/main.c
+++ b/app/test-pipeline/main.c
@@ -76,7 +76,7 @@
 #include "main.h"
 
 int
-MAIN(int argc, char **argv)
+main(int argc, char **argv)
 {
 	uint32_t lcore;
 	int ret;
diff --git a/app/test-pipeline/main.h b/app/test-pipeline/main.h
index 2ed2928..0c90fc3 100644
--- a/app/test-pipeline/main.h
+++ b/app/test-pipeline/main.h
@@ -137,12 +137,4 @@ void app_main_loop_tx(void);
 #define APP_FLUSH 0x3FF
 #endif
 
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define MAIN _main
-#else
-#define MAIN main
-#endif
-
-int MAIN(int argc, char **argv);
-
 #endif /* _MAIN_H_ */
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 225f669..6fd590e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -171,7 +171,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" statistics.\n\n"
 
 			"quit\n"
-			"    Quit to prompt in Linux and reboot on Baremetal.\n\n"
+			"    Quit to prompt.\n\n"
 		);
 	}
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 9f6cdc4..1888fa2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1852,10 +1852,6 @@ init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf)
 	return 0;
 }
 
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define main _main
-#endif
-
 int
 main(int argc, char** argv)
 {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cbfeac..a273a2c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -34,12 +34,6 @@
 #ifndef _TESTPMD_H_
 #define _TESTPMD_H_
 
-/* icc on baremetal gives us troubles with function named 'main' */
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define main _main
-int main(int argc, char **argv);
-#endif
-
 #define RTE_PORT_ALL            (~(portid_t)0x0)
 
 #define RTE_TEST_RX_DESC_MAX    2048
diff --git a/app/test/Makefile b/app/test/Makefile
index 37a3772..210a7f6 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -91,13 +91,9 @@ SRCS-y += test_errno.c
 SRCS-y += test_tailq.c
 SRCS-y += test_string_fns.c
 SRCS-y += test_cpuflags.c
-
-ifeq ($(CONFIG_RTE_EXEC_ENV_BAREMETAL),)
 SRCS-y += test_mp_secondary.c
 SRCS-y += test_eal_flags.c
 SRCS-y += test_eal_fs.c
-endif
-
 SRCS-y += test_alarm.c
 SRCS-y += test_interrupts.c
 SRCS-y += test_version.c
diff --git a/app/test/autotest.py b/app/test/autotest.py
index f7056a3..a79db10 100644
--- a/app/test/autotest.py
+++ b/app/test/autotest.py
@@ -60,13 +60,7 @@ if len(sys.argv) > 3:
 	else:
 		test_whitelist = testlist
 
-# adjust test command line
-if "baremetal" in target:
-	cmdline  = "qemu-system-x86_64 -cdrom %s.iso -boot d " % (sys.argv[1])
-	cmdline	+= "-m 2000 -smp 4 -nographic -net nic,model=e1000"
-	platform = "QEMU x86_64"
-else:
-	cmdline  = "%s -c f -n 4"%(sys.argv[1])
+cmdline  = "%s -c f -n 4"%(sys.argv[1])
 
 print cmdline
 
diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py
index 9698ddc..260b72c 100644
--- a/app/test/autotest_runner.py
+++ b/app/test/autotest_runner.py
@@ -208,23 +208,19 @@ class AutotestRunner:
 	def __get_cmdline(self, test):
 		cmdline = self.cmdline
 
-		# perform additional linuxapp adjustments
-		if not "baremetal" in self.target:
-
-			# append memory limitations for each test
-			# otherwise tests won't run in parallel
-			if not "i686" in self.target:
-				cmdline += " --socket-mem=%s"% test["Memory"]
-			else:
-				# affinitize startup so that tests don't fail on i686
-				cmdline = "taskset 1 " + cmdline
-				cmdline += " -m " + str(sum(map(int,test["Memory"].split(","))))
+		# append memory limitations for each test
+		# otherwise tests won't run in parallel
+		if not "i686" in self.target:
+			cmdline += " --socket-mem=%s"% test["Memory"]
+		else:
+			# affinitize startup so that tests don't fail on i686
+			cmdline = "taskset 1 " + cmdline
+			cmdline += " -m " + str(sum(map(int,test["Memory"].split(","))))
 
-			# set group prefix for autotest group
-			# otherwise they won't run in parallel
-			cmdline += " --file-prefix=%s"% test["Prefix"]
+		# set group prefix for autotest group
+		# otherwise they won't run in parallel
+		cmdline += " --file-prefix=%s"% test["Prefix"]
 
-			return cmdline
 		return cmdline
 
 
@@ -338,12 +334,7 @@ class AutotestRunner:
 			self.__filter_groups(self.non_parallel_test_groups)
 		
 		# create a pool of worker threads
-		if not "baremetal" in self.target:
-			pool = multiprocessing.Pool(processes=1)
-		else:
-			# we can't be sure running baremetal tests in parallel
-			# will work, so let's stay on the safe side
-			pool = multiprocessing.Pool(processes=1)
+		pool = multiprocessing.Pool(processes=1)
 			
 		results = []
 	
diff --git a/app/test/process.h b/app/test/process.h
index cb8973e..057ba9f 100644
--- a/app/test/process.h
+++ b/app/test/process.h
@@ -34,8 +34,6 @@
 #ifndef _PROCESS_H_
 #define _PROCESS_H_
 
-#ifndef RTE_EXEC_ENV_BAREMETAL
-
 #ifdef RTE_EXEC_ENV_BSDAPP
 #define self "curproc"
 #define exe "file"
@@ -102,6 +100,4 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
 	return status;
 }
 
-#endif /* not baremetal */
-
 #endif /* _PROCESS_H_ */
diff --git a/app/test/test.c b/app/test/test.c
index 9bee6bb..12345c0 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -66,7 +66,6 @@ extern cmdline_parse_ctx_t main_ctx[];
 
 const char *prgname; /* to be set to argv[0] */
 
-#ifndef RTE_EXEC_ENV_BAREMETAL
 static const char *recursive_call; /* used in linuxapp for MP and other tests */
 
 static int
@@ -110,7 +109,6 @@ do_recursive_call(void)
 	printf("ERROR - missing action to take for %s\n", recursive_call);
 	return -1;
 }
-#endif
 
 int
 main(int argc, char **argv)
@@ -135,10 +133,8 @@ main(int argc, char **argv)
 
 	prgname = argv[0];
 
-#ifndef RTE_EXEC_ENV_BAREMETAL
 	if ((recursive_call = getenv(RECURSIVE_ENV_VAR)) != NULL)
 		return do_recursive_call();
-#endif
 
 #ifdef RTE_LIBEAL_USE_HPET
 	if (rte_eal_hpet_init(1) < 0)
diff --git a/app/test/test.h b/app/test/test.h
index 98ab804..75e95d8 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -118,19 +118,12 @@ struct unit_test_suite {
 
 int unit_test_suite_runner(struct unit_test_suite *suite);
 
-/* icc on baremetal gives us troubles with function named 'main' */
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define main _main
-#endif
-
 #define RECURSIVE_ENV_VAR "RTE_TEST_RECURSIVE"
 
 extern const char *prgname;
 
 int commands_init(void);
 
-int main(int argc, char **argv);
-
 int test_pci(void);
 int test_pci_run;
 
diff --git a/app/test/test_debug.c b/app/test/test_debug.c
index 4659e46..7c3ee92 100644
--- a/app/test/test_debug.c
+++ b/app/test/test_debug.c
@@ -45,31 +45,9 @@
 /*
  * Debug test
  * ==========
- *
- * - Call rte_dump_stack() and rte_dump_registers(). The result is not checked
- *   currently, as the functions are not implemented on baremetal.
- * - Check that rte_panic() terminates the program using a non-zero error code.
- *   (Only implemented on linux, since it requires the fork() system call)
  */
 
-#ifdef RTE_EXEC_ENV_BAREMETAL
-
-/* baremetal - don't test rte_panic or rte_exit */
-static int
-test_panic(void)
-{
-	return 0;
-}
-
-static int
-test_exit(void)
-{
-	return 0;
-}
-
-#else
-
-/* linuxapp - use fork() to test rte_panic() */
+/* use fork() to test rte_panic() */
 static int
 test_panic(void)
 {
@@ -94,7 +72,7 @@ test_panic(void)
 	return 0;
 }
 
-/* linuxapp - use fork() to test rte_exit() */
+/* use fork() to test rte_exit() */
 static int
 test_exit_val(int exit_val)
 {
@@ -134,8 +112,6 @@ test_exit(void)
 	return 0;
 }
 
-#endif
-
 static void
 dummy_app_usage(const char *progname)
 {
diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
index 61fdc56..6e3dec3 100644
--- a/app/test/test_interrupts.c
+++ b/app/test/test_interrupts.c
@@ -157,7 +157,7 @@ test_interrupt_handle_compare(struct rte_intr_handle *intr_handle_l,
 }
 
 #else
-/* to be implemented for baremetal later */
+/* to be implemented for bsd later */
 static inline int
 test_interrupt_handle_sanity_check(struct rte_intr_handle *intr_handle)
 {
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 66bcbc5..2a788d1 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -677,21 +677,10 @@ test_refcnt_mbuf(void)
 	return (0);
 }
 
-#ifdef RTE_EXEC_ENV_BAREMETAL
-
-/* baremetal - don't test failing sanity checks */
-static int
-test_failing_mbuf_sanity_check(void)
-{
-	return 0;
-}
-
-#else
-
 #include <unistd.h>
 #include <sys/wait.h>
 
-/* linuxapp - use fork() to test mbuf errors panic */
+/* use fork() to test mbuf errors panic */
 static int
 verify_mbuf_check_panics(struct rte_mbuf *buf)
 {
@@ -776,7 +765,6 @@ test_failing_mbuf_sanity_check(void)
 
 	return 0;
 }
-#endif
 
 
 static int
-- 
2.0.4



More information about the dev mailing list