All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>,
	Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/2] lib: Update selftests to use dynamic subtests
Date: Thu, 20 Feb 2020 14:52:06 +0200	[thread overview]
Message-ID: <20200220125207.16423-1-petri.latvala@intel.com> (raw)

From: Chris Wilson <chris@chris-wilson.co.uk>

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>
Acked-by: Petri Latvala <petri.latvala@intel.com>
Acked-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
---
 lib/igt_kmod.c            | 23 +++++++++++++++++++----
 tests/igt_command_line.sh |  9 ++-------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 05019c24..e701545d 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 {
diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 291b6526..5356877c 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -89,13 +89,8 @@ check_test ()
 	fi
 
 	if [ $RET -eq 0 -a -z "$LIST" ]; then
-		# Subtest enumeration of kernel selftest launchers depends
-		# on the running kernel. If selftests are not enabled,
-		# they will output nothing and exit with 0.
-		if [ "$testname" != "i915_selftest" -a "$testname" != "drm_mm" -a "$testname" != "kms_selftest" -a "$testname" != "dmabuf" ]; then
-			echo "    test does seem to be using igt_main() (should have subtests) and yet --list-subtests is empty!"
-			fail $test
-		fi
+		echo "    test does seem to be using igt_main() (should have subtests) and yet --list-subtests is empty!"
+		fail $test
 	fi
 }
 
-- 
2.20.1

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

             reply	other threads:[~2020-02-20 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 12:52 Petri Latvala [this message]
2020-02-20 12:52 ` [igt-dev] [PATCH i-g-t 2/2] intel-ci: Kernel selftest changes to fast-feedback and blacklist Petri Latvala
2020-02-27 11:38   ` Martin Peres
2020-02-27 11:46     ` Petri Latvala
2020-02-20 13:42 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [i-g-t,1/2] lib: Update selftests to use dynamic subtests Patchwork
2020-02-20 13:55 ` [igt-dev] ✗ Fi.CI.BAT: " Patchwork
2020-02-24  1:23 ` [igt-dev] ✗ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200220125207.16423-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tomi.p.sarvela@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.