test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] fix bug that virtualization log not save in SUITE.log
Date: Mon, 13 Jul 2015 17:07:56 +0800	[thread overview]
Message-ID: <1436778476-8113-1-git-send-email-yong.liu@intel.com> (raw)

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

Logger default stream file will be dts.log. After called config_suite or
config_execute functions, log file will be alternated between SUITE.log and
dts.log.

Remove useless function call from session module and add init_log function in
virt_dut module.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index 6d8b950..212f336 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -199,6 +199,7 @@ def dts_log_testsuite(test_suite, log_handler, test_classname):
     test_suite.logger.config_suite(test_classname)
     log_handler.config_suite(test_classname, 'dts')
     dut.logger.config_suite(test_classname, 'dut')
+    dut.test_classname = test_classname
     tester.logger.config_suite(test_classname, 'tester')
     if duts and len(duts):
         for crb in duts:
@@ -241,6 +242,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic, virtt
 
     dut = get_project_obj(project, Dut, crbInst, serializer)
     tester = get_project_obj(project, Tester, crbInst, serializer)
+    dts_log_execution(log_handler)
     dut.tester = tester
     tester.dut = dut
     dut.set_virttype(virttype)
diff --git a/framework/logger.py b/framework/logger.py
index 03057b8..ab55493 100644
--- a/framework/logger.py
+++ b/framework/logger.py
@@ -217,6 +217,11 @@ class DTSLOG(BaseLoggerAdapter):
         self.fh = None
         self.ch = None
 
+        # add default log file
+        fh = logging.FileHandler(self.log_path + "/" + self.dts_log)
+        ch = ColorHandler()
+        self.__log_hander(fh, ch)
+
     def __log_hander(self, fh, ch):
         """
         Config stream handler and file handler.
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index 7286b14..3ee9665 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -53,7 +53,6 @@ class SSHConnection(object):
 
     def init_log(self, logger):
         self.logger = logger
-        self.logger.config_execution(self.name)
         self.session.init_log(logger, self.name)
 
     def send_expect(self, cmds, expected, timeout=15, verify=False):
diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index 879b9de..2951cf3 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -42,7 +42,6 @@ class SSHPexpect(object):
 
     def init_log(self, logger, name):
         self.logger = logger
-        self.logger.config_execution(name)
         self.logger.info("ssh %s@%s" % (self.username, self.host))
 
     def send_expect_base(self, command, expected, timeout):
diff --git a/framework/virt_base.py b/framework/virt_base.py
index 410bf28..8404ff8 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -325,6 +325,7 @@ class VirtBase(object):
         vm_dut.tester = self.host_dut.tester
         vm_dut.host_dut = self.host_dut
         vm_dut.host_session = self.host_session
+        vm_dut.init_log()
 
         read_cache = False
         skip_setup = self.host_dut.skip_setup
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index aa28f8b..123c42b 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -63,7 +63,6 @@ class VirtDut(DPDKdut):
         # load port config from suite cfg
         self.suite = suite
         self.logger = getLogger(self.NAME)
-        self.logger.config_suite(suite, 'virtdut')
         self.session = SSHConnection(self.vm_ip, self.NAME,
                                      self.get_password())
         self.session.init_log(self.logger)
@@ -81,6 +80,9 @@ class VirtDut(DPDKdut):
         self.ports_map = []
         self.virttype = virttype
 
+    def init_log(self):
+        self.logger.config_suite(self.host_dut.test_classname, 'virtdut')
+
     def close_sessions(self):
         if self.session:
             self.session.close()
-- 
1.9.3

                 reply	other threads:[~2015-07-13  9:08 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=1436778476-8113-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).