From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E94FEC3BA for ; Mon, 6 Jul 2015 07:04:23 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Jul 2015 22:04:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,412,1432623600"; d="scan'208";a="756631267" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 05 Jul 2015 22:04:22 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t6654K2J012726; Mon, 6 Jul 2015 13:04:20 +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 t6654IFD001479; Mon, 6 Jul 2015 13:04:20 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t6654HBD001475; Mon, 6 Jul 2015 13:04:17 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 6 Jul 2015 13:04:16 +0800 Message-Id: <1436159056-1443-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] Change output folder path and optimize virt dut 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, 06 Jul 2015 05:04:24 -0000 From: Marvin Liu Previously all output files will be saved in output folder dts.log and "suite.log". The log information will be appended in the log file. The log file will be huge and difficult to trace after running dts several times. Now log files will be saved in output/folder_name_by_time. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index b843f22..c4f4663 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -38,6 +38,7 @@ import inspect # load attribute import atexit # register callback when exit import json # json format import signal # signal module for debug mode +import time # time module for unique output folder import rst # rst file support from crbs import crbs @@ -74,6 +75,7 @@ functional_only = False nic = None requested_tests = None dut = None +duts = None tester = None result = None excel_report = None @@ -192,11 +194,15 @@ def dts_log_testsuite(test_suite, log_handler, test_classname): """ Change to SUITE self logger handler. """ + global duts test_suite.logger = getLogger(test_classname) test_suite.logger.config_suite(test_classname) log_handler.config_suite(test_classname, 'dts') dut.logger.config_suite(test_classname, 'dut') tester.logger.config_suite(test_classname, 'tester') + if duts and len(duts): + for crb in duts: + crb.logger.config_suite(test_classname, 'virtdut') try: if tester.it_uses_external_generator(): getattr(tester, 'ixia_packet_gen') @@ -212,6 +218,9 @@ def dts_log_execution(log_handler): log_handler.config_execution('dts') dut.logger.config_execution('dut') tester.logger.config_execution('tester') + if duts and len(duts): + for crb in duts: + crb.logger.config_execution('virtdut') try: if tester.it_uses_external_generator(): getattr(tester, 'ixia_packet_gen') @@ -279,8 +288,8 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario): scene = None if scene: - scene.load_config() - scene.create_scene() + scene.load_config() + scene.create_scene() for target in targets: log_handler.info("\nTARGET " + target) @@ -332,6 +341,7 @@ def dts_run_suite(crbInst, test_suites, target, nic, scene): for test_classname, test_class in get_subclasses(test_module, TestCase): if scene and scene.vm_dut_enable: + global duts duts = scene.get_vm_duts() tester.dut = duts[0] test_suite = test_class(duts[0], tester, target, test_suite) @@ -389,6 +399,9 @@ def run_all(config_file, pkgName, git, patch, skip_setup, Patches = patch # prepare the output folder + if output_dir == '': + output_dir = time.strftime("output/%Y_%m_%d_%H_%M_%S") + if not os.path.exists(output_dir): os.mkdir(output_dir) diff --git a/framework/main.py b/framework/main.py index 6b771a5..69d2318 100755 --- a/framework/main.py +++ b/framework/main.py @@ -84,7 +84,7 @@ parser.add_argument('--snapshot', help='snapshot .tgz file to use as input') parser.add_argument('--output', - default='output', + default='', help='Output directory where dts log and result saved') parser.add_argument('-s', '--skip-setup', diff --git a/framework/virt_dut.py b/framework/virt_dut.py index 2edbf6f..5e4d212 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -63,7 +63,7 @@ class VirtDut(DPDKdut): # load port config from suite cfg self.suite = suite self.logger = getLogger(self.NAME) - self.logger.config_execution('vmdut') + self.logger.config_suite(suite, 'virtdut') self.session = SSHConnection(self.vm_ip, self.NAME, self.get_password()) self.session.init_log(self.logger) -- 1.9.3