From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 00DD05A52 for ; Thu, 9 Jul 2015 10:01:02 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 09 Jul 2015 01:01:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,438,1432623600"; d="scan'208";a="743514309" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga001.fm.intel.com with ESMTP; 09 Jul 2015 01:00:53 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 9 Jul 2015 15:58:28 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.46]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.246]) with mapi id 14.03.0224.002; Thu, 9 Jul 2015 15:58:26 +0800 From: "Tang, HaifengX" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] Change output folder path and optimize virt dut log Thread-Index: AQHQt6lV4hiB/SURKEO/4E5ceJTrhZ3SyO4g Date: Thu, 9 Jul 2015 07:58:26 +0000 Message-ID: References: <1436159056-1443-1-git-send-email-yong.liu@intel.com> In-Reply-To: <1436159056-1443-1-git-send-email-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Thu, 09 Jul 2015 08:01:03 -0000 Hi yong: In these patch: # prepare the output folder + if output_dir =3D=3D '': + output_dir =3D time.strftime("output/%Y_%m_%d_%H_%M_%S") + =20 In my opinion , can we remove these code? Get the timestamp from dut or tester to create a new folder for saving cur= rent=20 Test result make a great issue for our auto-regression test. thanks -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu Sent: Monday, July 06, 2015 1:04 PM To: dts@dpdk.org Subject: [dts] [PATCH] Change output folder path and optimize virt dut log From: Marvin Liu Previously all output files will be saved in output folder dts.log and "sui= te.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 100= 644 --- 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 =20 import rst # rst file support from crbs import crbs @@ -74,6 +75,7 @@ functional_only =3D False nic =3D None requested_tests = =3D None dut =3D None +duts =3D None tester =3D None result =3D None excel_report =3D None @@ -192,11 +194,15 @@ def dts_log_testsuite(test_suite, log_handler, test_c= lassname): """ Change to SUITE self logger handler. """ + global duts test_suite.logger =3D 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 =3D None =20 if scene: - scene.load_config() - scene.create_scene() + scene.load_config() + scene.create_scene() =20 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): =20 if scene and scene.vm_dut_enable: + global duts duts =3D scene.get_vm_duts() tester.dut =3D duts[0] test_suite =3D test_class(duts[0], tester, target, tes= t_suite) @@ -389,6 +399,9 @@ def run_all(config_file, pkgName, git, patch, = skip_setup, Patches =3D patch =20 # prepare the output folder + if output_dir =3D=3D '': + output_dir =3D time.strftime("output/%Y_%m_%d_%H_%M_%S") + if not os.path.exists(output_dir): os.mkdir(output_dir) =20 diff --git a/framework/main.py b/framework/main.py index 6b771a5..69d2318 1= 00755 --- a/framework/main.py +++ b/framework/main.py @@ -84,7 +84,7 @@ parser.add_argument('--snapshot', help=3D'snapshot .tgz file to use as input') =20 parser.add_argument('--output', - default=3D'output', + default=3D'', help=3D'Output directory where dts log and result save= d') =20 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 =3D suite self.logger =3D getLogger(self.NAME) - self.logger.config_execution('vmdut') + self.logger.config_suite(suite, 'virtdut') self.session =3D SSHConnection(self.vm_ip, self.NAME, self.get_password()) self.session.init_log(self.logger) -- 1.9.3