test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] Change output folder path and optimize virt dut log
@ 2015-07-06  5:04 Yong Liu
  2015-07-09  7:58 ` Tang, HaifengX
  0 siblings, 1 reply; 3+ messages in thread
From: Yong Liu @ 2015-07-06  5:04 UTC (permalink / raw)
  To: dts

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

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 <yong.liu@intel.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH] Change output folder path and optimize virt dut log
  2015-07-06  5:04 [dts] [PATCH] Change output folder path and optimize virt dut log Yong Liu
@ 2015-07-09  7:58 ` Tang, HaifengX
  2015-07-09  7:59   ` Liu, Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Tang, HaifengX @ 2015-07-09  7:58 UTC (permalink / raw)
  To: Liu, Yong, dts


Hi yong:

In these patch:
     # prepare the output folder
+    if output_dir == '':
+        output_dir = time.strftime("output/%Y_%m_%d_%H_%M_%S")
+
     
In my opinion , can we remove these code?
Get the timestamp from dut or  tester to create a new folder for saving current 
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 <yong.liu@intel.com>

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 <yong.liu@intel.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH] Change output folder path and optimize virt dut log
  2015-07-09  7:58 ` Tang, HaifengX
@ 2015-07-09  7:59   ` Liu, Yong
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2015-07-09  7:59 UTC (permalink / raw)
  To: Tang, HaifengX, dts

Ok, I'll changed output folder back to default.

> -----Original Message-----
> From: Tang, HaifengX
> Sent: Thursday, July 09, 2015 3:58 PM
> To: Liu, Yong; dts@dpdk.org
> Cc: Tang, HaifengX
> Subject: RE: [dts] [PATCH] Change output folder path and optimize virt dut
> log
> 
> 
> Hi yong:
> 
> In these patch:
>      # prepare the output folder
> +    if output_dir == '':
> +        output_dir = time.strftime("output/%Y_%m_%d_%H_%M_%S")
> +
> 
> In my opinion , can we remove these code?
> Get the timestamp from dut or  tester to create a new folder for saving
> current
> 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 <yong.liu@intel.com>
> 
> 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 <yong.liu@intel.com>
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-09  8:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06  5:04 [dts] [PATCH] Change output folder path and optimize virt dut log Yong Liu
2015-07-09  7:58 ` Tang, HaifengX
2015-07-09  7:59   ` Liu, Yong

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).