test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] Optimize execution exit function
Date: Tue, 14 Jul 2015 13:04:10 +0800	[thread overview]
Message-ID: <1436850250-12820-1-git-send-email-yong.liu@intel.com> (raw)

From: Marvin Liu <yong.liu@intel.com>

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 <yong.liu@intel.com>

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

                 reply	other threads:[~2015-07-14  5:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436850250-12820-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).