test suite reviews and discussions
 help / color / mirror / Atom feed
From: Rami Rosen <ramirose@gmail.com>
To: dts@dpdk.org
Cc: Rami Rosen <ramirose@gmail.com>
Subject: [dts] [PATCH 1/1] framework: add a new subtitle paramater
Date: Fri,  3 May 2019 15:13:10 +0300	[thread overview]
Message-ID: <1556885590-33513-1-git-send-email-ramirose@gmail.com> (raw)

Add a new subtitle paramater to main. There are use cases when we want 
to add specific details to the rst report, for example, FW version, 
name of the relevant project, setup details, etc. This patch provides this 
ability. With this patch, you can run, for exampe:

./dts -s --config-file=execution.cfg --subtitle=FW_1.8.0

to add FW_1.8.0 in the rst report. 

Signed-off-by: Rami Rosen <ramirose@gmail.com>
---
 framework/dts.py       | 11 ++++++-----
 framework/main.py      |  5 ++++-
 framework/rst.py       |  5 +++++
 framework/test_case.py |  8 ++++++++
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/framework/dts.py b/framework/dts.py
index 19a473d..c622e19 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -351,7 +351,7 @@ def dts_run_prerequisties(duts, tester, pkgName, patch, dts_commands, serializer
         return False
 
 
-def dts_run_target(duts, tester, targets, test_suites):
+def dts_run_target(duts, tester, targets, test_suites, subtitle):
     """
     Run each target in execution targets.
     """
@@ -378,7 +378,7 @@ def dts_run_target(duts, tester, targets, test_suites):
             result.add_failed_target(result.dut, target, str(ex))
             continue
 
-        dts_run_suite(duts, tester, test_suites, target)
+        dts_run_suite(duts, tester, test_suites, target, subtitle)
 
     tester.restore_interfaces()
 
@@ -388,7 +388,7 @@ def dts_run_target(duts, tester, targets, test_suites):
         dutobj.restore_modules()
 
 
-def dts_run_suite(duts, tester, test_suites, target):
+def dts_run_suite(duts, tester, test_suites, target, subtitle):
     """
     Run each suite in test suite list.
     """
@@ -402,6 +402,7 @@ def dts_run_suite(duts, tester, test_suites, target):
                 suite_obj.init_log()
                 suite_obj.set_requested_cases(requested_tests)
                 suite_obj.set_check_inst(check=check_case_inst)
+                suite_obj.set_subtitle(subtitle)
                 result.nic = suite_obj.nic
 
                 dts_log_testsuite(duts, tester, suite_obj, log_handler, test_classname)
@@ -439,7 +440,7 @@ def dts_run_suite(duts, tester, test_suites, target):
 def run_all(config_file, pkgName, git, patch, skip_setup,
             read_cache, project, suite_dir, test_cases,
             base_dir, output_dir, verbose, virttype, debug,
-            debugcase, re_run, commands):
+            debugcase, re_run, commands, subtitle):
     """
     Main process of DTS, it will run all test suites in the config file.
     """
@@ -560,7 +561,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
             dts_crbs_exit(duts, tester)
             continue
 
-        dts_run_target(duts, tester, targets, test_suites)
+        dts_run_target(duts, tester, targets, test_suites, subtitle)
 
         dts_crbs_exit(duts, tester)
 
diff --git a/framework/main.py b/framework/main.py
index 0aa54fd..b91a889 100755
--- a/framework/main.py
+++ b/framework/main.py
@@ -143,6 +143,9 @@ parser.add_argument('--commands',
                     help='run command on tester or dut. The command format is ' +
                     '[commands]:dut|tester:pre-init|post-init:check|ignore')
 
+parser.add_argument('--subtitle',
+                    help='add a subtitle to the rst report')
+
 args = parser.parse_args()
 
 
@@ -159,4 +162,4 @@ dts.run_all(args.config_file, args.snapshot, args.git,
             args.patch, args.skip_setup, args.read_cache,
             args.project, args.suite_dir, args.test_cases,
             args.dir, args.output, args.verbose,args.virttype,
-            args.debug, args.debugcase, args.re_run, args.commands)
+            args.debug, args.debugcase, args.re_run, args.commands, args.subtitle)
diff --git a/framework/rst.py b/framework/rst.py
index ef1825c..2f36ab1 100644
--- a/framework/rst.py
+++ b/framework/rst.py
@@ -107,6 +107,11 @@ class RstReport(object):
             f.write(line)
             f.write('-' * len(line) + '\n')
 
+    def write_subtitle(self):
+	if self._subtitle is not None:
+	    with open(self.rstName, "a") as f:
+		f.write("%s\n" % self._subtitle)
+
     def write_annex_title(self, text):
         """
         write annex to test case title Annex to #Name#
diff --git a/framework/test_case.py b/framework/test_case.py
index 7402631..27d236b 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -58,6 +58,7 @@ class TestCase(object):
 
         # local variable
         self._requested_tests = None
+        self._subtitle 		    = None
 
         # check session and reconnect if possible
         for dutobj in self.duts:
@@ -219,6 +220,13 @@ class TestCase(object):
         """
         self._requested_tests = case_list
 
+    def set_subtitle(self, subtitle):
+        """
+        Pass down subtitle for Rst report
+        """
+	self._rst_obj._subtitle = subtitle
+	self._rst_obj.write_subtitle()
+
     def _get_test_cases(self, test_name_regex):
         """
         Return case list which name matched regex.
-- 
1.8.3.1


             reply	other threads:[~2019-05-03 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 12:13 Rami Rosen [this message]
2019-05-13  7:49 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556885590-33513-1-git-send-email-ramirose@gmail.com \
    --to=ramirose@gmail.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).