From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id AE27A5A44 for ; Mon, 13 Jul 2015 11:08:03 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 13 Jul 2015 02:08:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,461,1432623600"; d="scan'208";a="761339084" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 13 Jul 2015 02:08:01 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t6D97xdo012002; Mon, 13 Jul 2015 17:07:59 +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 t6D97vG7008149; Mon, 13 Jul 2015 17:07:59 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t6D97v7s008145; Mon, 13 Jul 2015 17:07:57 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 13 Jul 2015 17:07:56 +0800 Message-Id: <1436778476-8113-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] fix bug that virtualization log not save in SUITE.log 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: Mon, 13 Jul 2015 09:08:04 -0000 From: Marvin Liu 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 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