[dts] [PATCH V2] kni/ethtool add judgment before the -a parameter

zhuwenhui wenhuix.zhu at intel.com
Mon Nov 12 07:41:27 CET 2018


According to whether the kernel supports 
"ETHTOOL_GLINKSETTINGS & ETHTOOL_SLINKSETTINGS", it is judged
 whether "ethtool "-a|--show-pause" works normally.

Signed-off-by: zhuwenhui <wenhuix.zhu at intel.com>
---
 tests/TestSuite_kni.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py
index 23d6d04..91408e4 100644
--- a/tests/TestSuite_kni.py
+++ b/tests/TestSuite_kni.py
@@ -675,14 +675,19 @@ class TestKni(TestCase):
                         "'ethtool -i' not supported")
             self.verify("Operation not supported" not in out,
                         "'ethtool -i' not supported")
-
+            
             # Request pause parameters
-            out = self.dut.send_expect("ethtool -a %s" % virtual_interface,
-                                       "# ")
-            self.verify("Pause parameters for %s" % virtual_interface in out,
-                        "'ethtool -a' not supported")
-            self.verify("Operation not supported" not in out,
-                        "ethtool '-a' not supported")
+            with open("/usr/include/linux/ethtool.h","r") as ethtool_h:
+                ethtool_contents = ethtool_h.read()
+                GSET = "ETHTOOL_GLINKSETTINGS"
+                SSET = "ETHTOOL_SLINKSETTINGS"
+                if (GSET in ethtool_contents) and (SSET in ethtool_contents):
+                    out = self.dut.send_expect("ethtool -a %s" % virtual_interface,
+                                               "# ")
+                    self.verify("Pause parameters for %s" % virtual_interface in out,
+                                "'ethtool -a' not supported")
+                    self.verify("Operation not supported" not in out,
+                                "ethtool '-a' not supported")
 
             # Request statistics
             out = self.dut.send_expect("ethtool -S %s" % virtual_interface,
-- 
2.17.2



More information about the dts mailing list