Skip to contentSkip to conversation

scripts/test_list.py: make filtering logic more generic

PATCH In review Mauro Carvalho Chehab 3 participants 4 messages Apr 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 scripts/test_list.py: make filtering logic more generic

From: Mauro Carvalho Chehab <[email protected]>

Allow multiple filter filters and filter also print outputs, except for the json one.

After the patch, applying multiple filters and display per-test documentation, for instance, could be done with commands like:

  ./scripts/igt_doc.py --config tests/xe/*.json --filter-field \
	 Sub-category=~execbuf run\ type=~bat --per-test

The filter will now be applied to all possible outputs of the script.

---
 scripts/igt_doc.py   | 12 ++++--
 scripts/test_list.py | 87 ++++++++++++++++++++++++++++++++------------
 2 files changed, 71 insertions(+), 28 deletions(-)
scripts/igt_doc.py +8 -4
index 01df35f98ace..38e2bdee4f2a 100755
@@ -32,8 +32,8 @@ parser.add_argument("--show-subtests", action="store_true",
                     help="Shows the name of the documented subtests in alphabetical order.")
 parser.add_argument("--sort-field",
                     help="modify --show-subtests to sort output based on SORT_FIELD value")
-parser.add_argument("--filter-field",
-                    help="modify --show-subtests to filter output based a regex given by FILTER_FIELD=~'regex'")
+parser.add_argument("--filter-field", nargs='*',
+                    help="filter subtests based on regular expressions given by FILTER_FIELD=~'regex'")
 parser.add_argument("--check-testlist", action="store_true",
                     help="Compare documentation against IGT built tests.")
 parser.add_argument("--include-plan", action="store_true",
@@ -51,10 +51,14 @@ parse_args = parser.parse_args()
 tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
                  parse_args.igt_build_path)
 
+if parse_args.filter_field:
+    for filter_expr in parse_args.filter_field:
+        tests.add_filter(filter_expr)
+
 RUN = 0
 if parse_args.show_subtests:
     RUN = 1
-    tests.show_subtests(parse_args.sort_field, parse_args.filter_field)
+    tests.show_subtests(parse_args.sort_field)
 
 if parse_args.check_testlist:
     RUN = 1
@@ -64,7 +68,7 @@ if parse_args.gen_testlist:
     RUN = 1
     if not parse_args.sort_field:
         sys.exit("Need a field to split the testlists")
-    tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field, parse_args.filter_field)
+    tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field)
 
 if parse_args.to_json:
     RUN = 1
scripts/test_list.py +63 -24

170 lines not on this page · raw message

Signature · 1 line
2.40.0
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for scripts/test_list.py: make filtering logic more generic (rev3)

== Series Details ==

== Series Details ==

Series: scripts/test_list.py: make filtering logic more generic (rev3)
URL : https://patchwork.freedesktop.org/series/116098/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13051 -> IGTPW_8841
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (37 -> 37)
------------------------------

Additional (1): fi-kbl-soraka
Missing (1): fi-snb-2520m

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

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

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_module_load@load:
- {bat-mtlp-8}: [ABORT][1] ([i915#8176]) -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/bat-mtlp-8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/bat-mtlp-8/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

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

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/fi-kbl-soraka/igt@[email protected]

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

* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][6] -> [ABORT][7] ([i915#4983] / [i915#8384])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/bat-rpls-1/igt@i915_selftest@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@kms_chamelium_frames@hdmi-crc-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][8] ([fdo#109271]) +16 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/fi-kbl-soraka/igt@[email protected]

{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
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#8176]: https://gitlab.freedesktop.org/drm/intel/issues/8176
[i915#8384]: https://gitlab.freedesktop.org/drm/intel/issues/8384

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

* CI: CI-20190529 -> None
* IGT: IGT_7266 -> IGTPW_8841

CI-20190529: 20190529
CI_DRM_13051: 9132bb6d71522dce6724ff23873a397786e6bf92 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8841: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/index.html
IGT_7266: 94411dd85f9ad6d76fb7b2097197122703a3914c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for scripts/test_list.py: make filtering logic more generic (rev3)

In reply to Mauro Carvalho Chehab
== Series Details ==

== Series Details ==

Series: scripts/test_list.py: make filtering logic more generic (rev3)
URL : https://patchwork.freedesktop.org/series/116098/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13051_full -> IGTPW_8841_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@hang:
- shard-snb: NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#1099])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-snb2/igt@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [PASS][2] -> [FAIL][3] ([i915#2842]) +1 similar issue
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-glk2/igt@gem_exec_fair@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-glk8/igt@gem_exec_fair@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-apl: [PASS][4] -> [ABORT][5] ([i915#5566])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-apl1/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-apl4/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- shard-glk: [PASS][6] -> [DMESG-FAIL][7] ([i915#5334])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-glk9/igt@i915_selftest@live@gt_heartbeat.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-glk3/igt@i915_selftest@live@gt_heartbeat.html

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible@ac-hdmi-a1-hdmi-a2:
- shard-glk: [PASS][8] -> [FAIL][9] ([i915#2122])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-glk1/igt@kms_flip@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-glk1/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-suspend@pipe-a-dp-1:
- shard-apl: [PASS][10] -> [ABORT][11] ([i915#180]) +1 similar issue
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-apl7/igt@kms_hdr@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-apl2/igt@kms_hdr@[email protected]

* igt@kms_plane_scaling@plane-scaler-with-clipping-clamping-rotation@pipe-a-vga-1:
- shard-snb: NOTRUN -> [SKIP][12] ([fdo#109271]) +91 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-snb4/igt@kms_plane_scaling@[email protected]

#### Possible fixes ####

* igt@drm_fdinfo@most-busy-check-all@rcs0:
- {shard-rkl}: [FAIL][13] ([i915#7742]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-rkl-4/igt@drm_fdinfo@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-rkl-3/igt@drm_fdinfo@[email protected]

* igt@gem_eio@hibernate:
- {shard-tglu}: [ABORT][15] ([i915#7975]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-tglu-10/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-tglu-7/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-glk: [FAIL][17] ([i915#2846]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-glk7/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-glk9/igt@[email protected]

* igt@i915_pm_rpm@dpms-mode-unset-non-lpsp:
- {shard-dg1}: [SKIP][19] ([i915#1397]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-dg1-14/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-dg1-18/igt@[email protected]

* igt@i915_pm_rpm@modeset-non-lpsp-stress:
- {shard-rkl}: [SKIP][21] ([i915#1397]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-rkl-7/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-rkl-4/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-async-flip:
- {shard-rkl}: [FAIL][23] ([i915#3743]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-rkl-7/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-rkl-7/igt@[email protected]

* igt@kms_cursor_legacy@single-move@pipe-b:
- {shard-rkl}: [INCOMPLETE][25] ([i915#8011]) -> [PASS][26] +1 similar issue
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-rkl-7/igt@kms_cursor_legacy@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-rkl-6/igt@kms_cursor_legacy@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-apl: [FAIL][27] ([i915#4767]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-apl2/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-apl3/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank@bc-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][29] ([i915#79]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13051/shard-glk2/igt@kms_flip@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/shard-glk5/igt@kms_flip@[email protected]

{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#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
[i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#426]: https://gitlab.freedesktop.org/drm/intel/issues/426
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4391]: https://gitlab.freedesktop.org/drm/intel/issues/4391
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4816]: https://gitlab.freedesktop.org/drm/intel/issues/4816
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
[i915#4884]: https://gitlab.freedesktop.org/drm/intel/issues/4884
[i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5431]: https://gitlab.freedesktop.org/drm/intel/issues/5431
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
[i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
[i915#8150]: https://gitlab.freedesktop.org/drm/intel/issues/8150
[i915#8228]: https://gitlab.freedesktop.org/drm/intel/issues/8228
[i915#8253]: https://gitlab.freedesktop.org/drm/intel/issues/8253
[i915#8292]: https://gitlab.freedesktop.org/drm/intel/issues/8292
[i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308

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

* CI: CI-20190529 -> None
* IGT: IGT_7266 -> IGTPW_8841
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_13051: 9132bb6d71522dce6724ff23873a397786e6bf92 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8841: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8841/index.html
IGT_7266: 94411dd85f9ad6d76fb7b2097197122703a3914c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

Acked-by on v3 1/1
#3 lore raw
In reply to Mauro Carvalho Chehab
Quoted 8 lines · Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

Allow multiple filter filters and filter also print outputs, except for the json one.

After the patch, applying multiple filters and display per-test documentation, for instance, could be done with commands like:

Quoted 8 lines
  ./scripts/igt_doc.py --config tests/xe/*.json --filter-field \
	 Sub-category=~execbuf run\ type=~bat --per-test

The filter will now be applied to all possible outputs of the script.

Quoted 233 lines
---
 scripts/igt_doc.py   | 12 ++++--
 scripts/test_list.py | 87 ++++++++++++++++++++++++++++++++------------
 2 files changed, 71 insertions(+), 28 deletions(-)
scripts/igt_doc.py +8 -4
index 01df35f98ace..38e2bdee4f2a 100755
@@ -32,8 +32,8 @@ parser.add_argument("--show-subtests", action="store_true",
                     help="Shows the name of the documented subtests in alphabetical order.")
 parser.add_argument("--sort-field",
                     help="modify --show-subtests to sort output based on SORT_FIELD value")
-parser.add_argument("--filter-field",
-                    help="modify --show-subtests to filter output based a regex given by FILTER_FIELD=~'regex'")
+parser.add_argument("--filter-field", nargs='*',
+                    help="filter subtests based on regular expressions given by FILTER_FIELD=~'regex'")
 parser.add_argument("--check-testlist", action="store_true",
                     help="Compare documentation against IGT built tests.")
 parser.add_argument("--include-plan", action="store_true",
@@ -51,10 +51,14 @@ parse_args = parser.parse_args()
 tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
                  parse_args.igt_build_path)
 
+if parse_args.filter_field:
+    for filter_expr in parse_args.filter_field:
+        tests.add_filter(filter_expr)
+
 RUN = 0
 if parse_args.show_subtests:
     RUN = 1
-    tests.show_subtests(parse_args.sort_field, parse_args.filter_field)
+    tests.show_subtests(parse_args.sort_field)
 
 if parse_args.check_testlist:
     RUN = 1
@@ -64,7 +68,7 @@ if parse_args.gen_testlist:
     RUN = 1
     if not parse_args.sort_field:
         sys.exit("Need a field to split the testlists")
-    tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field, parse_args.filter_field)
+    tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field)
 
 if parse_args.to_json:
     RUN = 1
scripts/test_list.py +63 -24
index 96d8883db122..1c5e195eb9d3 100755
@@ -257,6 +257,7 @@ class TestList:
         self.level_count = 0
         self.field_list = {}
         self.title = None
+        self.filters = {}
 
         driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
 
@@ -384,6 +385,23 @@ class TestList:
 
             self.__add_field(key, sublevel, hierarchy_level, field[key])
 
+    def __filter_subtest(self, test, subtest, field_not_found_value):
+
+        """ Apply filter criteria to subtests """
+
+        for filter_field, regex in self.filters.items():
+            if filter_field in subtest:
+                if not re.match(regex, subtest[filter_field]):
+                    return True
+            elif filter_field in test:
+                if not re.match(regex, test[filter_field]):
+                    return True
+            else:
+                return field_not_found_value
+
+        # None of the filtering rules were applied
+        return False
+
     def expand_subtest(self, fname, test_name, test, allow_inherit):
 
         """Expand subtest wildcards providing an array with subtests"""
@@ -532,6 +550,9 @@ class TestList:
 
             subtest_array = self.expand_subtest(fname, name, test, subtest_only)
             for subtest in subtest_array:
+                if self.__filter_subtest(test, subtest, True):
+                    continue
+
                 summary = subtest["Summary"]
 
                 dic[summary] = {}
@@ -570,6 +591,19 @@ class TestList:
             name = re.sub(r'\.[ch]', '', name)
             name = "igt@" + name
 
+            tmp_subtest = self.expand_subtest(fname, name, test, False)
+
+            # Get subtests first, to avoid displaying tests with
+            # all filtered subtests
+            subtest_array = []
+            for subtest in tmp_subtest:
+                if self.__filter_subtest(self.doc[test], subtest, True):
+                    continue
+                subtest_array.append(subtest)
+
+            if not subtest_array:
+                continue
+
             print(len(name) * '=')
             print(name)
             print(len(name) * '=')
@@ -583,9 +617,8 @@ class TestList:
 
                 print(f":{field}: {self.doc[test][field]}")
 
-            subtest_array = self.expand_subtest(fname, name, test, False)
-
             for subtest in subtest_array:
+
                 print()
                 print(subtest["Summary"])
                 print(len(subtest["Summary"]) * '=')
@@ -708,11 +741,28 @@ class TestList:
         with open(out_fname, "w", encoding='utf8') as write_file:
             json.dump(test_dict, write_file, indent = 4)
 
+    #
+    # Add filters
+    #
+    def add_filter(self, filter_field_expr):
+
+        """ Add a filter criteria for output data """
+
+        match = re.match(r"(.*)=~\s*(.*)", filter_field_expr)
+        if not match:
+            sys.exit(f"Filter field {filter_field_expr} is not at <field> =~ <regex> syntax")
+        field = match.group(1).strip().lower()
+        if field not in self.field_list:
+            sys.exit(f"Field '{field}' is not defined")
+        filter_field = self.field_list[field]
+        regex = re.compile("{0}".format(match.group(2).strip()), re.I) # pylint: disable=C0209
+        self.filters[filter_field] = regex
+
     #
     # Subtest list methods
     #
 
-    def get_subtests(self, sort_field = None, filter_field_expr = None):
+    def get_subtests(self, sort_field = None):
 
         """Return an array with all subtests"""
 
@@ -724,17 +774,6 @@ class TestList:
                 sys.exit(f"Field '{sort_field}' is not defined")
             sort_field = self.field_list[sort_field.lower()]
 
-        if filter_field_expr:
-            match = re.match(r"(.*)=~\s*(.*)", filter_field_expr)
-            if not match:
-                sys.exit(f"Filter field {filter_field_expr} is not at <field> =~ <regex> syntax")
-
-            field = match.group(1).strip().lower()
-            if field not in self.field_list:
-                sys.exit(f"Field '{field}' is not defined")
-            filter_field = self.field_list[field]
-            regex = re.compile("{0}".format(match.group(2).strip()), re.I) # pylint: disable=C0209
-
         for test in sorted(self.doc.keys()):
             fname = self.doc[test]["File"]
 
@@ -745,11 +784,8 @@ class TestList:
             subtest_array = self.expand_subtest(fname, test_name, test, True)
 
             for subtest in subtest_array:
-                if filter_field_expr:
-                    if filter_field not in subtest:
-                        continue
-                    if not re.match(regex, subtest[filter_field]):
-                        continue
+                if self.__filter_subtest(test, subtest, True):
+                    continue
 
                 if sort_field:
                     if sort_field in subtest:
@@ -807,6 +843,9 @@ class TestList:
         if not self.igt_build_path:
             sys.exit("Need the IGT build path")
 
+        if self.filters:
+            print("NOTE: test checks are affected by filters")
+
         doc_subtests = sorted(self.get_subtests()[""])
 
         for i in range(0, len(doc_subtests)): # pylint: disable=C0200
@@ -1067,12 +1106,12 @@ class TestList:
                 sys.exit(f"{fname}:{file_ln + 1}: Error: unrecognized line. Need to add field at %s?\n\t==> %s" %
                          (self.config_fname, file_line))
 
-    def show_subtests(self, sort_field, filter_field):
+    def show_subtests(self, sort_field):
 
         """Show subtests, allowing sort and filter a field """
 
         if sort_field:
-            test_subtests = self.get_subtests(sort_field, filter_field)
+            test_subtests = self.get_subtests(sort_field)
             for val_key in sorted(test_subtests.keys()):
                 if not test_subtests[val_key]:
                     continue
@@ -1083,17 +1122,17 @@ class TestList:
                     for sub in test_subtests[val_key]:
                         print (f"  {sub}")
         else:
-            for sub in self.get_subtests(sort_field, filter_field)[""]:
+            for sub in self.get_subtests(sort_field)[""]:
                 print (sub)
 
-    def gen_testlist(self, directory, sort_field, filter_field):
+    def gen_testlist(self, directory, sort_field):
 
         """Generate testlists from the test documentation"""
 
         test_prefix = os.path.commonprefix(self.get_subtests()[""])
         test_prefix = re.sub(r'^igt@', '', test_prefix)
 
-        test_subtests = self.get_subtests(sort_field, filter_field)
+        test_subtests = self.get_subtests(sort_field)
 
         for test in test_subtests.keys():  # pylint: disable=C0201,C0206
             if not test_subtests[test]:
Signature · 1 line
2.40.0