From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: Rami Rosen <ramirose@gmail.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH 1/1] framework: add a new subtitle paramater
Date: Mon, 13 May 2019 07:49:40 +0000 [thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA7FDAF@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1556885590-33513-1-git-send-email-ramirose@gmail.com>
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Rami Rosen
> Sent: Friday, May 3, 2019 8:13 PM
> To: dts@dpdk.org
> Cc: Rami Rosen <ramirose@gmail.com>
> Subject: [dts] [PATCH 1/1] framework: add a new subtitle paramater
>
> 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
prev parent reply other threads:[~2019-05-13 7:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 12:13 Rami Rosen
2019-05-13 7:49 ` Tu, Lijuan [this message]
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=8CE3E05A3F976642AAB0F4675D0AD20E0BA7FDAF@SHSMSX101.ccr.corp.intel.com \
--to=lijuan.tu@intel.com \
--cc=dts@dpdk.org \
--cc=ramirose@gmail.com \
/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).