* [dts] [PATCH] fix bug that virtualization log not save in SUITE.log
@ 2015-07-13 9:07 Yong Liu
0 siblings, 0 replies; only message in thread
From: Yong Liu @ 2015-07-13 9:07 UTC (permalink / raw)
To: dts
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-13 9:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-13 9:07 [dts] [PATCH] fix bug that virtualization log not save in SUITE.log Yong Liu
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).