test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH]tests multiprocess: fix commands send to wrong session
@ 2015-11-25  8:51 Lijuan Tu
  2015-11-25 10:41 ` Xu, HuilongX
  0 siblings, 1 reply; 3+ messages in thread
From: Lijuan Tu @ 2015-11-25  8:51 UTC (permalink / raw)
  To: dts

if alt_session is running app simple_mp
kill_all send shell-cmd to alt_session
so exception happened

Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
 tests/TestSuite_multiprocess.py | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 7bc005d..7cce1f4 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -73,17 +73,33 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         """
         Run before each test case.
         """
-        pass
+        self.kill_mp()
+
+    def kill_mp(self):
+        """
+        Kill all simple_mp applications
+        """
+        self.alt_session = False
+        try:
+            out = self.dut.send_expect("ps -a |grep simple_mp |awk '{print $1}'", "# ")
+        except:
+            self.alt_session = True
+            out = self.dut.alt_session.send_expect("ps -a |grep simple_mp |awk '{print $1}'", "# ")
+        if len(out):
+            pids = out.split('\r\n')
+            for pid in pids:
+                self.dut.send_expect('kill -9 %s' % pid, '# ', alt_session=self.alt_session )
+                self.dut.get_session_output(timeout=2)
 
     def test_multiprocess_simple_mpbasicoperation(self):
         """
         Basic operation.
         """
+
         # Send message from secondary to primary
         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.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.alt_session.send_expect("send hello_primary", ">")
         out = self.dut.get_session_output()
         self.dut.alt_session.send_expect("quit", "# ")
@@ -106,9 +122,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         Load test of Simple MP application.
         """
 
-        self.dut.kill_all()
-        self.dut.send_expect("fg", "# ")
-
         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)
@@ -129,8 +142,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         Test use of Auto for Application Startup.
         """
 
-        self.dut.kill_all()
-
         # Send message from secondary to primary (auto process type)
         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")
@@ -163,8 +174,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         """
         Multiple processes without "--proc-type" flag.
         """
-
-        self.dut.kill_all()
         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)
 
@@ -257,6 +266,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         """
         Run after each test suite.
         """
-        self.dut.kill_all()
+        self.kill_mp()
 
         pass
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH]tests multiprocess: fix commands send to wrong session
  2015-11-25  8:51 [dts] [PATCH]tests multiprocess: fix commands send to wrong session Lijuan Tu
@ 2015-11-25 10:41 ` Xu, HuilongX
  2015-11-26  0:18   ` Tu, LijuanX A
  0 siblings, 1 reply; 3+ messages in thread
From: Xu, HuilongX @ 2015-11-25 10:41 UTC (permalink / raw)
  To: Tu, LijuanX A, dts

Hi lijuan,
Could you used kill_all function for kill dpdk app process,
It in crb.py, you can check this function.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Lijuan Tu
> Sent: Wednesday, November 25, 2015 4:51 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH]tests multiprocess: fix commands send to wrong
> session
> 
> if alt_session is running app simple_mp
> kill_all send shell-cmd to alt_session
> so exception happened
> 
> Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
> ---
>  tests/TestSuite_multiprocess.py | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/TestSuite_multiprocess.py
> b/tests/TestSuite_multiprocess.py
> index 7bc005d..7cce1f4 100644
> --- a/tests/TestSuite_multiprocess.py
> +++ b/tests/TestSuite_multiprocess.py
> @@ -73,17 +73,33 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Run before each test case.
>          """
> -        pass
> +        self.kill_mp()
> +
> +    def kill_mp(self):
> +        """
> +        Kill all simple_mp applications
> +        """
> +        self.alt_session = False
> +        try:
> +            out = self.dut.send_expect("ps -a |grep simple_mp |awk
> '{print $1}'", "# ")
> +        except:
> +            self.alt_session = True
> +            out = self.dut.alt_session.send_expect("ps -a |grep simple_mp
> |awk '{print $1}'", "# ")
> +        if len(out):
> +            pids = out.split('\r\n')
> +            for pid in pids:
> +                self.dut.send_expect('kill -9 %s' % pid, '# ',
> alt_session=self.alt_session )
> +                self.dut.get_session_output(timeout=2)
> 
>      def test_multiprocess_simple_mpbasicoperation(self):
>          """
>          Basic operation.
>          """
> +
>          # Send message from secondary to primary
> 
> self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simp
> le_mp -n 1 -c 3 --proc-type=primary" % self.target, "Finished Process
> Init", 100)
>          time.sleep(20)
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simpl
> e_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_primary", ">")
>          out = self.dut.get_session_output()
>          self.dut.alt_session.send_expect("quit", "# ")
> @@ -106,9 +122,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          Load test of Simple MP application.
>          """
> 
> -        self.dut.kill_all()
> -        self.dut.send_expect("fg", "# ")
> -
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simpl
> e_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/simp
> le_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished Process
> Init", 100)
> @@ -129,8 +142,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          Test use of Auto for Application Startup.
>          """
> 
> -        self.dut.kill_all()
> -
>          # Send message from secondary to primary (auto process type)
>          out =
> self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simp
> le_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")
> @@ -163,8 +174,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Multiple processes without "--proc-type" flag.
>          """
> -
> -        self.dut.kill_all()
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/simpl
> e_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/simp
> le_mp -n 1 -c C" % self.target, "# ", 100)
> 
> @@ -257,6 +266,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Run after each test suite.
>          """
> -        self.dut.kill_all()
> +        self.kill_mp()
> 
>          pass
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH]tests multiprocess: fix commands send to wrong session
  2015-11-25 10:41 ` Xu, HuilongX
@ 2015-11-26  0:18   ` Tu, LijuanX A
  0 siblings, 0 replies; 3+ messages in thread
From: Tu, LijuanX A @ 2015-11-26  0:18 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Hi ,huilong
	This bug  happened by  using kill_all .
In the case ,we using alt_session run simple_mp primary , 
kill_all send shell-cmd "kill" also using alt_session,
so the "kill" was send to dpdk app " simple_mp " .

some related log like this:

ERROR: lsof -Fp /var/run/.rte_config
Command not found
simple_mp >
---snip---
buffer (last 100 chars): '-Fp /var/run/.rte_config\r\r\nCommand not found\r\n\r\nsimple_mp > exit\r\r\nCommand not found\r\n\r\nsimple_mp > '

-----Original Message-----
From: Xu, HuilongX 
Sent: Wednesday, November 25, 2015 6:41 PM
To: Tu, LijuanX A; dts@dpdk.org
Subject: RE: [dts] [PATCH]tests multiprocess: fix commands send to wrong session

Hi lijuan,
Could you used kill_all function for kill dpdk app process, It in crb.py, you can check this function.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Lijuan Tu
> Sent: Wednesday, November 25, 2015 4:51 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH]tests multiprocess: fix commands send to wrong 
> session
> 
> if alt_session is running app simple_mp kill_all send shell-cmd to 
> alt_session so exception happened
> 
> Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
> ---
>  tests/TestSuite_multiprocess.py | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/TestSuite_multiprocess.py 
> b/tests/TestSuite_multiprocess.py index 7bc005d..7cce1f4 100644
> --- a/tests/TestSuite_multiprocess.py
> +++ b/tests/TestSuite_multiprocess.py
> @@ -73,17 +73,33 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Run before each test case.
>          """
> -        pass
> +        self.kill_mp()
> +
> +    def kill_mp(self):
> +        """
> +        Kill all simple_mp applications
> +        """
> +        self.alt_session = False
> +        try:
> +            out = self.dut.send_expect("ps -a |grep simple_mp |awk
> '{print $1}'", "# ")
> +        except:
> +            self.alt_session = True
> +            out = self.dut.alt_session.send_expect("ps -a |grep 
> + simple_mp
> |awk '{print $1}'", "# ")
> +        if len(out):
> +            pids = out.split('\r\n')
> +            for pid in pids:
> +                self.dut.send_expect('kill -9 %s' % pid, '# ',
> alt_session=self.alt_session )
> +                self.dut.get_session_output(timeout=2)
> 
>      def test_multiprocess_simple_mpbasicoperation(self):
>          """
>          Basic operation.
>          """
> +
>          # Send message from secondary to primary
> 
> self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/
> simp le_mp -n 1 -c 3 --proc-type=primary" % self.target, "Finished 
> Process Init", 100)
>          time.sleep(20)
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/s
> impl e_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_primary", ">")
>          out = self.dut.get_session_output()
>          self.dut.alt_session.send_expect("quit", "# ") @@ -106,9 
> +122,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          Load test of Simple MP application.
>          """
> 
> -        self.dut.kill_all()
> -        self.dut.send_expect("fg", "# ")
> -
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/s
> impl e_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/
> simp le_mp -n 1 -c C --proc-type=secondary" % self.target, "Finished 
> Process Init", 100) @@ -129,8 +142,6 @@ class 
> TestMultiprocess(TestCase, IxiaPacketGenerator):
>          Test use of Auto for Application Startup.
>          """
> 
> -        self.dut.kill_all()
> -
>          # Send message from secondary to primary (auto process type)
>          out =
> self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/
> simp le_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") @@ 
> -163,8 +174,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Multiple processes without "--proc-type" flag.
>          """
> -
> -        self.dut.kill_all()
> 
> self.dut.alt_session.send_expect("./examples/multi_process/simple_mp/s
> impl e_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/
> simp le_mp -n 1 -c C" % self.target, "# ", 100)
> 
> @@ -257,6 +266,6 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          """
>          Run after each test suite.
>          """
> -        self.dut.kill_all()
> +        self.kill_mp()
> 
>          pass
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-26  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25  8:51 [dts] [PATCH]tests multiprocess: fix commands send to wrong session Lijuan Tu
2015-11-25 10:41 ` Xu, HuilongX
2015-11-26  0:18   ` Tu, LijuanX A

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).