public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib: Update selftests to use dynamic subtests
@ 2020-02-14 21:48 Chris Wilson
  2020-02-14 22:53 ` [igt-dev] ✗ GitLab.Pipeline: failure for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Chris Wilson @ 2020-02-14 21:48 UTC (permalink / raw)
  To: igt-dev; +Cc: Tomi Sarvela, Petri Latvala

Use the new igt_subtest_with_dynamic to nicely group the dynamic
subtests together.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
---
 lib/igt_kmod.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 05019c24c..e701545d3 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -21,6 +21,7 @@
  * IN THE SOFTWARE.
  */
 
+#include <ctype.h>
 #include <signal.h>
 #include <errno.h>
 
@@ -602,6 +603,18 @@ void igt_kselftest_fini(struct igt_kselftest *tst)
 	kmod_module_unref(tst->kmod);
 }
 
+static const char *unfilter(const char *filter, const char *name)
+{
+	if (!filter)
+		return name;
+
+	name += strlen(filter);
+	if (!isalpha(*name))
+		name++;
+
+	return name;
+}
+
 void igt_kselftests(const char *module_name,
 		    const char *options,
 		    const char *result,
@@ -618,10 +631,12 @@ void igt_kselftests(const char *module_name,
 		igt_require(igt_kselftest_begin(&tst) == 0);
 
 	igt_kselftest_get_tests(tst.kmod, filter, &tests);
-	igt_list_for_each_entry_safe(tl, tn, &tests, link) {
-		igt_subtest_f("%s", tl->name)
-			igt_kselftest_execute(&tst, tl, options, result);
-		free(tl);
+	igt_subtest_with_dynamic(filter ?: "all") {
+		igt_list_for_each_entry_safe(tl, tn, &tests, link) {
+			igt_dynamic_f("%s", unfilter(filter, tl->name))
+				igt_kselftest_execute(&tst, tl, options, result);
+			free(tl);
+		}
 	}
 
 	igt_fixture {
-- 
2.25.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2020-02-17 15:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-14 21:48 [igt-dev] [PATCH i-g-t] lib: Update selftests to use dynamic subtests Chris Wilson
2020-02-14 22:53 ` [igt-dev] ✗ GitLab.Pipeline: failure for " Patchwork
2020-02-14 23:05 ` [igt-dev] ✗ Fi.CI.BAT: " Patchwork
2020-02-17 11:01 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2020-02-17 11:17   ` Petri Latvala
2020-02-17 11:22     ` Chris Wilson
2020-02-17 11:26       ` Petri Latvala
2020-02-17 11:32         ` Chris Wilson
2020-02-17 12:38           ` Petri Latvala
2020-02-17 11:36   ` Sarvela, Tomi P
2020-02-17 12:44 ` [igt-dev] [PATCH i-g-t v2] " Chris Wilson
2020-02-17 13:16 ` [igt-dev] ✗ GitLab.Pipeline: warning for lib: Update selftests to use dynamic subtests (rev3) Patchwork
2020-02-17 15:59 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork

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