Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] scripts/test_list.py: better handle list of tests
@ 2023-10-20 14:11 Mauro Carvalho Chehab
  2023-10-24  2:21 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  2023-10-25  7:44 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
  0 siblings, 2 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2023-10-20 14:11 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

Not all test lists are regular expressions. Some are just
names. That's the case of IGT runner testlist files.

Add support for that.

In practice, this change will produce the same testlists
as before, but using a logic closer to what igt_runner()
does.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 scripts/test_list.py             | 54 +++++++++++++++++++++++---------
 tests/intel/kms_test_config.json |  2 +-
 tests/intel/xe_test_config.json  |  1 +
 3 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/scripts/test_list.py b/scripts/test_list.py
index e54873f07e20..06215242107a 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -319,10 +319,6 @@ class TestList:
             self.props["Class"]["_properties_"]["level"] = 1
             self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
 
-        flags = 0
-        if self.config.get("case_insensitive_testlist", False):
-            flags |= re.IGNORECASE
-
         # Remove non-multilevel items, as we're only interested on
         # hierarchical item levels here
         for field, item in self.props.items():
@@ -337,7 +333,7 @@ class TestList:
                 testlist = {}
                 for value in item["_properties_"]["include"]:
                     for name in value.keys():
-                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
+                        self.read_testlist(field, item, testlist, name, cfg_path + value[name])
 
                 item["_properties_"]["include"] = testlist
 
@@ -346,7 +342,7 @@ class TestList:
                 testlist = {}
                 for value in item["_properties_"]["exclude"]:
                     for name in value.keys():
-                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
+                        self.read_testlist(field, item, testlist, name, cfg_path + value[name])
 
                 item["_properties_"]["exclude"] = testlist
 
@@ -450,7 +446,22 @@ class TestList:
 
             self.__add_field(key, sublevel, hierarchy_level, field[key])
 
-    def read_testlist(self, testlist, name, filename, flags):
+    def read_testlist(self, field, item, testlist, name, filename):
+
+        match_type = item["_properties_"].get("match-type", "subtest-match")
+
+        match_type_regex = set(["regex", "regex-ignorecase"])
+        match_type_str = set(["subtest-match"])
+        match_types = match_type_regex | match_type_str
+
+        if match_type not in match_types:
+            sys.exit(f"Error: invalid match type '{match_type}' for {field}")
+
+        if match_type == "regex":
+            flags = 0
+        elif match_type == "regex-ignorecase":
+            flags = re.IGNORECASE
+
         base = r"^\s*({}[^\s\{}]+)(\S*)\s*(\#.*)?$"
         regex = re.compile(base.format(self.main_name, self.subtest_separator))
 
@@ -459,12 +470,25 @@ class TestList:
         with open(filename, 'r', newline = '', encoding = 'utf8') as fp:
             for line in fp:
                 match = regex.match(line)
-                if match:
-                    test = match.group(1)
-                    subtest = match.group(2)
-                    if not subtest.endswith("$"):
-                        subtest += r"(\@.*)?$"
-                    testlist[name].append(re.compile(f"{test}{subtest}", flags))
+                if not match:
+                    continue
+
+                test = match.group(1)
+                subtest = match.group(2)
+                test_name = f"{test}{subtest}"
+
+                if match_type in match_type_regex:
+                    testlist[name].append(re.compile(test_name, flags))
+                    continue
+
+                subtests = test_name.split(self.subtest_separator)[:3]
+
+                prefix=""
+                for subtest in subtests:
+                    subtest = prefix + subtest
+                    prefix = subtest + self.subtest_separator
+
+                testlist[name].append(re.compile(f"{subtest}(@.*)?"))
 
     def __filter_subtest(self, test, subtest, field_not_found_value):
 
@@ -504,7 +528,7 @@ class TestList:
             for names, regex_array in self.props[field]["_properties_"]["include"].items():
                 name = set(re.split(",\s*", names))
                 for regex in regex_array:
-                    if regex.match(testname):
+                    if regex.fullmatch(testname):
                         values.update(name)
                         break
 
@@ -514,7 +538,7 @@ class TestList:
                 for names, regex_array in self.props[field]["_properties_"]["exclude"].items():
                     deleted_names = set(re.split(",\s*", names))
                     for regex in regex_array:
-                        if regex.match(testname):
+                        if regex.fullmatch(testname):
                             if sorted(deleted_names) == sorted(values):
                                 set_full_if_empty = False
                             values.discard(deleted_names)
diff --git a/tests/intel/kms_test_config.json b/tests/intel/kms_test_config.json
index 40cf69dd0904..837380ee7fae 100644
--- a/tests/intel/kms_test_config.json
+++ b/tests/intel/kms_test_config.json
@@ -4,7 +4,6 @@
     "files": [ "../chamelium/kms_*.c", "../kms_*.c", "../testdisplay.c", "kms_*.c" ],
     "exclude_files": [ "../chamelium/kms_chamelium_helper.c", "../kms_color_helper.c",
                        "kms_dsc_helper.c" ],
-    "case_insensitive_testlist": true,
     "fields": {
         "Category": {
             "_properties_": {
@@ -24,6 +23,7 @@
                 "_properties_": {
                     "description": "Defines what category of testlist it belongs",
                     "default-testlist": "FULL",
+                    "match-type": "subtest-match",
                     "include": [
                         { "i915 BAT": "../intel-ci/fast-feedback.testlist" },
                         { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" },
diff --git a/tests/intel/xe_test_config.json b/tests/intel/xe_test_config.json
index 20faf73b7270..5fd7c888f274 100644
--- a/tests/intel/xe_test_config.json
+++ b/tests/intel/xe_test_config.json
@@ -33,6 +33,7 @@
                             "mandatory": true,
                             "description": "Defines what category of testlist it belongs",
                             "default-testlist": "FULL",
+                            "match-type": "subtest-match",
                             "include": [
                                 { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }
                             ],
-- 
2.41.0

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

* [igt-dev] ✗ Fi.CI.BAT: failure for scripts/test_list.py: better handle list of tests
  2023-10-20 14:11 [igt-dev] [PATCH i-g-t] scripts/test_list.py: better handle list of tests Mauro Carvalho Chehab
@ 2023-10-24  2:21 ` Patchwork
  2023-10-25  7:44 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2023-10-24  2:21 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 11656 bytes --]

== Series Details ==

Series: scripts/test_list.py: better handle list of tests
URL   : https://patchwork.freedesktop.org/series/125404/
State : failure

== Summary ==

CI Bug Log - changes from IGT_7551 -> IGTPW_10043
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_10043 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_10043, please notify your bug team (lgci.bug.filing@intel.com) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/index.html

Participating hosts (36 -> 36)
------------------------------

  Additional (2): fi-kbl-soraka bat-dg2-8 
  Missing    (2): fi-bsw-n3050 bat-dg1-5 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_10043:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@execlists:
    - fi-bsw-nick:        [PASS][1] -> [ABORT][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7551/fi-bsw-nick/igt@i915_selftest@live@execlists.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/fi-bsw-nick/igt@i915_selftest@live@execlists.html

  
Known issues
------------

  Here are the changes found in IGTPW_10043 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@fbdev@eof:
    - bat-dg2-8:          NOTRUN -> [SKIP][3] ([i915#2582]) +3 other tests skip
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@fbdev@eof.html

  * igt@fbdev@info:
    - bat-dg2-8:          NOTRUN -> [SKIP][4] ([i915#1849] / [i915#2582])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@fbdev@info.html

  * igt@gem_exec_suspend@basic-s0@lmem0:
    - bat-dg2-9:          NOTRUN -> [INCOMPLETE][5] ([i915#9275])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-9/igt@gem_exec_suspend@basic-s0@lmem0.html

  * igt@gem_exec_suspend@basic-s3@smem:
    - bat-dg2-8:          NOTRUN -> [INCOMPLETE][6] ([i915#8575] / [i915#8797] / [i915#9275])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#2190])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@basic:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#4613]) +3 other tests skip
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html

  * igt@gem_mmap@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][9] ([i915#4083])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@gem_mmap@basic.html

  * igt@gem_mmap_gtt@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][10] ([i915#4077]) +2 other tests skip
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@gem_mmap_gtt@basic.html

  * igt@gem_tiled_pread_basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][11] ([i915#4079]) +1 other test skip
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@gem_tiled_pread_basic.html

  * igt@i915_pm_rps@basic-api:
    - bat-dg2-8:          NOTRUN -> [SKIP][12] ([i915#6621])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@i915_pm_rps@basic-api.html

  * igt@i915_selftest@live@gt_pm:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][13] ([i915#1886])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@i915_suspend@basic-s3-without-i915:
    - bat-dg2-8:          NOTRUN -> [SKIP][14] ([i915#6645])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][15] ([i915#5190])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html

  * igt@kms_addfb_basic@basic-y-tiled-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][16] ([i915#4215] / [i915#5190])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_addfb_basic@basic-y-tiled-legacy.html

  * igt@kms_addfb_basic@framebuffer-vs-set-tiling:
    - bat-dg2-8:          NOTRUN -> [SKIP][17] ([i915#4212]) +6 other tests skip
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_addfb_basic@framebuffer-vs-set-tiling.html

  * igt@kms_addfb_basic@tile-pitch-mismatch:
    - bat-dg2-8:          NOTRUN -> [SKIP][18] ([i915#4212] / [i915#5608])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_addfb_basic@tile-pitch-mismatch.html

  * igt@kms_busy@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][19] ([i915#9197]) +1 other test skip
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_busy@basic.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
    - bat-dg2-8:          NOTRUN -> [SKIP][20] ([i915#1845] / [i915#5608] / [i915#9197]) +1 other test skip
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html

  * igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
    - bat-dg2-8:          NOTRUN -> [SKIP][21] ([i915#1845] / [i915#9197]) +12 other tests skip
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size.html

  * igt@kms_dsc@dsc-basic:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][22] ([fdo#109271]) +9 other tests skip
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/fi-kbl-soraka/igt@kms_dsc@dsc-basic.html

  * igt@kms_flip@basic-plain-flip:
    - bat-dg2-8:          NOTRUN -> [SKIP][23] ([i915#4098] / [i915#5354]) +3 other tests skip
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_flip@basic-plain-flip.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-dg2-8:          NOTRUN -> [SKIP][24] ([fdo#109285])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_force_connector_basic@prune-stale-modes:
    - bat-dg2-8:          NOTRUN -> [SKIP][25] ([i915#5274])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_force_connector_basic@prune-stale-modes.html

  * igt@kms_frontbuffer_tracking@basic:
    - bat-dg2-8:          NOTRUN -> [SKIP][26] ([i915#5354])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_psr@cursor_plane_move:
    - bat-dg2-8:          NOTRUN -> [SKIP][27] ([i915#1072]) +3 other tests skip
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_psr@cursor_plane_move.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - bat-dg2-8:          NOTRUN -> [SKIP][28] ([i915#3555] / [i915#4098])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-flip:
    - bat-dg2-8:          NOTRUN -> [SKIP][29] ([i915#3708] / [i915#9197])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@prime_vgem@basic-fence-flip.html

  * igt@prime_vgem@basic-fence-mmap:
    - bat-dg2-8:          NOTRUN -> [SKIP][30] ([i915#3708] / [i915#4077]) +1 other test skip
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@prime_vgem@basic-fence-mmap.html

  * igt@prime_vgem@basic-write:
    - bat-dg2-8:          NOTRUN -> [SKIP][31] ([i915#3291] / [i915#3708]) +2 other tests skip
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-8/igt@prime_vgem@basic-write.html

  
#### Possible fixes ####

  * igt@gem_exec_suspend@basic-s0@smem:
    - bat-dg2-9:          [INCOMPLETE][32] ([i915#9275]) -> [PASS][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7551/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1:
    - bat-rplp-1:         [ABORT][34] ([i915#8668]) -> [PASS][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7551/bat-rplp-1/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/bat-rplp-1/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
  [i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#5608]: https://gitlab.freedesktop.org/drm/intel/issues/5608
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
  [i915#7359]: https://gitlab.freedesktop.org/drm/intel/issues/7359
  [i915#8575]: https://gitlab.freedesktop.org/drm/intel/issues/8575
  [i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
  [i915#8797]: https://gitlab.freedesktop.org/drm/intel/issues/8797
  [i915#8981]: https://gitlab.freedesktop.org/drm/intel/issues/8981
  [i915#9197]: https://gitlab.freedesktop.org/drm/intel/issues/9197
  [i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7551 -> IGTPW_10043

  CI-20190529: 20190529
  CI_DRM_13777: 1b4fd688d213556268c50f853746c94c9a0cfee7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_10043: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/index.html
  IGT_7551: 15e7d92ca5f98d10feffa27a76724c33cbd68da5 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10043/index.html

[-- Attachment #2: Type: text/html, Size: 14075 bytes --]

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

* Re: [igt-dev] [PATCH i-g-t] scripts/test_list.py: better handle list of tests
  2023-10-20 14:11 [igt-dev] [PATCH i-g-t] scripts/test_list.py: better handle list of tests Mauro Carvalho Chehab
  2023-10-24  2:21 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2023-10-25  7:44 ` Kamil Konieczny
  1 sibling, 0 replies; 3+ messages in thread
From: Kamil Konieczny @ 2023-10-25  7:44 UTC (permalink / raw)
  To: igt-dev

Hi Mauro,
On 2023-10-20 at 16:11:22 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
> 
> Not all test lists are regular expressions. Some are just
> names. That's the case of IGT runner testlist files.
> 
> Add support for that.
> 
> In practice, this change will produce the same testlists
> as before, but using a logic closer to what igt_runner()
> does.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

> ---
>  scripts/test_list.py             | 54 +++++++++++++++++++++++---------
>  tests/intel/kms_test_config.json |  2 +-
>  tests/intel/xe_test_config.json  |  1 +
>  3 files changed, 41 insertions(+), 16 deletions(-)
> 
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index e54873f07e20..06215242107a 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -319,10 +319,6 @@ class TestList:
>              self.props["Class"]["_properties_"]["level"] = 1
>              self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
>  
> -        flags = 0
> -        if self.config.get("case_insensitive_testlist", False):
> -            flags |= re.IGNORECASE
> -
>          # Remove non-multilevel items, as we're only interested on
>          # hierarchical item levels here
>          for field, item in self.props.items():
> @@ -337,7 +333,7 @@ class TestList:
>                  testlist = {}
>                  for value in item["_properties_"]["include"]:
>                      for name in value.keys():
> -                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
> +                        self.read_testlist(field, item, testlist, name, cfg_path + value[name])
>  
>                  item["_properties_"]["include"] = testlist
>  
> @@ -346,7 +342,7 @@ class TestList:
>                  testlist = {}
>                  for value in item["_properties_"]["exclude"]:
>                      for name in value.keys():
> -                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
> +                        self.read_testlist(field, item, testlist, name, cfg_path + value[name])
>  
>                  item["_properties_"]["exclude"] = testlist
>  
> @@ -450,7 +446,22 @@ class TestList:
>  
>              self.__add_field(key, sublevel, hierarchy_level, field[key])
>  
> -    def read_testlist(self, testlist, name, filename, flags):
> +    def read_testlist(self, field, item, testlist, name, filename):
> +
> +        match_type = item["_properties_"].get("match-type", "subtest-match")
> +
> +        match_type_regex = set(["regex", "regex-ignorecase"])
> +        match_type_str = set(["subtest-match"])
> +        match_types = match_type_regex | match_type_str
> +
> +        if match_type not in match_types:
> +            sys.exit(f"Error: invalid match type '{match_type}' for {field}")
> +
> +        if match_type == "regex":
> +            flags = 0
> +        elif match_type == "regex-ignorecase":
> +            flags = re.IGNORECASE
> +
>          base = r"^\s*({}[^\s\{}]+)(\S*)\s*(\#.*)?$"
>          regex = re.compile(base.format(self.main_name, self.subtest_separator))
>  
> @@ -459,12 +470,25 @@ class TestList:
>          with open(filename, 'r', newline = '', encoding = 'utf8') as fp:
>              for line in fp:
>                  match = regex.match(line)
> -                if match:
> -                    test = match.group(1)
> -                    subtest = match.group(2)
> -                    if not subtest.endswith("$"):
> -                        subtest += r"(\@.*)?$"
> -                    testlist[name].append(re.compile(f"{test}{subtest}", flags))
> +                if not match:
> +                    continue
> +
> +                test = match.group(1)
> +                subtest = match.group(2)
> +                test_name = f"{test}{subtest}"
> +
> +                if match_type in match_type_regex:
> +                    testlist[name].append(re.compile(test_name, flags))
> +                    continue
> +
> +                subtests = test_name.split(self.subtest_separator)[:3]
> +
> +                prefix=""
> +                for subtest in subtests:
> +                    subtest = prefix + subtest
> +                    prefix = subtest + self.subtest_separator
> +
> +                testlist[name].append(re.compile(f"{subtest}(@.*)?"))
>  
>      def __filter_subtest(self, test, subtest, field_not_found_value):
>  
> @@ -504,7 +528,7 @@ class TestList:
>              for names, regex_array in self.props[field]["_properties_"]["include"].items():
>                  name = set(re.split(",\s*", names))
>                  for regex in regex_array:
> -                    if regex.match(testname):
> +                    if regex.fullmatch(testname):
>                          values.update(name)
>                          break
>  
> @@ -514,7 +538,7 @@ class TestList:
>                  for names, regex_array in self.props[field]["_properties_"]["exclude"].items():
>                      deleted_names = set(re.split(",\s*", names))
>                      for regex in regex_array:
> -                        if regex.match(testname):
> +                        if regex.fullmatch(testname):
>                              if sorted(deleted_names) == sorted(values):
>                                  set_full_if_empty = False
>                              values.discard(deleted_names)
> diff --git a/tests/intel/kms_test_config.json b/tests/intel/kms_test_config.json
> index 40cf69dd0904..837380ee7fae 100644
> --- a/tests/intel/kms_test_config.json
> +++ b/tests/intel/kms_test_config.json
> @@ -4,7 +4,6 @@
>      "files": [ "../chamelium/kms_*.c", "../kms_*.c", "../testdisplay.c", "kms_*.c" ],
>      "exclude_files": [ "../chamelium/kms_chamelium_helper.c", "../kms_color_helper.c",
>                         "kms_dsc_helper.c" ],
> -    "case_insensitive_testlist": true,
>      "fields": {
>          "Category": {
>              "_properties_": {
> @@ -24,6 +23,7 @@
>                  "_properties_": {
>                      "description": "Defines what category of testlist it belongs",
>                      "default-testlist": "FULL",
> +                    "match-type": "subtest-match",
>                      "include": [
>                          { "i915 BAT": "../intel-ci/fast-feedback.testlist" },
>                          { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" },
> diff --git a/tests/intel/xe_test_config.json b/tests/intel/xe_test_config.json
> index 20faf73b7270..5fd7c888f274 100644
> --- a/tests/intel/xe_test_config.json
> +++ b/tests/intel/xe_test_config.json
> @@ -33,6 +33,7 @@
>                              "mandatory": true,
>                              "description": "Defines what category of testlist it belongs",
>                              "default-testlist": "FULL",
> +                            "match-type": "subtest-match",
>                              "include": [
>                                  { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }
>                              ],
> -- 
> 2.41.0
> 


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

end of thread, other threads:[~2023-10-25  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 14:11 [igt-dev] [PATCH i-g-t] scripts/test_list.py: better handle list of tests Mauro Carvalho Chehab
2023-10-24  2:21 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2023-10-25  7:44 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox