ww: print final status for explicit test failures

This commit is contained in:
2026-08-21 07:39:54 +09:00
parent b5fb478613
commit 394e46ff2f
7 changed files with 388 additions and 20 deletions

View File

@@ -211,12 +211,12 @@ exec_package_command(int argc, char **argv, const char *target,
if (fallback == NULL) return 1;
prog = fallback;
}
if (argc < 0 || argc > INT_MAX - 10) {
if (argc < 0 || argc > INT_MAX - 11) {
free(fallback);
sep_fail_size();
return 1;
}
char **xargv = calloc((size_t)argc + 10, sizeof *xargv);
char **xargv = calloc((size_t)argc + 11, sizeof *xargv);
if (xargv == NULL) {
fprintf(stderr,
"ww %s: cannot allocate package coordinator arguments\n",
@@ -233,6 +233,8 @@ exec_package_command(int argc, char **argv, const char *target,
}
xargv[n++] = "--ww-driver";
xargv[n++] = (char *)self_path;
if (!build_only && !add_dot)
xargv[n++] = "--ww-explicit-test-target";
if (root_identity != NULL) {
xargv[n++] = "--ww-root-identity";
xargv[n++] = (char *)root_identity;
@@ -7985,6 +7987,8 @@ do_test(int argc, char **argv)
if (!resolve_module(target, incs, resolved, sizeof resolved,
&is_dir)) {
fprintf(stderr, "ww test: cannot find %s\n", target);
if (src != NULL && !compileonly && !emit_asm)
fputs("FAIL\n", stdout);
return 1;
}
if (is_dir) {
@@ -8064,6 +8068,7 @@ do_test(int argc, char **argv)
fputs("ww: cannot remove temporary output\n", stderr);
if (owntmp && rmdir(tmpdir) != 0)
fputs("ww: cannot remove temporary directory\n", stderr);
if (!compileonly && !emit_asm) fputs("FAIL\n", stdout);
return 1;
}
if (compileonly || emit_asm) {
@@ -8079,6 +8084,7 @@ do_test(int argc, char **argv)
return cleanfail ? 1 : 0;
}
int rc = run_test_bin(outp, pattern);
int test_failed = rc != 0;
if (rc == 0 && deferred_install
&& sep_install_test_output(outp, outstem) != 0)
rc = 1;
@@ -8090,6 +8096,7 @@ do_test(int argc, char **argv)
fputs("ww: cannot remove temporary directory\n", stderr);
if (rc == 0) rc = 1;
}
if (test_failed) fputs("FAIL\n", stdout);
return rc;
}
if (S_ISREG(st.st_mode)) {
@@ -8139,6 +8146,7 @@ do_test(int argc, char **argv)
fputs("ww: cannot remove temporary output\n", stderr);
if (owntmp && rmdir(tmpdir) != 0)
fputs("ww: cannot remove temporary directory\n", stderr);
if (!compileonly && !emit_asm) fputs("FAIL\n", stdout);
return 1;
}
if (compileonly || emit_asm) {
@@ -8154,6 +8162,7 @@ do_test(int argc, char **argv)
return cleanfail ? 1 : 0;
}
int rc = run_test_bin(outp, pattern);
int test_failed = rc != 0;
if (rc == 0 && deferred_install
&& sep_install_test_output(outp, outstem) != 0)
rc = 1;
@@ -8165,6 +8174,7 @@ do_test(int argc, char **argv)
fputs("ww: cannot remove temporary directory\n", stderr);
if (rc == 0) rc = 1;
}
if (test_failed) fputs("FAIL\n", stdout);
return rc;
}
if (!S_ISDIR(st.st_mode)) {