* [dts] [PATCH V2] kni/ethtool add judgment before the -a parameter
@ 2018-11-12 6:41 zhuwenhui
2018-11-15 19:43 ` Lijuan Tu
0 siblings, 1 reply; 2+ messages in thread
From: zhuwenhui @ 2018-11-12 6:41 UTC (permalink / raw)
To: dts; +Cc: zhuwenhui
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dts] [PATCH V2] kni/ethtool add judgment before the -a parameter
2018-11-12 6:41 [dts] [PATCH V2] kni/ethtool add judgment before the -a parameter zhuwenhui
@ 2018-11-15 19:43 ` Lijuan Tu
0 siblings, 0 replies; 2+ messages in thread
From: Lijuan Tu @ 2018-11-15 19:43 UTC (permalink / raw)
To: zhuwenhui, dts
Applied with comments changed.
On 2018年11月12日 14:41, zhuwenhui wrote:
> 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,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-15 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 6:41 [dts] [PATCH V2] kni/ethtool add judgment before the -a parameter zhuwenhui
2018-11-15 19:43 ` Lijuan Tu
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).