test: parallelize test/run via xargs -P; 180s per-tool timeout
test/run fans test/wcc/*.c across $(nproc) workers via xargs -0 -n2 -P $JOBS; each worker writes <prefix>.status and an optional <prefix>.fail sentinel into a mktemp results dir. The driver collects in glob order so output stays deterministic across runs. Wraps every ww/w6c/w6a/w6l/wwdump invocation in 990-995 with `timeout 180`, bounding orphan compilers under 8-way contention. The direct runwait(exe) calls for fresh-built test binaries get the same treatment via a "timeout 180 %s" snprintf hop. Motivation: pid 2101 was a w6c_ww that ran 42h on /tmp/wcas_asm_1326_15.ww until we killed it during this session; timeout makes that impossible. 993's /tmp/ww_d_hello.ww is now pid-keyed (snprintf %d getpid); without it concurrent runs (or future shards of 993 itself) would race on the staging file. Wall: 9m59s → 4m31s on 8 cores. Same 132/132 status.
This commit is contained in:
@@ -66,11 +66,11 @@ build_via(const char *bin, const char *driver, const char *src,
|
||||
char cmd[4096];
|
||||
if (incs && incs[0]) {
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd %s && %s/%s build -I %s %s 2>/dev/null",
|
||||
"cd %s && timeout 180 %s/%s build -I %s %s 2>/dev/null",
|
||||
workdir, bin, driver, incs, src);
|
||||
} else {
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd %s && %s/%s build %s 2>/dev/null",
|
||||
"cd %s && timeout 180 %s/%s build %s 2>/dev/null",
|
||||
workdir, bin, driver, src);
|
||||
}
|
||||
return runwait(cmd);
|
||||
@@ -122,9 +122,14 @@ main(void)
|
||||
char cwd[1024];
|
||||
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
|
||||
|
||||
/* Stage a tiny program in a place both drivers can reach. */
|
||||
/* Stage a tiny program in a place both drivers can reach.
|
||||
* pid-keyed so concurrent runs of this test (or shards of it) don't
|
||||
* race on the staging file. */
|
||||
char hello_src[64], hello_out[64];
|
||||
snprintf(hello_src, sizeof hello_src, "/tmp/ww_d_hello_%d.ww", getpid());
|
||||
snprintf(hello_out, sizeof hello_out, "ww_d_hello_%d", getpid());
|
||||
{
|
||||
FILE *f = fopen("/tmp/ww_d_hello.ww", "w");
|
||||
FILE *f = fopen(hello_src, "w");
|
||||
if (!f) return 1;
|
||||
fputs("import os;\n\n"
|
||||
"export fn main() i32 = {\n"
|
||||
@@ -140,10 +145,12 @@ main(void)
|
||||
const char *out; /* basename of expected output */
|
||||
const char *incs; /* colon-separated -I list, may be NULL */
|
||||
} cases[] = {
|
||||
{ "hello", "/tmp/ww_d_hello.ww", "ww_d_hello", "" },
|
||||
{ "hello", NULL, NULL, "" }, /* filled in below */
|
||||
{ "wwdump", NULL, "main", NULL }, /* filled in below */
|
||||
{ NULL, NULL, NULL, NULL },
|
||||
};
|
||||
cases[0].src = hello_src;
|
||||
cases[0].out = hello_out;
|
||||
|
||||
/* wwdump case: absolute paths so the driver finds the imports
|
||||
* regardless of the per-driver workdir. */
|
||||
@@ -163,7 +170,7 @@ main(void)
|
||||
fail++;
|
||||
n++;
|
||||
}
|
||||
unlink("/tmp/ww_d_hello.ww");
|
||||
unlink(hello_src);
|
||||
if (fail) {
|
||||
fprintf(stderr, "ww_ww: %d/%d diff(s) failed\n", fail, n);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user