[dts] [PATCH]nvgre, vxlan, multiprocess: fix get-output errors

Lijuan Tu lijuanx.a.tu at intel.com
Wed Nov 18 11:40:29 CET 2015


fix test script get the output from the pmd driver correctly if the command inputs aren't from send_expect

Signed-off-by: Lijuan Tu <lijuanx.a.tu at intel.com>
---
 tests/TestSuite_multiprocess.py | 49 +++++++++++++++++++----------------------
 tests/TestSuite_nvgre.py        |  6 +++--
 tests/TestSuite_vxlan.py        |  6 +++--
 3 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 6ed6984..7bc005d 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -80,23 +80,23 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         Basic operation.
         """
         # Send message from secondary to primary
-        self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=primary |tee out  " % self.target, "Finished Process Init", 100)
+        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=primary" % self.target, "Finished Process Init", 100)
         time.sleep(20)
-        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished Process Init", 100)
+        self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished Process Init", 100)
 
-        self.dut.send_expect("send hello_primary", ">")
-        self.dut.send_expect("quit", "# ")
-        self.dut.alt_session.send_expect("quit","# ")
-        out = self.dut.alt_session.send_expect("cat out","# ")
+        self.dut.alt_session.send_expect("send hello_primary", ">")
+        out = self.dut.get_session_output()
+        self.dut.alt_session.send_expect("quit", "# ")
+        self.dut.send_expect("quit","# ")
         self.verify("Received 'hello_primary'" in out, "Message not received on primary process")
         # Send message from primary to secondary
         self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=primary " % self.target, "Finished Process Init", 100)
         time.sleep(20)
-        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=secondary | tee out  " % self.target, "Finished Process Init", 100)
+        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished Process Init", 100)
         self.dut.alt_session.send_expect("send hello_secondary", ">")
+        out = self.dut.get_session_output()
         self.dut.alt_session.send_expect("quit", "# ")
         self.dut.send_expect("quit", "# ")
-        out = self.dut.send_expect("cat out", "# ")
 
         self.verify("Received 'hello_secondary'" in out,
                     "Message not received on primary process")
@@ -109,7 +109,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         self.dut.kill_all()
         self.dut.send_expect("fg", "# ")
 
-        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=primary > testing.txt &" % self.target, "# ", 100)
+        self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=primary" % self.target, "Finished Process Init", 100)
         time.sleep(20)
         self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished Process Init", 100)
         stringsSent = 0
@@ -122,7 +122,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
 
         time.sleep(5)
         self.dut.send_expect("quit", "# ")
-        self.dut.send_expect("fg", ">")
+        self.dut.alt_session.send_expect("quit", "# ")
 
     def test_multiprocess_simple_mpapplicationstartup(self):
         """
@@ -132,32 +132,30 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         self.dut.kill_all()
 
         # Send message from secondary to primary (auto process type)
-        self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=auto |tee out " % self.target, "Finished Process Init", 100)
+        out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=auto " % self.target, "Finished Process Init", 100)
+        self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
         time.sleep(20)
-        out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=auto" % self.target, "Finished Process Init", 100)
+        out = self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=auto" % self.target, "Finished Process Init", 100)
         self.verify("EAL: Auto-detected process type: SECONDARY" in out,
                     "The type of process (SECONDARY) was not detected properly")
 
-        self.dut.send_expect("send hello_primary", ">")
-        self.dut.send_expect("quit", "# ")
+        self.dut.alt_session.send_expect("send hello_primary", ">")
+        out = self.dut.get_session_output()
         self.dut.alt_session.send_expect("quit", "# ")
-        out = self.dut.send_expect("cat out", "# ")
-
-        self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
+        self.dut.send_expect("quit", "# ")
         self.verify("Received 'hello_primary'" in out, "Message not received on primary process")
 
         # Send message from primary to secondary (auto process type)
-        out = self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=auto |tee out_primary " % self.target, "Finished Process Init", 100)
+        out = self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 --proc-type=auto" % self.target, "Finished Process Init", 100)
+        self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
         time.sleep(20)
-        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=auto |tee out_secondary " % self.target, "Finished Process Init", 100)
+        out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C --proc-type=auto" % self.target, "Finished Process Init", 100)
+        self.verify("EAL: Auto-detected process type: SECONDARY" in out, "The type of process (SECONDARY) was not detected properly")
         self.dut.alt_session.send_expect("send hello_secondary", ">",100)
+        out = self.dut.get_session_output()
         self.dut.alt_session.send_expect("quit", "# ")
         self.dut.send_expect("quit", "# ")
-        out = self.dut.send_expect("cat out_primary", "# ")
-        self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
 
-        out = self.dut.send_expect("cat out_secondary", "# ")
-        self.verify("EAL: Auto-detected process type: SECONDARY" in out, "The type of process (SECONDARY) was not detected properly")
         self.verify("Received 'hello_secondary'" in out,
                     "Message not received on primary process")
 
@@ -167,14 +165,13 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         """
 
         self.dut.kill_all()
-        self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 -m 64 &" % self.target, "Finished Process Init", 100)
+        self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c 3 -m 64" % self.target, "Finished Process Init", 100)
         out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c C" % self.target, "# ", 100)
 
         self.verify("Is another primary process running" in out,
                     "No other primary process detected")
 
-        self.dut.send_expect("fg", " > ")
-        self.dut.send_expect("quit", "# ")
+        self.dut.alt_session.send_expect("quit", "# ")
 
     def test_perf_multiprocess_client_serverperformance(self):
         """
diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py
index 954259d..86609ab 100644
--- a/tests/TestSuite_nvgre.py
+++ b/tests/TestSuite_nvgre.py
@@ -452,9 +452,10 @@ class TestNvgre(TestCase):
         config.outer_mac_dst = self.dut_rx_port_mac
         config.create_pcap()
         # time.sleep(10)
+        self.dut.send_expect("start", "testpmd>", 10)
         config.send_pcap()
         # check whether detect nvgre type
-        out = self.dut.send_expect("start", "testpmd>", 10)
+        out = self.dut.get_session_output()
         print out
         self.verify(config.packet_type() in out, "Nvgre Packet not detected")
         out = self.dut.send_expect("show port stats all", "testpmd>", 10)
@@ -497,8 +498,9 @@ class TestNvgre(TestCase):
 
         # send nvgre packet
         config.create_pcap()
+        self.dut.send_expect("start", "testpmd>", 10)
         config.send_pcap()
-        out = self.dut.send_expect("start", "testpmd>", 10)
+        out = self.dut.get_session_output()
         print out
         queue = -1
         pattern = re.compile("- Receive queue=0x(\d)")
diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py
index 5c994c8..cefe817 100644
--- a/tests/TestSuite_vxlan.py
+++ b/tests/TestSuite_vxlan.py
@@ -391,10 +391,11 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
         # be same
         config.outer_mac_dst = self.dut_port_mac
         config.create_pcap()
+        self.dut.send_expect("start", "testpmd>", 10)
         config.send_pcap(self.tester_iface)
 
         # check whether detect vxlan type
-        out = self.dut.send_expect("start", "testpmd>", 10)
+        out = self.dut.get_session_output()
         self.verify(config.packet_type() in out, "Vxlan Packet not detected")
         out = self.dut.send_expect("stop", "testpmd>", 10)
         self.dut.send_expect("quit", "#", 10)
@@ -595,8 +596,9 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
 
         # send vxlan packet
         config.create_pcap()
+        self.dut.send_expect("start", "testpmd>", 10)
         config.send_pcap(self.tester_iface)
-        out = self.dut.send_expect("start", "testpmd>", 10)
+        out = self.dut.get_session_output()
 
         queue = -1
         pattern = re.compile("- Receive queue=0x(\d)")
-- 
1.9.1



More information about the dts mailing list