summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-07 23:55:45 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-07-08 00:15:46 -0400
commitfbd193a8d397e58e807bd29661035d92665a494b (patch)
tree54676c86e377a1ae3cb18dbb2cd18710aa2a16dc
parent9374fbb2073541fd4d3f44ab70e36e31cd27e513 (diff)
fixup! get-test-job: Query for subtests, and write per-subtest lockfiles
-rw-r--r--ci/_test-git-branch.sh2
-rwxr-xr-xci/get-test-job.sh4
-rw-r--r--lib/get-test-job.c16
3 files changed, 17 insertions, 5 deletions
diff --git a/ci/_test-git-branch.sh b/ci/_test-git-branch.sh
index 7538439..b0b8dbb 100644
--- a/ci/_test-git-branch.sh
+++ b/ci/_test-git-branch.sh
@@ -47,7 +47,7 @@ if [[ -z $TEST_PATH ]]; then
exit 1
fi
-echo "Running test $TEST_PATH on commit $COMMIT from branch $BRANCH"
+echo "Running test job ${TEST_JOB[@]}"
sync_git_repos
git_fetch linux $COMMIT
diff --git a/ci/get-test-job.sh b/ci/get-test-job.sh
index 7e48c9b..3eac73b 100755
--- a/ci/get-test-job.sh
+++ b/ci/get-test-job.sh
@@ -9,6 +9,6 @@ find -size 0 -cmin +180 |xargs rm -f > /dev/null
cd $JOBSERVER_HOME/linux
flock --nonblock .git_fetch.lock git fetch --all > /dev/null
-make -C ~/ktest/lib get-test-job
+make -C ~/ktest/lib get-test-job 1>&2
-~/ktest/lib/get-test-job -b ~/BRANCHES-TO-TEST -o ~/web/c
+~/ktest/lib/get-test-job -v -b ~/BRANCHES-TO-TEST -o ~/web/c
diff --git a/lib/get-test-job.c b/lib/get-test-job.c
index 665249f..b6ba666 100644
--- a/lib/get-test-job.c
+++ b/lib/get-test-job.c
@@ -101,6 +101,9 @@ static strings get_subtests(char *test_path)
darray_init(output);
darray_init(ret);
+ if (verbose)
+ fprintf(stderr, "Getting subtests for %s\n", test_path);
+
char *cmd = mprintf("%s list-tests", test_path);
FILE *f = popen(cmd, "r");
free(cmd);
@@ -112,12 +115,14 @@ static strings get_subtests(char *test_path)
darray_make_room(output, 4096);
bytes_read = fread(output.item + output.size,
- 1, 4096, f);
+ 1, 4095, f);
output.size += bytes_read;
} while (bytes_read);
pclose(f);
+ output.item[output.size] = '\0';
+
char *subtest, *p = output.item;
while ((subtest = strtok(p, " \t\n"))) {
darray_push(ret, strdup(subtest));
@@ -198,7 +203,7 @@ static test_job branch_get_next_test_job(char *branch,
}
fprintf(stderr, "error looking up commits on branch %s\n", branch);
success:
- fclose(commits);
+ pclose(commits);
free(commit);
free(cmd);
return ret;
@@ -269,6 +274,7 @@ int main(int argc, char *argv[])
strings subtests;
char **subtest;
+ darray_init(subtests);
memset(&job, 0, sizeof(job));
while ((opt = getopt(argc, argv, "b:o:vh")) != -1) {
@@ -302,6 +308,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "got %s %s %s age %u\n",
job.branch, job.commit, job.test, job.age);
+ darray_free(subtests);
darray_init(subtests);
darray_foreach(subtest, job.subtests)
@@ -313,4 +320,9 @@ int main(int argc, char *argv[])
darray_foreach(subtest, subtests)
printf(" %s", *subtest);
printf("\n");
+
+ test_job_free(&job);
+ darray_free(subtests);
+ free(outdir);
+ free(branches_to_test);
}