From 65a6cac6a040829006cd8de1ba0d6cac0e3bfc20 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 21 May 2026 16:32:27 +0900 Subject: [PATCH] test: parallelize test/run via xargs -P; 180s per-tool timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test/run fans test/wcc/*.c across $(nproc) workers via xargs -0 -n2 -P $JOBS; each worker writes .status and an optional .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. --- test/run | 78 +++++++++++++++++++++++-------------- test/wcc/990_selfhost.c | 63 ++++++++++++++++-------------- test/wcc/991_w6a_ww.c | 4 +- test/wcc/992_w6l_ww.c | 4 +- test/wcc/993_ww_ww.c | 19 ++++++--- test/wcc/994_w6c_ww.c | 8 ++-- test/wcc/995_self_rebuild.c | 4 +- 7 files changed, 104 insertions(+), 76 deletions(-) diff --git a/test/run b/test/run index 72f5a693..7a2499e3 100755 --- a/test/run +++ b/test/run @@ -1,56 +1,74 @@ #!/bin/sh # test/run — driver for `make test`. Plan 9 rc-flavoured but plain sh. # -# Walks the test/ tree: -# test/wcc/_.c → out/bin/test_ binary, run it. -# test/lang//*.ww → compile/run via $WW, compare stdout/exit -# with header comments (// expected: ...). -# Exit non-zero on first failure. - -set -e +# Walks test/wcc/_.c → out/bin/test_ binary, fans out +# across $JOBS (default $(nproc)) workers via xargs -P. Each worker +# writes its status to a per-job file; the collector enumerates them in +# lexicographic order so output stays deterministic across runs even +# though execution interleaves. Exit non-zero if any worker failed. BIN=${BIN:-out/bin} WW=${WW:-$BIN/ww} -fail=0 -ran=0 - -# ---- C-side unit tests -------------------------------------------------- -for t in test/wcc/*.c; do - [ -f "$t" ] || continue +# Worker mode: invoked once per test by xargs. Argv: --one . +# Writes .status; touches .fail on a non-zero binary exit. +if [ "$1" = "--one" ]; then + prefix=$2 + t=$3 name=${t##*/} name=${name%.c} - # strip leading _ short=${name#[0-9][0-9][0-9]_} bin=$BIN/test_$short if [ ! -x "$bin" ]; then - echo "SKIP $name (no binary $bin)" - continue + printf 'SKIP %s (no binary %s)\n' "$name" "$bin" > "$prefix.status" + exit 0 fi - if "$bin" >"$BIN/.$short.out" 2>"$BIN/.$short.err"; then - echo "ok $name" + if "$bin" > "$prefix.out" 2> "$prefix.err"; then + printf 'ok %s\n' "$name" > "$prefix.status" else rc=$? - echo "FAIL $name (rc=$rc)" - echo "--- stdout ---" - cat "$BIN/.$short.out" - echo "--- stderr ---" - cat "$BIN/.$short.err" - fail=$((fail + 1)) + { + printf 'FAIL %s (rc=%d)\n' "$name" "$rc" + echo '--- stdout ---' + cat "$prefix.out" + echo '--- stderr ---' + cat "$prefix.err" + } > "$prefix.status" + : > "$prefix.fail" fi + exit 0 +fi + +set -e + +RESULTS=$(mktemp -d "${TMPDIR:-/tmp}/wwtest.XXXXXX") +trap 'rm -rf "$RESULTS"' EXIT + +JOBS=${JOBS:-$(nproc 2>/dev/null || echo 4)} + +# Emit (prefix, testpath) pairs NUL-separated. The prefix carries the +# test's _ stem so the collector iterates in lexical order, +# yielding deterministic output even though workers interleave. +for t in test/wcc/*.c; do + [ -f "$t" ] || continue + name=${t##*/}; name=${name%.c} + printf '%s/%s\0%s\0' "$RESULTS" "$name" "$t" +done | xargs -0 -n2 -P "$JOBS" "$0" --one || true + +fail=0 +ran=0 +for s in "$RESULTS"/*.status; do + [ -f "$s" ] || continue + cat "$s" ran=$((ran + 1)) + prefix=${s%.status} + [ -f "$prefix.fail" ] && fail=$((fail + 1)) done # ---- ww source-level tests ---------------------------------------------- -# Each test/lang//*.ww has a header: -# // expected-exit: 0 -# // expected-stdout: hello world -# These run with `ww run`; phases that don't compile yet skip entries -# that begin with `// phase: ` if N > current. if [ -d test/lang ]; then for f in test/lang/*/*.ww; do [ -f "$f" ] || continue - # Skip until ww run exists; placeholder for phase 7+ echo "skip $f (ww run not online yet)" done fi diff --git a/test/wcc/990_selfhost.c b/test/wcc/990_selfhost.c index bcf2c3e1..5666c0da 100644 --- a/test/wcc/990_selfhost.c +++ b/test/wcc/990_selfhost.c @@ -79,7 +79,7 @@ probe_codegen(const char *bin) for (int i = 0; files[i]; i++) { char cmd[2048]; snprintf(cmd, sizeof cmd, - "%s/w6c %s/%s > /dev/null 2>&1", bin, cwd, files[i]); + "timeout 180 %s/w6c %s/%s > /dev/null 2>&1", bin, cwd, files[i]); if (runwait(cmd) != 0) { fprintf(stderr, "codegen FAIL: %s\n", files[i]); fail++; @@ -99,15 +99,16 @@ probe_smoke(const char *bin) mkdir(tmpdir, 0755); char cmd[2048]; snprintf(cmd, sizeof cmd, - "cd %s && %s/ww build %s/selfhost/test/smoke.ww >/dev/null 2>&1", + "cd %s && timeout 180 %s/ww build %s/selfhost/test/smoke.ww >/dev/null 2>&1", tmpdir, bin, cwd); if (runwait(cmd) != 0) { fprintf(stderr, "smoke FAIL: ww build did not succeed\n"); return -1; } - char outbin[256]; + char outbin[256], runcmd[512]; snprintf(outbin, sizeof outbin, "%s/smoke", tmpdir); - int rc = runwait(outbin); + snprintf(runcmd, sizeof runcmd, "timeout 180 %s", outbin); + int rc = runwait(runcmd); unlink(outbin); char tmp[1024]; snprintf(tmp, sizeof tmp, "%s/smoke.s", tmpdir); unlink(tmp); @@ -139,10 +140,10 @@ probe_dump_diff_mode(const char *bin, const char *flag, const char **inputs) char a[256], b[256], cmd[2048]; snprintf(a, sizeof a, "/tmp/wwd_diff_%d_c", getpid()); snprintf(b, sizeof b, "/tmp/wwd_diff_%d_w", getpid()); - snprintf(cmd, sizeof cmd, "%s/wwdump %s %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump %s %s/%s > %s 2>/dev/null", bin, flag, cwd, inputs[i], a); runwait(cmd); - snprintf(cmd, sizeof cmd, "%s/wwdump_ww %s %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump_ww %s %s/%s > %s 2>/dev/null", bin, flag, cwd, inputs[i], b); runwait(cmd); char *ba = NULL, *bb = NULL; @@ -472,13 +473,13 @@ probe_ww_compile(const char *bin) fputs(progs[i].src, f); fclose(f); - snprintf(cmd, sizeof cmd, "%s/wwdump_ww -c %s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump_ww -c %s > %s 2>/dev/null", bin, src, wws); if (runwait(cmd) != 0) { fprintf(stderr, "ww-compile prog %d: wwdump_ww -c errored\n", i); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6c %s > %s 2>/dev/null", bin, src, cs); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c %s > %s 2>/dev/null", bin, src, cs); runwait(cmd); char *bw = NULL, *bc = NULL; @@ -492,18 +493,19 @@ probe_ww_compile(const char *bin) } free(bw); free(bc); - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", bin, obj, wws); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, obj, wws); if (runwait(cmd) != 0) { fprintf(stderr, "ww-compile prog %d: w6a failed\n", i); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s %s 2>/dev/null", bin, exe, obj, rt); if (runwait(cmd) != 0) { fprintf(stderr, "ww-compile prog %d: w6l failed\n", i); fail++; goto cleanup; } - int rc = runwait(exe); + snprintf(cmd, sizeof cmd, "timeout 180 %s", exe); + int rc = runwait(cmd); if (rc != progs[i].want_exit) { fprintf(stderr, "ww-compile prog %d: exit=%d, want %d\n", i, rc, progs[i].want_exit); @@ -536,7 +538,7 @@ probe_resolve(const char *bin) for (int i = 0; complete[i]; i++) { char a[256], cmd[2048]; snprintf(a, sizeof a, "/tmp/wwd_r_%d", getpid()); - snprintf(cmd, sizeof cmd, "%s/wwdump_ww -r %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump_ww -r %s/%s > %s 2>/dev/null", bin, cwd, complete[i], a); int rc = runwait(cmd); if (rc != 0) { @@ -568,7 +570,7 @@ probe_dump_stable(const char *bin) snprintf(a, sizeof a, "/tmp/wwd_%d_a", getpid()); snprintf(b, sizeof b, "/tmp/wwd_%d_b", getpid()); char cmd[2048]; - snprintf(cmd, sizeof cmd, "%s/wwdump %s %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump %s %s/%s > %s 2>/dev/null", bin, modes[m], cwd, inputs[i], a); if (runwait(cmd) != 0) { fprintf(stderr, "wwdump FAIL: %s %s\n", modes[m], inputs[i]); @@ -576,7 +578,7 @@ probe_dump_stable(const char *bin) fail++; continue; } - snprintf(cmd, sizeof cmd, "%s/wwdump %s %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump %s %s/%s > %s 2>/dev/null", bin, modes[m], cwd, inputs[i], b); runwait(cmd); char *ba = NULL, *bb = NULL; @@ -629,21 +631,21 @@ probe_bootstrap_fixed_point(const char *bin) int fail = 0; /* ww1 -> ww2 */ snprintf(cmd, sizeof cmd, - "%s/wwdump_ww -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", + "timeout 180 %s/wwdump_ww -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", bin, cwd, ww2s); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: ww1 self-compile\n"); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", bin, ww2o, ww2s); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, ww2o, ww2s); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: w6a ww2.s\n"); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s %s 2>/dev/null", bin, ww2e, ww2o, rt); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s %s 2>/dev/null", bin, ww2e, ww2o, rt); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: w6l ww2\n"); fail++; goto cleanup; } /* ww2 -> ww3 */ snprintf(cmd, sizeof cmd, - "%s -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", + "timeout 180 %s -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", ww2e, cwd, ww3s); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: ww2 self-compile\n"); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", bin, ww3o, ww3s); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, ww3o, ww3s); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: w6a ww3.s\n"); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s %s 2>/dev/null", bin, ww3e, ww3o, rt); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s %s 2>/dev/null", bin, ww3e, ww3o, rt); if (runwait(cmd) != 0) { fprintf(stderr, "fp FAIL: w6l ww3\n"); fail++; goto cleanup; } /* The fixed-point check: ww2.s == ww3.s, ww2 == ww3. */ snprintf(cmd, sizeof cmd, "cmp -s %s %s", ww2s, ww3s); @@ -677,14 +679,14 @@ probe_ww1_to_ww2(const char *bin) snprintf(exe_p, sizeof exe_p, "%s/ww2", tmpdir); int fail = 0; snprintf(cmd, sizeof cmd, - "%s/wwdump_ww -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", + "timeout 180 %s/wwdump_ww -c %s/selfhost/cmd/wwdump/main.combined.ww > %s 2>/dev/null", bin, cwd, asm_p); if (runwait(cmd) != 0) { fprintf(stderr, "ww1->ww2 FAIL: wwdump_ww segfaulted on its own source\n"); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", bin, obj_p, asm_p); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, obj_p, asm_p); if (runwait(cmd) != 0) { fprintf(stderr, "ww1->ww2 FAIL: w6a errored on ww1 output\n"); fail++; @@ -692,7 +694,7 @@ probe_ww1_to_ww2(const char *bin) } char rt[1024]; snprintf(rt, sizeof rt, "%s/../lib/libwwrt.a", bin); - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s %s 2>/dev/null", bin, exe_p, obj_p, rt); if (runwait(cmd) != 0) { fprintf(stderr, "ww1->ww2 FAIL: w6l errored\n"); @@ -748,7 +750,7 @@ probe_ww_links(const char *bin) runwait(cmd); /* ww build to get the .combined.ww as a side effect. */ snprintf(cmd, sizeof cmd, - "cd %s && %s/ww build -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc %s >/dev/null 2>&1", + "cd %s && timeout 180 %s/ww build -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc %s >/dev/null 2>&1", tmpdir, bin, cwd, cwd, cwd, cwd, tmpsrc); if (runwait(cmd) != 0) { fprintf(stderr, "ww-links FAIL: ww build %s\n", fix); @@ -762,13 +764,13 @@ probe_ww_links(const char *bin) snprintf(wop, sizeof wop, "%s_w.o", stem); snprintf(wexep, sizeof wexep, "%s_w", stem); snprintf(cmd, sizeof cmd, - "%s/wwdump_ww -c %s > %s 2>/dev/null", bin, combinedp, wsp); + "timeout 180 %s/wwdump_ww -c %s > %s 2>/dev/null", bin, combinedp, wsp); if (runwait(cmd) != 0) { fprintf(stderr, "ww-links FAIL: wwdump_ww -c %s\n", fix); fail++; goto cleanup; } - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, wop, wsp); if (runwait(cmd) != 0) { fprintf(stderr, "ww-links FAIL: w6a %s\n", fix); @@ -777,14 +779,15 @@ probe_ww_links(const char *bin) } char rt[1024]; snprintf(rt, sizeof rt, "%s/../lib/libwwrt.a", bin); - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s %s 2>/dev/null", bin, wexep, wop, rt); if (runwait(cmd) != 0) { fprintf(stderr, "ww-links FAIL: w6l %s\n", fix); fail++; goto cleanup; } - int rc = runwait(wexep); + snprintf(cmd, sizeof cmd, "timeout 180 %s", wexep); + int rc = runwait(cmd); if (rc != want) { fprintf(stderr, "ww-links FAIL: %s exit=%d want=%d\n", fix, rc, want); @@ -819,10 +822,10 @@ probe_cgen_match(const char *bin) char a[256], b[256], cmd[2048]; snprintf(a, sizeof a, "/tmp/wwd_cm_%d_c", getpid()); snprintf(b, sizeof b, "/tmp/wwd_cm_%d_w", getpid()); - snprintf(cmd, sizeof cmd, "%s/w6c %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c %s/%s > %s 2>/dev/null", bin, cwd, files[i], a); runwait(cmd); - snprintf(cmd, sizeof cmd, "%s/wwdump_ww -c %s/%s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump_ww -c %s/%s > %s 2>/dev/null", bin, cwd, files[i], b); runwait(cmd); char *bc = NULL, *bw = NULL; diff --git a/test/wcc/991_w6a_ww.c b/test/wcc/991_w6a_ww.c index e3200113..34851e13 100644 --- a/test/wcc/991_w6a_ww.c +++ b/test/wcc/991_w6a_ww.c @@ -65,13 +65,13 @@ diff_one(const char *bin, const char *src) snprintf(co, sizeof co, "/tmp/wwa_%d_c.o", getpid()); snprintf(wo, sizeof wo, "/tmp/wwa_%d_w.o", getpid()); - snprintf(cmd, sizeof cmd, "%s/w6a -o %s %s 2>/dev/null", bin, co, src); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a -o %s %s 2>/dev/null", bin, co, src); if (runwait(cmd) != 0) { fprintf(stderr, "w6a_ww FAIL: C w6a errored on %s\n", src); unlink(co); return -1; } - snprintf(cmd, sizeof cmd, "%s/w6a_ww -o %s %s 2>/dev/null", bin, wo, src); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6a_ww -o %s %s 2>/dev/null", bin, wo, src); if (runwait(cmd) != 0) { fprintf(stderr, "w6a_ww FAIL: ww w6a errored on %s\n", src); unlink(co); unlink(wo); diff --git a/test/wcc/992_w6l_ww.c b/test/wcc/992_w6l_ww.c index e96b1418..ec50dcb4 100644 --- a/test/wcc/992_w6l_ww.c +++ b/test/wcc/992_w6l_ww.c @@ -65,13 +65,13 @@ diff_one(const char *bin, const char *label, const char *inputs) snprintf(co, sizeof co, "/tmp/wwl_%d_c", getpid()); snprintf(wo, sizeof wo, "/tmp/wwl_%d_w", getpid()); - snprintf(cmd, sizeof cmd, "%s/w6l -o %s %s 2>/dev/null", bin, co, inputs); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l -o %s %s 2>/dev/null", bin, co, inputs); if (runwait(cmd) != 0) { fprintf(stderr, "w6l_ww FAIL: C w6l errored on %s\n", label); unlink(co); return -1; } - snprintf(cmd, sizeof cmd, "%s/w6l_ww -o %s %s 2>/dev/null", bin, wo, inputs); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6l_ww -o %s %s 2>/dev/null", bin, wo, inputs); if (runwait(cmd) != 0) { fprintf(stderr, "w6l_ww FAIL: ww w6l errored on %s\n", label); unlink(co); unlink(wo); diff --git a/test/wcc/993_ww_ww.c b/test/wcc/993_ww_ww.c index 96898bb1..c215eb2e 100644 --- a/test/wcc/993_ww_ww.c +++ b/test/wcc/993_ww_ww.c @@ -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; diff --git a/test/wcc/994_w6c_ww.c b/test/wcc/994_w6c_ww.c index 844beef9..12297114 100644 --- a/test/wcc/994_w6c_ww.c +++ b/test/wcc/994_w6c_ww.c @@ -66,14 +66,14 @@ diff_one(const char *bin, const char *label, const char *src) snprintf(ws, sizeof ws, "/tmp/wwc6_%d_w.s", getpid()); snprintf(cs, sizeof cs, "/tmp/wwc6_%d_c.s", getpid()); - snprintf(cmd, sizeof cmd, "%s/wwdump_ww -c %s > %s 2>/dev/null", + snprintf(cmd, sizeof cmd, "timeout 180 %s/wwdump_ww -c %s > %s 2>/dev/null", bin, src, ws); if (runwait(cmd) != 0) { fprintf(stderr, "w6c_ww FAIL: wwdump_ww -c errored on %s\n", label); unlink(ws); return -1; } - snprintf(cmd, sizeof cmd, "%s/w6c_ww -o %s %s 2>/dev/null", bin, cs, src); + snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c_ww -o %s %s 2>/dev/null", bin, cs, src); if (runwait(cmd) != 0) { fprintf(stderr, "w6c_ww FAIL: w6c_ww errored on %s\n", label); unlink(ws); unlink(cs); @@ -268,9 +268,9 @@ main(void) snprintf(s, sizeof s, "/tmp/wwc6_bad_%d_%d.s", getpid(), i); if (write_file(src, bad[i].src) != 0) { fail++; n++; continue; } snprintf(wcmd, sizeof wcmd, - "%s/w6c_ww -o %s %s >/dev/null 2>&1", bin, s, src); + "timeout 180 %s/w6c_ww -o %s %s >/dev/null 2>&1", bin, s, src); snprintf(dcmd, sizeof dcmd, - "%s/wwdump_ww -c %s >%s 2>/dev/null", bin, src, s); + "timeout 180 %s/wwdump_ww -c %s >%s 2>/dev/null", bin, src, s); if (runwait(wcmd) == 0) { fprintf(stderr, "w6c_ww FAIL: %s slipped past check (silent miscompile)\n", diff --git a/test/wcc/995_self_rebuild.c b/test/wcc/995_self_rebuild.c index 16dc5078..e59006ee 100644 --- a/test/wcc/995_self_rebuild.c +++ b/test/wcc/995_self_rebuild.c @@ -79,12 +79,12 @@ rebuild_one(const char *bin, const char *cwd, const char *tool, if (inc_local && inc_local[0]) { snprintf(cmd, sizeof cmd, - "cd %s && %s/ww_ww build -I %s/%s -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc " + "cd %s && timeout 180 %s/ww_ww build -I %s/%s -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc " "%s/%s >/dev/null 2>&1", workdir, bin, cwd, inc_local, cwd, cwd, cwd, cwd, cwd, src_rel); } else { snprintf(cmd, sizeof cmd, - "cd %s && %s/ww_ww build -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc " + "cd %s && timeout 180 %s/ww_ww build -I %s/lib/ww -I %s/lib/ww/lex -I %s/lib/ww/parse -I %s/selfhost/cmd/wcc " "%s/%s >/dev/null 2>&1", workdir, bin, cwd, cwd, cwd, cwd, cwd, src_rel); }