test/wcc: run the unit loops fully in process

000_smoke drops its popen ww -V leg (driver version parity moves to
949_driver_flagargs); 400_w6c feeds its sources through lex/parse/
check/cgen into open_memstream instead of spawning w6c. The five unit
binaries now hold zero subprocess calls.
This commit is contained in:
2026-08-07 23:02:47 +09:00
parent aa0f77b891
commit b2899dd8d3
2 changed files with 76 additions and 96 deletions

View File

@@ -1,10 +1,8 @@
/*
* 000_smoke — Phase 0 smoke test.
*
* Asserts:
* - libwcc symbols (newarena/amalloc/freearena, fatal/errorf/warnf)
* are linkable.
* - `ww -V` exits 0 and prints the configured version.
* Asserts arena allocation and growth through libwcc, plus the configured
* version constant. Driver behavior belongs to the driver integration tests.
*/
#include "ww.h"
#include <stdlib.h>
@@ -44,44 +42,11 @@ test_version(void)
}
}
static void
test_ww_minus_v(void)
{
const char *bin = getenv("BIN");
if (bin == NULL)
bin = "out/bin";
char cmd[512];
snprintf(cmd, sizeof cmd, "%s/ww -V", bin);
FILE *p = popen(cmd, "r");
if (p == NULL) {
fprintf(stderr, "smoke: popen %s\n", cmd);
exit(1);
}
char buf[128];
size_t n = fread(buf, 1, sizeof buf - 1, p);
buf[n] = '\0';
int rc = pclose(p);
if (rc != 0) {
fprintf(stderr, "smoke: ww -V exit %d\n", rc);
exit(1);
}
if (strstr(buf, "ww ") != buf) {
fprintf(stderr, "smoke: ww -V output not 'ww ...': %s\n", buf);
exit(1);
}
if (strstr(buf, WW_VERSION) == NULL) {
fprintf(stderr, "smoke: ww -V missing version %s in: %s\n",
WW_VERSION, buf);
exit(1);
}
}
int
main(void)
{
test_arena();
test_version();
test_ww_minus_v();
puts("smoke: ok");
return 0;
}