From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 21EDD5A35 for ; Wed, 25 Nov 2015 09:56:08 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 25 Nov 2015 00:56:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,342,1444719600"; d="scan'208";a="859347950" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.238.55.64]) by fmsmga002.fm.intel.com with ESMTP; 25 Nov 2015 00:55:45 -0800 From: Lijuan Tu To: dts@dpdk.org Date: Wed, 25 Nov 2015 16:51:16 +0800 Message-Id: <1448441476-4352-1-git-send-email-lijuanx.a.tu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH]tests multiprocess: fix commands send to wrong session X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 08:56:09 -0000 if alt_session is running app simple_mp kill_all send shell-cmd to alt_session so exception happened Signed-off-by: Lijuan Tu --- 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