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