test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yu Jiang <yux.jiang@intel.com>
To: lijuan.tu@intel.com, dts@dpdk.org
Cc: Yu Jiang <yux.jiang@intel.com>
Subject: [dts][PATCH V1] tests/meson_tests: split test_args in conf/meson_tests.cfg and add -a param and save meson test log
Date: Wed, 17 May 2023 17:33:33 +0800	[thread overview]
Message-ID: <20230517093333.1964305-1-yux.jiang@intel.com> (raw)

1, add "-a" param to avoid conflict when running in container.
2, save detailed /root/dpdk/<<build path>>/meson-logs/testlog.txt to dts/output.

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 conf/meson_tests.cfg           |  3 +-
 tests/TestSuite_meson_tests.py | 50 ++++++++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/conf/meson_tests.cfg b/conf/meson_tests.cfg
index 5fefed5a..d6cb8359 100644
--- a/conf/meson_tests.cfg
+++ b/conf/meson_tests.cfg
@@ -38,4 +38,5 @@ driver-tests = ""
 debug-tests = ""
 extra-tests = ""
 perf-tests = ""
-param = "-t 24 --test-args '-c 0xff' --num-processes 20 "
+test_args = "-c 0xff"
+other_param = "-t 24 --num-processes 20 "
diff --git a/tests/TestSuite_meson_tests.py b/tests/TestSuite_meson_tests.py
index a0bba9b0..efeddb22 100644
--- a/tests/TestSuite_meson_tests.py
+++ b/tests/TestSuite_meson_tests.py
@@ -28,6 +28,7 @@ class TestMesonTests(TestCase):
         # -t 2
         self.ratio = 6
         self.dut_pathlog = "fast-test.log"
+        self.testlog = ""
         self.execute_wait_time = self.ratio * self.timeout * 10
         # skip scope
         self.SKIP_SCOPE = ""
@@ -35,6 +36,10 @@ class TestMesonTests(TestCase):
         self.base_output = os.path.join(
             os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "output"
         )
+        self.dutPorts = self.dut.get_ports()
+        self.dutPorts_PCI = []
+        for port in self.dutPorts:
+            self.dutPorts_PCI.append(self.dut.get_port_pci(self.dutPorts[port]))
 
     def set_up(self):
         """
@@ -99,17 +104,28 @@ class TestMesonTests(TestCase):
             self.verify(False, f"Test failed. {sub_fail}{sub_timeout}")
 
     def meson_param(self, case_name):
+        # add -a param when running in container
+        test_args = self.get_suite_cfg().get("test_args", "")
+        if self.dutPorts_PCI:
+            for pci in self.dutPorts_PCI:
+                test_args += " -a " + pci
         return (
             self.get_suite_cfg().get(case_name, "")
             + " "
-            + self.get_suite_cfg().get("param", "")
+            + self.get_suite_cfg().get("other_param", "")
+            + " --test-args '{}'".format(test_args)
         )
 
-    def copy_file_from_dut(self):
+    def copy_file_from_dut(self, case_name):
         if os.path.exists(os.path.join(self.base_output, self.dut_pathlog)):
             os.remove(os.path.join(self.base_output, self.dut_pathlog))
         src_pathlog = f"/tmp/{self.dut_pathlog}"
         self.dut.session.copy_file_from(src_pathlog, self.base_output)
+        if self.testlog:
+            tester_pathlog = (
+                self.base_output + "/" + "{}_mesontest.log".format(case_name)
+            )
+            self.dut.session.copy_file_from(self.testlog, tester_pathlog)
 
     def insmod_kni(self):
         out = self.dut.send_expect("lsmod | grep rte_kni", "# ")
@@ -142,8 +158,10 @@ class TestMesonTests(TestCase):
         # config test case list in conf/meson_tests.cfg
         cmds = f"meson test -C {self.target} --suite DPDK:fast-tests {param} |tee /tmp/{self.dut_pathlog}"
         out = self.dut.send_expect(cmds, "# ", self.execute_wait_time)
-        self.logger.info(out)
-        self.copy_file_from_dut()
+        # Full log written to /root/dpdk/<<build path>>/meson-logs/testlog.txt
+        self.testlog = re.search(r"Full log written to (\S+)", out).groups()[0]
+        self.logger.info(self.testlog)
+        self.copy_file_from_dut("fast-tests")
         self.check_meson_test_result()
 
     def test_driver(self):
@@ -153,8 +171,10 @@ class TestMesonTests(TestCase):
         self.delete_exists_files()
         cmds = f"meson test -C {self.target} --suite DPDK:driver-tests {param} |tee /tmp/{self.dut_pathlog}"
         out = self.dut.send_expect(cmds, "# ", self.execute_wait_time)
-        self.logger.info(out)
-        self.copy_file_from_dut()
+        # Full log written to /root/dpdk/<<build path>>/meson-logs/testlog.txt
+        self.testlog = re.search(r"Full log written to (\S+)", out).groups()[0]
+        self.logger.info(self.testlog)
+        self.copy_file_from_dut("driver-tests")
         self.check_meson_test_result()
 
     def test_debug(self):
@@ -164,8 +184,10 @@ class TestMesonTests(TestCase):
         self.delete_exists_files()
         cmds = f"meson test -C {self.target} --suite DPDK:debug-tests {param} |tee /tmp/{self.dut_pathlog}"
         out = self.dut.send_expect(cmds, "# ", self.execute_wait_time)
-        self.logger.info(out)
-        self.copy_file_from_dut()
+        # Full log written to /root/dpdk/<<build path>>/meson-logs/testlog.txt
+        self.testlog = re.search(r"Full log written to (\S+)", out).groups()[0]
+        self.logger.info(self.testlog)
+        self.copy_file_from_dut("debug-tests")
         self.check_meson_test_result()
 
     def test_extra(self):
@@ -175,8 +197,10 @@ class TestMesonTests(TestCase):
         self.delete_exists_files()
         cmds = f"meson test -C {self.target} --suite DPDK:extra-tests {param} |tee /tmp/{self.dut_pathlog}"
         out = self.dut.send_expect(cmds, "# ", self.execute_wait_time)
-        self.logger.info(out)
-        self.copy_file_from_dut()
+        # Full log written to /root/dpdk/<<build path>>/meson-logs/testlog.txt
+        self.testlog = re.search(r"Full log written to (\S+)", out).groups()[0]
+        self.logger.info(self.testlog)
+        self.copy_file_from_dut("extra-tests")
         self.check_meson_test_result()
         self.logger.warning(
             "Extra-tests are know issues which are recorded in DPDK commit and meson.build (detail see test plan)"
@@ -190,8 +214,10 @@ class TestMesonTests(TestCase):
         self.delete_exists_files()
         cmds = f"meson test -C {self.target} --suite DPDK:perf-tests {param} |tee /tmp/{self.dut_pathlog}"
         out = self.dut.send_expect(cmds, "# ", self.execute_wait_time)
-        self.logger.info(out)
-        self.copy_file_from_dut()
+        # Full log written to /root/dpdk/<<build path>>/meson-logs/testlog.txt
+        self.testlog = re.search(r"Full log written to (\S+)", out).groups()[0]
+        self.logger.info(self.testlog)
+        self.copy_file_from_dut("perf-tests")
         self.check_meson_test_result()
 
     def tear_down(self):
-- 
2.25.1


                 reply	other threads:[~2023-05-17  9:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517093333.1964305-1-yux.jiang@intel.com \
    --to=yux.jiang@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).