summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runner/executor.c20
-rw-r--r--runner/job_list.c28
2 files changed, 39 insertions, 9 deletions
diff --git a/runner/executor.c b/runner/executor.c
index dbe6fa575..3ea5d167e 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1064,7 +1064,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);
@@ -1080,17 +1080,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 93cede754..520a98da0 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);