[RFC,v1,10/10] dts: add hello world testsuite
Checks
Commit Message
The testsuite implements the testcases defined in the corresponding test
plan.
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
dts/tests/TestSuite_hello_world.py | 80 ++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100644 dts/tests/TestSuite_hello_world.py
new file mode 100644
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+#
+
+"""
+DPDK Test suite.
+Test HelloWorld example.
+"""
+
+import os.path
+from framework.test_case import TestCase
+
+
+class TestHelloWorld(TestCase):
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ hello_world Prerequisites:
+ helloworld build pass
+ """
+ out = self.sut_node.build_dpdk_apps("examples/helloworld")
+ self.app_helloworld_path = os.path.join(self.target, "examples", "dpdk-helloworld")
+
+ self.verify("Error" not in out, "compilation error 1")
+ self.verify("No such file" not in out, "compilation error 2")
+
+ def set_up(self):
+ """
+ Run before each test case.
+ Nothing to do.
+ """
+ pass
+
+ def test_hello_world_single_core(self):
+ """
+ Run hello world on single lcores
+ Only received hello message from core0
+ """
+
+ # get the mask for the first core
+ cores = self.sut_node.get_core_list("1S/1C/1T")
+ eal_para = self.sut_node.create_eal_parameters(cores="1S/1C/1T")
+ cmdline = "./%s %s" % (self.app_helloworld_path, eal_para)
+ out = self.sut_node.send_expect(cmdline, "# ", 30)
+ self.verify(
+ "hello from core %s" % cores[0] in out,
+ "EAL not started on core%s" % cores[0],
+ )
+
+ def test_hello_world_all_cores(self):
+ """
+ Run hello world on all lcores
+ Received hello message from all lcores
+ """
+
+ # get the maximum logical core number
+ cores = self.sut_node.get_core_list("all")
+ eal_para = self.sut_node.create_eal_parameters(cores=cores)
+
+ cmdline = "./%s %s " % (self.app_helloworld_path, eal_para)
+ out = self.sut_node.send_expect(cmdline, "# ", 50)
+ for core in cores:
+ self.verify(
+ "hello from core %s" % core in out,
+ "EAL not started on core%s" % core,
+ )
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ Nothing to do.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ Nothing to do.
+ """
+ pass