test suite reviews and discussions
 help / color / mirror / Atom feed
* [DTS][PATCH V2 0/2] fix result output overwriting when using multiple lines in execution configuration for one suite.
@ 2023-03-15  1:56 Ke Xu
  2023-03-15  1:56 ` [DTS][PATCH V2 1/2] framework/test_result: fix unsafe __set_test_case Ke Xu
  2023-03-15  1:56 ` [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements Ke Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Ke Xu @ 2023-03-15  1:56 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, ke1.xu

In execution config, multi-run suites and cases are grammarly allowed.
 When we call for a suite multiple times, the new result will overwrite
 the old result totally.

Here we introduces two fixes.

1. We fix framework/test_result.Result.__set_test_case method for the non-checking appending.
2. We fix framework/dts.dts_parse_config method for de-duplicating suites and cases.

Ke Xu (2):
  framework/test_result: fix unsafe __set_test_case
  framework/dts: fix result setting by overwriting old result
    with new result

 framework/dts.py         | 25 ++++++++++++++++++++++++-
 framework/test_result.py |  5 +++--
 2 files changed, 27 insertions(+), 3 deletions(-)

-- 
2.25.1


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

* [DTS][PATCH V2 1/2] framework/test_result: fix unsafe __set_test_case
  2023-03-15  1:56 [DTS][PATCH V2 0/2] fix result output overwriting when using multiple lines in execution configuration for one suite Ke Xu
@ 2023-03-15  1:56 ` Ke Xu
  2023-03-15  1:56 ` [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements Ke Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Ke Xu @ 2023-03-15  1:56 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, ke1.xu

Without a pre-append check, __set_test_case method will append redundant
 elements when setting but locating the result at the first element. If
 this method is called several times, the outcome will de-organize in data
 structure.

There is a pre-append check in __set_test_suite and __set_test_suite. This
 implementation imitated the methods above.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 framework/test_result.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/framework/test_result.py b/framework/test_result.py
index b62ed120..081b7256 100644
--- a/framework/test_result.py
+++ b/framework/test_result.py
@@ -232,8 +232,9 @@ class Result(object):
 
     def __set_test_case(self, test_case):
         cases = self.__current_cases()
-        cases.append(test_case)
-        cases.append([])
+        if test_case not in cases:
+            cases.append(test_case)
+            cases.append([])
         self.__test_case = cases.index(test_case)
 
     def __get_test_case(self):
-- 
2.25.1


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

* [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements.
  2023-03-15  1:56 [DTS][PATCH V2 0/2] fix result output overwriting when using multiple lines in execution configuration for one suite Ke Xu
  2023-03-15  1:56 ` [DTS][PATCH V2 1/2] framework/test_result: fix unsafe __set_test_case Ke Xu
@ 2023-03-15  1:56 ` Ke Xu
  2023-03-28  0:54   ` lijuan.tu
  1 sibling, 1 reply; 4+ messages in thread
From: Ke Xu @ 2023-03-15  1:56 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, ke1.xu

In execution config, multi-run suites and cases are grammarly allowed.
 When we call for a suite multiple times, the new result will overwrite
 the old result totally.

This fix merges duplicated lines for suites when parsing the execution
 configuration, preventing the potential multiple run of suites and
 cases.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 framework/dts.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/framework/dts.py b/framework/dts.py
index a8e670b5..b55aed90 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -149,9 +149,32 @@ def dts_parse_config(config, section):
     settings.save_global_setting(settings.DPDK_RXMODE_SETTING, rx_mode)
     settings.save_global_setting(settings.DPDK_DCFMODE_SETTING, dcf_mode)
 
+    suite_list_dedup = {}
+    ## suite_list_dedup[suite_name] := { True | Set | ... }
+    ## True := All Cases to Run
+    ## Set := Listed Cases to Run
     for suite in test_suites:
         if suite == "":
-            test_suites.remove(suite)
+            pass
+        elif ":" in suite:
+            suite_name = suite[: suite.find(":")]
+            case_list_str = suite[suite.find(":") + 1 :]
+            case_list = case_list_str.split("\\")
+            if not suite_name in suite_list_dedup:
+                suite_list_dedup[suite_name] = set()
+            if isinstance(suite_list_dedup[suite_name], set):
+                suite_list_dedup[suite_name].update(case_list)
+            elif suite_list_dedup[suite_name] == True:
+                pass
+        else:
+            suite_list_dedup[suite] = True
+
+    test_suites = []
+    for suite in suite_list_dedup:
+        if suite_list_dedup[suite] == True:
+            test_suites.append(suite)
+        elif isinstance(suite_list_dedup[suite], set) and suite_list_dedup[suite]:
+            test_suites.append(suite + ":" + "\\".join(suite_list_dedup[suite]))
 
     return duts, targets, test_suites
 
-- 
2.25.1


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

* [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements.
  2023-03-15  1:56 ` [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements Ke Xu
@ 2023-03-28  0:54   ` lijuan.tu
  0 siblings, 0 replies; 4+ messages in thread
From: lijuan.tu @ 2023-03-28  0:54 UTC (permalink / raw)
  To: dts, Ke Xu; +Cc: lijuan.tu, ke1.xu

On Wed, 15 Mar 2023 09:56:55 +0800, Ke Xu <ke1.xu@intel.com> wrote:
> In execution config, multi-run suites and cases are grammarly allowed.
>  When we call for a suite multiple times, the new result will overwrite
>  the old result totally.
> 
> This fix merges duplicated lines for suites when parsing the execution
>  configuration, preventing the potential multiple run of suites and
>  cases.
> 
> Signed-off-by: Ke Xu <ke1.xu@intel.com>


Series applied, thanks

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

end of thread, other threads:[~2023-03-28  0:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15  1:56 [DTS][PATCH V2 0/2] fix result output overwriting when using multiple lines in execution configuration for one suite Ke Xu
2023-03-15  1:56 ` [DTS][PATCH V2 1/2] framework/test_result: fix unsafe __set_test_case Ke Xu
2023-03-15  1:56 ` [DTS][PATCH V2 2/2] framework/dts: fix result output by merging cases when parsing execution requirements Ke Xu
2023-03-28  0:54   ` lijuan.tu

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