ww: lib tests run via -T test mode; bare mains retired (closes @test conversion)

'ww test' gains the istest build path (-T injection in build_one/
buildone) and do_test/dotest accept -I, mirroring do_run - both twins.
The 35 converted lib tests drop their interim bare mains (-T
synthesizes the entry from @test fns and rejects a user main); their
35 C run-drivers flip 'ww run' -> 'ww test'; 989_lib_byteid compiles
lib tests under -T (8 user-main probe fixtures stay non-T, gated on
the fixture field). Abort-on-first-failure stands until the deferred
record-and-continue harness lands with the multi-package arc.
This commit is contained in:
2026-06-10 20:45:46 +09:00
parent 5b212e51cf
commit 2338ea5d59
74 changed files with 178 additions and 670 deletions

View File

@@ -39,7 +39,7 @@ main(void)
const char *src = "lib/errors/errnotest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/ascii/asciitest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "ascii_run FAIL: %s exited %d\n", src, rc);

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/ww/lex/toktest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "tok_run FAIL: %s exited %d\n", src, rc);

View File

@@ -46,7 +46,7 @@ main(void)
char path[1024], inc[1024], cmd[3072];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(inc, sizeof inc, "%s/lib/ww/lex", cwd);
snprintf(cmd, sizeof cmd, "%s/ww run -I %s %s", bin, inc, path);
snprintf(cmd, sizeof cmd, "%s/ww test -I %s %s", bin, inc, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "nkname_run FAIL: %s exited %d\n", src, rc);

View File

@@ -44,7 +44,7 @@ main(void)
const char *src = "lib/strconv/test/ftostest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "ftos_run FAIL: %s exited %d\n", src, rc);

View File

@@ -44,7 +44,7 @@ main(void)
const char *src = "lib/strconv/test/stoftest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "stof_run FAIL: %s exited %d\n", src, rc);

View File

@@ -43,7 +43,7 @@ main(void)
const char *src = "lib/strconv/test/inttest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "strconv_int_run FAIL: %s exited %d\n", src, rc);

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/strings/stringstest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/bytes/bytestest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "bytes_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/encoding/utf8/utf8test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "utf8_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/math/checked/checked_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "checked_run FAIL: %s exited %d\n", src, rc);

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/fmt/fmttest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/log/logtest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/fnmatch/fnmatchtest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/shlex/shlextest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "shlex_run FAIL: %s exited %d\n", src, rc);

View File

@@ -54,7 +54,7 @@ main(void)
const char *src = "lib/os/ostest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "getenv_run FAIL: %s exited %d\n", src, rc);

View File

@@ -67,7 +67,7 @@ main(void)
const char *src = "lib/dirs/dirstest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
/* Cleanup regardless of pass/fail — no residue under /tmp. */

View File

@@ -85,7 +85,7 @@ main(void)
const char *src = "lib/os/stattest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
char rmcmd[256];

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/time/timetest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "time_run FAIL: %s exited %d\n", src, rc);

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/encoding/hex/hextest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "hex_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/memio/memiotest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "memio_run FAIL: %s exited %d\n", src, rc);

View File

@@ -39,7 +39,7 @@ main(void)
const char *src = "lib/temp/temptest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "temp_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/getopt/getopttest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
(void)cwd;
int rc = runwait(cmd);
if (rc != 0) {

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/encoding/base32/base32_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "base32_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/encoding/base64/base64_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "base64_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/hash/adler32/adler32_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "adler32_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/hash/crc16/crc16_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "crc16_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/hash/crc32/crc32_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "crc32_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/hash/crc64/crc64_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "crc64_run FAIL: %s exited %d\n", src, rc);

View File

@@ -291,14 +291,19 @@ check_one(const char *bin, const char *cwd, const struct ent *e, int idx)
char cs[512], ws[512];
snprintf(cs, sizeof cs, "%s/c.s", td);
snprintf(ws, sizeof ws, "%s/w.s", td);
snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c %s > %s 2>/dev/null",
bin, comb, cs);
/* Fixtures are main-less @test files: -T synthesizes the entry and
* keeps the @test fns symmetrically (non-T drops them cstage-side,
* task #6, so byte-id needs -T). Import-probes carry their own
* `fn main()`, which -T loud-rejects (910), so they stay non-T. */
const char *tflag = e->fixture ? "-T " : "";
snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c %s%s > %s 2>/dev/null",
bin, tflag, comb, cs);
if (runwait(cmd) != 0) {
fprintf(stderr, "lib_byteid FAIL: %s — w6c rejected\n", label);
goto out;
}
snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c_ww -o %s %s >/dev/null 2>&1",
bin, ws, comb);
snprintf(cmd, sizeof cmd, "timeout 180 %s/w6c_ww %s-o %s %s >/dev/null 2>&1",
bin, tflag, ws, comb);
int wrc = runwait(cmd);
if (e->mode == M_WWREJECT) {

View File

@@ -38,7 +38,7 @@ main(void)
const char *src = "lib/path/pathtest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "path_run FAIL: %s exited %d\n", src, rc);

View File

@@ -47,7 +47,7 @@ main(void)
* regression of the ha:946-952 rune-advancement guard into an
* infinite loop (frees are no-ops, so OOM is the only other
* exit) — timeout converts the hang into a loud 124. */
snprintf(cmd, sizeof cmd, "timeout 180 %s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "timeout 180 %s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "regex_run FAIL: %s exited %d\n", src, rc);

View File

@@ -41,7 +41,7 @@ main(void)
const char *src = "lib/crypto/sha256/sha256_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "sha256_run FAIL: %s exited %d\n", src, rc);

View File

@@ -40,7 +40,7 @@ main(void)
const char *src = "lib/hash/siphash/siphash_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "siphash_run FAIL: %s exited %d\n", src, rc);

View File

@@ -47,7 +47,7 @@ main(void)
const char *src = "lib/bufio/bufiotest.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "bufio_run FAIL: %s exited %d\n", src, rc);

View File

@@ -43,7 +43,7 @@ main(void)
const char *src = "lib/math/random/random_test.ww";
char path[1024], cmd[2048];
snprintf(path, sizeof path, "%s/%s", cwd, src);
snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path);
snprintf(cmd, sizeof cmd, "%s/ww test %s", bin, path);
int rc = runwait(cmd);
if (rc != 0) {
fprintf(stderr, "random_run FAIL: %s exited %d\n", src, rc);