[dts] [PATCH V1] tests/link_flowctrl: fix syntax error
Tu, Lijuan
lijuan.tu at intel.com
Wed Apr 3 18:23:37 CEST 2019
The function has 3 return value, if you just want the first value, it's more readable:
Result, _, _ = self.tester.traffic_generator_loss(tgenInput, 100)
Only 1 change could solve your problem, it's a more easy way.
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of zhaomeijuan
> Sent: Monday, March 25, 2019 8:43 AM
> To: dts at dpdk.org
> Cc: Zhao, MeijuanX <meijuanx.zhao at intel.com>
> Subject: [dts] [PATCH V1] tests/link_flowctrl: fix syntax error
>
> From: "meijuanx.zhao" <meijuanx.zhao at intel.com>
>
> Signed-off-by: meijuanx.zhao <meijuanx.zhao at intel.com>
> ---
> tests/TestSuite_link_flowctrl.py | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py
> index 0057b46..83fd724 100644
> --- a/tests/TestSuite_link_flowctrl.py
> +++ b/tests/TestSuite_link_flowctrl.py
> @@ -339,9 +339,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='on',
> pause_frame_fwd='on')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result <= 0.01,
> + self.verify(result[0] <= 0.01,
> "Link flow control fail, the loss percent is more than 1%")
>
> def test_perf_flowctrl_on_pause_fwd_off(self):
> @@ -353,9 +353,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='on',
> pause_frame_fwd='off')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result <= 0.01,
> + self.verify(result[0] <= 0.01,
> "Link flow control fail, the loss percent is more than 1%")
>
> def test_perf_flowctrl_rx_on(self):
> @@ -367,9 +367,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='on',
> pause_frame_fwd='off')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result <= 0.01,
> + self.verify(result[0] <= 0.01,
> "Link flow control fail, the loss percent is more than 1%")
>
> def test_perf_flowctrl_off_pause_fwd_on(self):
> @@ -381,9 +381,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='off',
> pause_frame_fwd='on')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result >= 0.5,
> + self.verify(result[0] >= 0.5,
> "Link flow control fail, the loss percent is less than 50%")
>
> def test_perf_flowctrl_off_pause_fwd_off(self):
> @@ -395,9 +395,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='off',
> pause_frame_fwd='off')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result >= 0.5,
> + self.verify(result[0] >= 0.5,
> "Link flow control fail, the loss percent is less than 50%")
>
> def test_perf_flowctrl_tx_on(self):
> @@ -409,9 +409,9 @@ class TestLinkFlowctrl(TestCase):
> tx_flow_control='on',
> pause_frame_fwd='off')
>
> - print "Packet loss: %.3f%%" % result
> + print "Packet loss: %.3f%%" % result[0]
>
> - self.verify(result <= 0.01,
> + self.verify(result[0] <= 0.01,
> "Link flow control fail, the loss percent is more than 1%")
>
> def tear_down_all(self):
> --
> 2.17.1
More information about the dts
mailing list