public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/2] runner: Support dynamic subtests in testlists
Date: Wed, 29 Jan 2020 15:17:52 +0200	[thread overview]
Message-ID: <20200129131753.12460-1-petri.latvala@intel.com> (raw)

In a very rudimentary and undocumented manner, testlist files can now
have dynamic subtests specified. This feature is intended for very
special cases, and the main supported mode of operation with testlist
files is still the CI-style "run it all no matter what".

The syntax for testlist files is:

igt@binary@subtestname@dynamicsubtestname

As dynamic subtests are not easily listable, any helpers for
generating such testlists are not implemented.

If running in multiple-mode, subtests with dynamic subtests specified
will run in single-mode instead.

Closes: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/45
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/executor.c | 20 +++++++++++++++++---
 runner/job_list.c | 28 ++++++++++++++++++++++------
 2 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index 0927d1fd..8c506dcc 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1033,7 +1033,7 @@ execute_test_process(int outfd, int errfd,
 		     struct settings *settings,
 		     struct job_list_entry *entry)
 {
-	char *argv[4] = {};
+	char *argv[6] = {};
 	size_t rootlen;
 
 	dup2(outfd, STDOUT_FILENO);
@@ -1049,17 +1049,31 @@ execute_test_process(int outfd, int errfd,
 
 	if (entry->subtest_count) {
 		size_t argsize;
+		const char *dynbegin;
 		size_t i;
 
 		argv[1] = strdup("--run-subtest");
-		argsize = strlen(entry->subtests[0]);
+
+		if ((dynbegin = strchr(entry->subtests[0], '@')) != NULL)
+			argsize = dynbegin - entry->subtests[0];
+		else
+			argsize = strlen(entry->subtests[0]);
+
 		argv[2] = malloc(argsize + 1);
-		strcpy(argv[2], entry->subtests[0]);
+		memcpy(argv[2], entry->subtests[0], argsize);
+		argv[2][argsize] = '\0';
+
+		if (dynbegin) {
+			argv[3] = strdup("--dynamic-subtest");
+			argv[4] = strdup(dynbegin + 1);
+		}
 
 		for (i = 1; i < entry->subtest_count; i++) {
 			char *sub = entry->subtests[i];
 			size_t sublen = strlen(sub);
 
+			assert(dynbegin == NULL);
+
 			argv[2] = realloc(argv[2], argsize + sublen + 2);
 			argv[2][argsize] = ',';
 			strcpy(argv[2] + argsize + 1, sub);
diff --git a/runner/job_list.c b/runner/job_list.c
index 93cede75..520a98da 100644
--- a/runner/job_list.c
+++ b/runner/job_list.c
@@ -248,8 +248,12 @@ static bool job_list_from_test_list(struct job_list *job_list,
 			 * If the currently built entry has the same
 			 * binary, add a subtest. Otherwise submit
 			 * what's already built and start a new one.
+			 *
+			 * If the new test has a dynamic subtest
+			 * specified, also start a new entry.
 			 */
-			if (entry.binary && !strcmp(entry.binary, binary)) {
+			if (entry.binary && !strcmp(entry.binary, binary) &&
+			    (delim == NULL || strchr(delim, '@') == NULL)) {
 				if (!delim) {
 					/* ... except we didn't get a subtest */
 					fprintf(stderr,
@@ -275,11 +279,23 @@ static bool job_list_from_test_list(struct job_list *job_list,
 			}
 
 			memset(&entry, 0, sizeof(entry));
-			entry.binary = strdup(binary);
-			if (delim) {
-				entry.subtests = malloc(sizeof(*entry.subtests));
-				entry.subtests[0] = strdup(delim);
-				entry.subtest_count = 1;
+
+			if (delim != NULL && strchr(delim, '@') != NULL) {
+				/* Dynamic subtest specified. Add to job list alone. */
+				char **subtests;
+
+				subtests = malloc(sizeof(char*));
+				subtests[0] = strdup(delim);
+
+				add_job_list_entry(job_list, strdup(binary), subtests, 1);
+				any = true;
+			} else {
+				entry.binary = strdup(binary);
+				if (delim) {
+					entry.subtests = malloc(sizeof(*entry.subtests));
+					entry.subtests[0] = strdup(delim);
+					entry.subtest_count = 1;
+				}
 			}
 
 			free(binary);
-- 
2.20.1

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

             reply	other threads:[~2020-01-29 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 13:17 Petri Latvala [this message]
2020-01-29 13:17 ` [igt-dev] [PATCH i-g-t 2/2] runner_tests: Unit test dynamic subtest testlist support Petri Latvala
2020-01-29 15:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] runner: Support dynamic subtests in testlists Patchwork
2020-01-30  8:56   ` Petri Latvala
2020-01-30 10:00     ` Vudum, Lakshminarayana
2020-01-30 10:04 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-02-01  0:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-02-11 11:35 ` [igt-dev] [PATCH i-g-t 1/2] " Arkadiusz Hiler

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=20200129131753.12460-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox