test suite reviews and discussions
 help / color / mirror / Atom feed
From: zhuwenhui <wenhuix.zhu@intel.com>
To: dts@dpdk.org
Cc: zhuwenhui <wenhuix.zhu@intel.com>
Subject: [dts] [PATCH V2] kni/ethtool add judgment before the -a parameter
Date: Mon, 12 Nov 2018 14:41:27 +0800	[thread overview]
Message-ID: <1542004887-38119-1-git-send-email-wenhuix.zhu@intel.com> (raw)

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@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

             reply	other threads:[~2018-11-12  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  6:41 zhuwenhui [this message]
2018-11-15 19:43 ` Lijuan Tu

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=1542004887-38119-1-git-send-email-wenhuix.zhu@intel.com \
    --to=wenhuix.zhu@intel.com \
    --cc=dts@dpdk.org \
    /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).