From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5D98AA0AC5 for ; Fri, 3 May 2019 14:13:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE4A84C8F; Fri, 3 May 2019 14:13:23 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id A95E54C8D for ; Fri, 3 May 2019 14:13:22 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id y2so6516421wmi.5 for ; Fri, 03 May 2019 05:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hFryV54iwhKmNByQFtUeYHen0mCrg9KyZGkUnTHbpsg=; b=ROrs/7ZoMuSSfBm1LGoOmPwnBv//G4K6sTxBdeUhUu+KxYaQZ8xC5Q9IMCuHDEU8+0 u0514CJSimbKIUMfVNw73ebAiILKY/ejqwHMZhC5iLvOlrYxG1JTvTZ28fPFu/kallcD PIMF2TjFI00fK6EgooJAcYxH5Spn/gb3J9eRAVM+LCFG6aZhI95lJInzqejkENOi07gz OHsOkcwH+wTBUEdp/fvkB2u+alZGjuTq/tl5wlcl5jg6/ZyUtGs88i+foI7NATUo0wEc wx0dxqOwQEoxvz6HsYto1BrLnPxdXn/tMSvoWeTiGeQAhTU+Yyhv7s1Cbt/7oITrXa4q G0lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hFryV54iwhKmNByQFtUeYHen0mCrg9KyZGkUnTHbpsg=; b=kig5f93uCxu7xKxKcEa99u2fAhvNS2WrGPN0vt/Zffg84aew49cecrpX6XIW14N9U5 HYjAcyI9NZI11GwMzn6YYuL1z5Wbng03xcpl0ZMsGAajwFvX3LiZey6VExJ+H4WfXW17 mEXVoTjyFEV+p8OMyeV3rSx8S+HRGvTQgrpdMeHapW3Rn2MaCrGcm7g91XWd8xoIxeo7 1EigG0CpFeQCEz89ep2zM8R1hZUYD5yKp8njj1c+mgRusbadi9bK5U+Tm33K9haavHN4 kVaA7DCmXJyiLw9VFxQ4JYRXS6Pfa/40hje/dV8ztSYR9al8hpQJaEQ8IZR20nRByffL HTmQ== X-Gm-Message-State: APjAAAXZjp98AySPp71L6RwqxnOWfpjP9n8t2Yh2fM/q6vVz2yrhT1Y8 CBIq7wi5TiwSRC7K65WgHtszAyy5cMU= X-Google-Smtp-Source: APXvYqzt9kL7GLgFy+dfOVMjCZhvBbxmwP/R144YtE/TVpSGqvelDV3KGyeyNGJYTtqr3tekEaNqjw== X-Received: by 2002:a1c:55c3:: with SMTP id j186mr5652660wmb.127.1556885602044; Fri, 03 May 2019 05:13:22 -0700 (PDT) Received: from tester.localdomain (bzq-79-179-9-126.red.bezeqint.net. [79.179.9.126]) by smtp.gmail.com with ESMTPSA id c9sm1359035wrv.62.2019.05.03.05.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 05:13:21 -0700 (PDT) From: Rami Rosen To: dts@dpdk.org Cc: Rami Rosen Date: Fri, 3 May 2019 15:13:10 +0300 Message-Id: <1556885590-33513-1-git-send-email-ramirose@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH 1/1] framework: add a new subtitle paramater 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" 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 --- 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