test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1] tests/dcf_lifecycle:add kernel check in test script
@ 2023-03-03 17:17 Hongbo Li
  0 siblings, 0 replies; 2+ messages in thread
From: Hongbo Li @ 2023-03-03 17:17 UTC (permalink / raw)
  To: dts; +Cc: Hongbo Li

1.Some testcase require the kernel 4.19+ in the testplan, but test script does not check the kernel. Which will cause the lower version of kernel to fail when run cases.
2.The "--color" option of dmesg command is not supported in the OS with the lower version kernel, and the option only changes the color of the output. So delete this option to make the OS with the lower version kernel support some testcase.

Signed-off-by: Hongbo Li <hongbox.li@intel.com>
---
 tests/TestSuite_dcf_lifecycle.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index cd7e1824..ef1af255 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -184,7 +184,7 @@ class TestDcfLifeCycle(TestCase):
         self.d_a_con(cmd)
 
     def get_dmesg(self):
-        cmd = "dmesg --color=never"
+        cmd = "dmesg"
         return self.d_a_con(cmd) or ""
 
     def vf_init(self):
@@ -1078,6 +1078,11 @@ class TestDcfLifeCycle(TestCase):
         self.verify_supported_nic()
         # prepare testing environment
         self.preset_test_environment()
+        kernel_version = self.dut.send_expect("uname -r", "# ")
+        try:
+            self.kernel_version = re.match("[0-9]+\.\d*", kernel_version).group(0)
+        except Exception as e:
+            self.logger.warning(e)
 
     def tear_down_all(self):
         """
@@ -1182,6 +1187,11 @@ class TestDcfLifeCycle(TestCase):
         """
         When ADQ set on PF, PF should reject the DCF mode
         """
+        if self.kernel_version:
+            self.skip_case(
+                self.kernel_version > "4.19",
+                "Host kernel version is required 4.19+",
+            )
         msg = "begin : When ADQ set on PF, PF should reject the DCF mode"
         self.logger.info(msg)
         self.verify_dcf_with_adq_01()
@@ -1190,6 +1200,11 @@ class TestDcfLifeCycle(TestCase):
         """
         When DCF mode enabled, ADQ setting on PF shall fail
         """
+        if self.kernel_version:
+            self.skip_case(
+                self.kernel_version > "4.19",
+                "Host kernel version is required 4.19+",
+            )
         msg = "begin : When DCF mode enabled, ADQ setting on PF shall fail"
         self.logger.info(msg)
         self.verify_dcf_with_adq_02()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread
* [dts][PATCH V1] tests/dcf_lifecycle: add kernel check in test script
@ 2023-02-01  8:00 Weiyuan Li
  0 siblings, 0 replies; 2+ messages in thread
From: Weiyuan Li @ 2023-02-01  8:00 UTC (permalink / raw)
  To: dts; +Cc: Weiyuan Li

Some test cases require the kernel 4.19+ in the testplan, but test script does not check the kernel. Which will cause the lower version of kernel to fail when run cases.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_dcf_lifecycle.py | 41 +++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index cd7e1824..28ee99f7 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -604,6 +604,10 @@ class TestDcfLifeCycle(TestCase):
             self.verify(expected_str in dmesg_output, msg)
 
     def verify_support_dcf_mode_03(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         except_content = None
         try:
             self.vf_set_trust(vf_id=1)
@@ -646,6 +650,10 @@ class TestDcfLifeCycle(TestCase):
             self.verify(expected_str in dmesg_output, msg)
 
     def verify_support_dcf_mode_04(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         except_content = None
         try:
             self.vf_set_trust_off()
@@ -1089,7 +1097,10 @@ class TestDcfLifeCycle(TestCase):
         """
         Run before each test case.
         """
-        pass
+        # get os kernel version
+        self.os_kernel_version = ".".join(
+            self.dut.send_expect("uname -r", "# ").split(".")[0:2]
+        )
 
     def tear_down(self):
         """
@@ -1182,6 +1193,10 @@ class TestDcfLifeCycle(TestCase):
         """
         When ADQ set on PF, PF should reject the DCF mode
         """
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : When ADQ set on PF, PF should reject the DCF mode"
         self.logger.info(msg)
         self.verify_dcf_with_adq_01()
@@ -1190,6 +1205,10 @@ class TestDcfLifeCycle(TestCase):
         """
         When DCF mode enabled, ADQ setting on PF shall fail
         """
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : When DCF mode enabled, ADQ setting on PF shall fail"
         self.logger.info(msg)
         self.verify_dcf_with_adq_02()
@@ -1215,6 +1234,10 @@ class TestDcfLifeCycle(TestCase):
         """
         When DCF mode enabled, PF can't set L2 forwarding
         """
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : When DCF mode enabled, PF can't set L2 forwarding"
         self.logger.info(msg)
         self.verify_dcf_with_l2fwd_02()
@@ -1513,6 +1536,10 @@ class TestDcfLifeCycle(TestCase):
         self.run_test_post()
 
     def test_dcf_with_acl_filter_01(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : add ACL rule by kernel, reject request for DCF functionality"
         self.logger.info(msg)
         self.vf_set_trust()
@@ -1555,6 +1582,10 @@ class TestDcfLifeCycle(TestCase):
         self.d_con(["quit", "# ", 15])
 
     def test_dcf_with_acl_filter_02(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : add ACL rule by kernel, accept request for DCF functionality of another PF"
         self.logger.info(msg)
         self.vf_set_trust()
@@ -1568,6 +1599,10 @@ class TestDcfLifeCycle(TestCase):
         self.d_con(["quit", "# ", 15])
 
     def test_dcf_with_acl_filter_03(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : ACL DCF mode is active, add ACL filters by way of host based configuration is rejected"
         self.logger.info(msg)
         self.vf_set_trust()
@@ -1579,6 +1614,10 @@ class TestDcfLifeCycle(TestCase):
         self.delete_acl_rule_by_kernel_cmd()
 
     def test_dcf_with_acl_filter_04(self):
+        self.skip_case(
+            self.os_kernel_version > "4.19",
+            "Host kernel version is required 4.19+",
+        )
         msg = "begin : ACL DCF mode is active, add ACL filters by way of host based configuration on another PF successfully"
         self.logger.info(msg)
         self.vf_set_trust()
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-03  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 17:17 [dts][PATCH V1] tests/dcf_lifecycle:add kernel check in test script Hongbo Li
  -- strict thread matches above, loose matches on Subject: below --
2023-02-01  8:00 [dts][PATCH V1] tests/dcf_lifecycle: add " Weiyuan Li

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).