All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_core.c: Expand --run-subtest functionality.
@ 2016-01-27 10:05 Derek Morton
  2016-01-27 12:32 ` Ville Syrjälä
  2016-02-04 11:41 ` David Weinehall
  0 siblings, 2 replies; 14+ messages in thread
From: Derek Morton @ 2016-01-27 10:05 UTC (permalink / raw)
  To: intel-gfx

Added support for specifying arbitary lists of subtests to run or
to exclude from being run by using : or ^ as a seperator.

:subtest1:subtest2: Will run subtest1 and subtest2
^subtest1^subtest2^ will run all subtests except subtest1 and subtest2

Any subtest string not starting : or ^ is treated as a normal wildcard
expression.

This is required mainly on android to exclude subtests that test
features that do not exist in the android driver while still being able
to run other subtests in the binary when a wildcard expression is
insufficient.

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
---
 lib/igt_core.c | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6b69bb7..b9e7470 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -207,7 +207,15 @@
  * To do that obtain the lists of subtests with "--list-subtests", which can be
  * run as non-root and doesn't require the i915 driver to be loaded (or any
  * intel gpu to be present). Then individual subtests can be run with
- * "--run-subtest". Usage help for tests with subtests can be obtained with the
+ * "--run-subtest". --run-subtest accepts wildcard characters. A list of
+ * subtests to run may be specified by using : as a seperator. A list of
+ * subtests to exclude may be specified using ^ as a seperator.
+ *
+ * - --run-subtest basic* will run all subtests starting basic.
+ * - --run-subtest :subtest1:subtest2: will run only subtest1 and subtest2
+ * - --run-subtest ^subtest1^subtest2^ will run all except subtest1 and subtest2
+ *
+ * Usage help for tests with subtests can be obtained with the
  * "--help" command line option.
  */
 
@@ -786,6 +794,35 @@ void igt_simple_init_parse_opts(int *argc, char **argv,
 		    extra_opt_handler, handler_data);
 }
 
+static bool check_testlist(const char *subtest_name)
+{
+	char *p;
+
+	/* Run subtests in list
+	 * Look for subtest_name in list of form :subtest1:subtest2:subtest3:
+	 * return true if found.
+	 */
+	if (run_single_subtest[0] == ':') {
+		p = strstr(run_single_subtest, subtest_name);
+		if ((p) && (*(p-1) == ':') && (*(p+strlen(subtest_name)) == ':' ))
+			return true;
+	}
+	/* Run subtests not in list
+	 * Look for subtest_name in list of form ^test1^subtest2^subtest3^
+	 * return true if not found.
+	 */
+	else if (run_single_subtest[0] == '^') {
+		p = strstr(run_single_subtest, subtest_name);
+		if (!((p) && (*(p-1) == '^') && (*(p+strlen(subtest_name)) == '^' )))
+			return true;
+	}
+	/* Run subtests that match shell wildcard */
+	else if (fnmatch(run_single_subtest, subtest_name, 0) == 0)
+		return true;
+
+	return false;
+}
+
 /*
  * Note: Testcases which use these helpers MUST NOT output anything to stdout
  * outside of places protected by igt_run_subtest checks - the piglit
@@ -814,7 +851,8 @@ bool __igt_run_subtest(const char *subtest_name)
 	}
 
 	if (run_single_subtest) {
-		if (fnmatch(run_single_subtest, subtest_name, 0) != 0)
+
+		if (check_testlist(subtest_name) == false)
 			return false;
 		else
 			run_single_subtest_found = true;
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-02-04 11:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-27 10:05 [PATCH i-g-t] lib/igt_core.c: Expand --run-subtest functionality Derek Morton
2016-01-27 12:32 ` Ville Syrjälä
2016-01-27 13:30   ` Morton, Derek J
2016-01-27 14:30     ` Ville Syrjälä
2016-01-27 15:02       ` Morton, Derek J
2016-01-27 15:36         ` Ville Syrjälä
2016-01-28  8:35           ` Dave Gordon
2016-01-28 10:47             ` Morton, Derek J
2016-01-27 13:39   ` Daniel Vetter
2016-01-27 14:01     ` Morton, Derek J
2016-01-27 15:42       ` Daniel Vetter
2016-01-27 16:45         ` Morton, Derek J
2016-01-27 17:58           ` Daniel Vetter
2016-02-04 11:41 ` David Weinehall

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.