From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2675611A2 for ; Tue, 14 Jul 2015 07:04:16 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 13 Jul 2015 22:04:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,469,1432623600"; d="scan'208";a="523841636" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jul 2015 22:04:15 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t6E54EP7018749; Tue, 14 Jul 2015 13:04:14 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t6E54Bvw012856; Tue, 14 Jul 2015 13:04:13 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t6E54Bo6012852; Tue, 14 Jul 2015 13:04:11 +0800 From: Yong Liu To: dts@dpdk.org Date: Tue, 14 Jul 2015 13:04:10 +0800 Message-Id: <1436850250-12820-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] Optimize execution exit function 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: Tue, 14 Jul 2015 05:04:17 -0000 From: Marvin Liu After execution done, dut crb will close all sessions. Restore ipv6 on tester interface. Logger handler will be exited. Tester crb will close all sessions. Logger handler will also be exited. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index 212f336..40a3c42 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -260,8 +260,8 @@ def dts_crbs_exit(): """ Remove logger handler when exit. """ - dut.logger.logger_exit() - tester.logger.logger_exit() + dut.crb_exit() + tester.crb_exit() def dts_run_prerequisties(pkgName, patch): @@ -324,9 +324,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario): scene = None dut.restore_interfaces() - dut.close() tester.restore_interfaces() - tester.close() def dts_run_suite(crbInst, test_suites, target, nic, scene): diff --git a/framework/dut.py b/framework/dut.py index d587834..2f33a51 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -864,7 +864,19 @@ class Dut(Crb): """ Close ssh session of DUT. """ - self.session.close() - self.alt_session.close() + if self.session: + self.session.close() + self.session = None + if self.alt_session: + self.alt_session.close() + self.alt_session = None if self.host_init_flag: self.host_session.close() + + def crb_exit(self): + """ + Recover all resource before crb exit + """ + self.logger.logger_exit() + self.enable_tester_ipv6() + self.close() diff --git a/framework/tester.py b/framework/tester.py index 35581c8..de0bc24 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -467,6 +467,18 @@ class Tester(Crb): """ Close ssh session and IXIA tcl session. """ - super(Tester, self).close() + if self.session: + self.session.close() + self.session = None + if self.alt_session: + self.alt_session.close() + self.alt_session = None if self.it_uses_external_generator(): self.ixia_packet_gen.close() + + def crb_exit(self): + """ + Close all resource before crb exit + """ + self.logger.logger_exit() + self.close() -- 1.9.3