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:
@@ -384,7 +384,7 @@ expand(FILE *out, const char *path, struct ImportSet *visited,
|
||||
static int
|
||||
build_one(const char *src, int entry_is_dir, const char *out,
|
||||
const char *objstem, const char *extra_includes, const char *extra_libs,
|
||||
const char *extra_libdirs)
|
||||
const char *extra_libdirs, int is_test)
|
||||
{
|
||||
const char *c6 = toolpath("WW_W6C", "w6c");
|
||||
const char *a6 = toolpath("WW_W6A", "w6a");
|
||||
@@ -478,7 +478,8 @@ build_one(const char *src, int entry_is_dir, const char *out,
|
||||
}
|
||||
|
||||
char cmd[4096];
|
||||
snprintf(cmd, sizeof cmd, "%s -o %s %s", c6, asmf, combined);
|
||||
snprintf(cmd, sizeof cmd, "%s %s-o %s %s", c6, is_test ? "-T " : "",
|
||||
asmf, combined);
|
||||
if (run(cmd) != 0) {
|
||||
fprintf(stderr, "ww: w6c failed\n");
|
||||
return 1;
|
||||
@@ -714,7 +715,7 @@ do_build(int argc, char **argv)
|
||||
} else {
|
||||
basename_no_ext(resolved, out, sizeof out);
|
||||
}
|
||||
return build_one(resolved, is_dir, out, objstem, incs, libs, libdirs);
|
||||
return build_one(resolved, is_dir, out, objstem, incs, libs, libdirs, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -739,7 +740,7 @@ do_run(int argc, char **argv)
|
||||
snprintf(tmp, sizeof tmp, "/tmp/ww_run_%d", getpid());
|
||||
/* objstem = tmp → intermediates land at /tmp/ww_run_<pid>.{s,o,
|
||||
* combined.ww}, never next to the source (T3). */
|
||||
if (build_one(resolved, is_dir, tmp, tmp, incs, libs, libdirs) != 0)
|
||||
if (build_one(resolved, is_dir, tmp, tmp, incs, libs, libdirs, 0) != 0)
|
||||
return 1;
|
||||
/* exec the built binary with any trailing argv as its argv. */
|
||||
pid_t pid = fork();
|
||||
@@ -764,21 +765,29 @@ do_run(int argc, char **argv)
|
||||
static int
|
||||
do_test(int argc, char **argv)
|
||||
{
|
||||
const char *target = (argc > 0) ? argv[0] : ".";
|
||||
const char *src = NULL;
|
||||
char libs[2048] = {0};
|
||||
char libdirs[2048] = {0};
|
||||
char incs[2048] = {0};
|
||||
char outflag[1024] = {0}; /* -o accepted+ignored: test uses the temp */
|
||||
parse_build_flags(argc, argv, incs, sizeof incs,
|
||||
libdirs, sizeof libdirs, libs, sizeof libs,
|
||||
outflag, sizeof outflag, &src);
|
||||
const char *target = src ? src : ".";
|
||||
struct stat st;
|
||||
if (stat(target, &st) != 0) {
|
||||
/* not a literal path — try module resolution and run as
|
||||
* a single test program. */
|
||||
char resolved[1024];
|
||||
int is_dir = 0;
|
||||
if (!resolve_module(target, "", resolved, sizeof resolved,
|
||||
if (!resolve_module(target, incs, resolved, sizeof resolved,
|
||||
&is_dir)) {
|
||||
fprintf(stderr, "ww test: cannot find %s\n", target);
|
||||
return 1;
|
||||
}
|
||||
char tmp[1024];
|
||||
snprintf(tmp, sizeof tmp, "/tmp/ww_test_%d", getpid());
|
||||
if (build_one(resolved, is_dir, tmp, NULL, "", "", "") != 0) return 1;
|
||||
if (build_one(resolved, is_dir, tmp, NULL, incs, "", "", 1) != 0) return 1;
|
||||
int rc = run(tmp);
|
||||
unlink(tmp);
|
||||
return rc;
|
||||
@@ -787,7 +796,7 @@ do_test(int argc, char **argv)
|
||||
/* single .ww file — build+run it. */
|
||||
char tmp[1024];
|
||||
snprintf(tmp, sizeof tmp, "/tmp/ww_test_%d", getpid());
|
||||
if (build_one(target, 0, tmp, NULL, "", "", "") != 0) return 1;
|
||||
if (build_one(target, 0, tmp, NULL, incs, "", "", 1) != 0) return 1;
|
||||
int rc = run(tmp);
|
||||
unlink(tmp);
|
||||
return rc;
|
||||
@@ -813,7 +822,7 @@ do_test(int argc, char **argv)
|
||||
snprintf(tmp, sizeof tmp, "/tmp/ww_test_%d_%d", getpid(), i);
|
||||
const char *label = strrchr(files[i], '/');
|
||||
label = label ? label + 1 : files[i];
|
||||
int rc = build_one(files[i], 0, tmp, NULL, target, "", "");
|
||||
int rc = build_one(files[i], 0, tmp, NULL, target, "", "", 1);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "FAIL %s (build)\n", label);
|
||||
fail++;
|
||||
|
||||
@@ -65,9 +65,3 @@ fn checkbuf(in: str, lo: str, up: str) void = {
|
||||
case nomem => void;
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
strfold_cases();
|
||||
strfold_buf_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -859,29 +859,3 @@ fn errsource() io.stream = {
|
||||
};
|
||||
bufio.finish(&sc);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
scanbytecases();
|
||||
scanlinecases();
|
||||
scanlineoverflow();
|
||||
scanbytescases();
|
||||
emptystream();
|
||||
errorsource();
|
||||
boundarycases();
|
||||
multifill();
|
||||
streamsmallwrite();
|
||||
streamautoflush();
|
||||
streamlineflush();
|
||||
streamflushonwrite();
|
||||
streamisbuffered();
|
||||
streamunread();
|
||||
streamscannerunread();
|
||||
streamflushempty();
|
||||
streamcloseflushes();
|
||||
streamsetflushcustom();
|
||||
scanrunecases();
|
||||
scanruneinvalid();
|
||||
newscannergrow();
|
||||
newscanneroverflow();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -810,27 +810,3 @@ fn expect_tok(toks: [][]u8, i: i32, want: []u8) void = {
|
||||
assert(!(!bytes.equal(b4, h[0:6])));
|
||||
assert(!(!bytes.equal(a4, z[0:0])));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
equal_cases();
|
||||
index_byte_cases();
|
||||
index_slice_cases();
|
||||
rindex_byte_cases();
|
||||
rindex_slice_cases();
|
||||
contains_cases();
|
||||
hasprefix_cases();
|
||||
hassuffix_cases();
|
||||
tokenize_cases();
|
||||
rtokenize_cases();
|
||||
peek_token_cases();
|
||||
remaining_tokens_cases();
|
||||
splitn_cases();
|
||||
rsplitn_cases();
|
||||
split_cases();
|
||||
ltrim_cases();
|
||||
rtrim_cases();
|
||||
trim_cases();
|
||||
cut_cases();
|
||||
rcut_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -123,13 +123,3 @@ fn check(msg: []u8, want: str) void = {
|
||||
assert(!(hash.sz(h) != 32: size));
|
||||
assert(!(hash.bsz(h) != 64: size));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
empty();
|
||||
abc();
|
||||
twoblockpad();
|
||||
millionas();
|
||||
reentrant();
|
||||
sizes();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -129,11 +129,3 @@ fn gettmpdir() str = {
|
||||
let got = dirs.state("myapp");
|
||||
assert(!(!streq(got, exp)));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_config_xdg_set();
|
||||
test_cache_xdg_relative_fallback();
|
||||
test_data_unset_fallback();
|
||||
test_state_unset_fallback();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -145,13 +145,3 @@ fn enchexvec(input: str, expect: str) void = {
|
||||
assert(!(base32.decodedsize(8) != 5));
|
||||
assert(!(base32.decodedsize(16) != 10));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
rfc4648_std();
|
||||
rfc4648_decode();
|
||||
rfc4648_hex();
|
||||
roundtrip_all_quintets();
|
||||
invalid_inputs();
|
||||
sizes();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -188,13 +188,3 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
|
||||
case let e: errors.invalid => abort();
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
rfc4648_std();
|
||||
rfc4648_url();
|
||||
urlsafe_distinct();
|
||||
decode_invalid();
|
||||
sizes();
|
||||
roundtrip_all_bytes();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -154,20 +154,3 @@ fn cafebabe() [8]u8 = {
|
||||
case let e: errors.invalid => abort();
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
encodestr_basic();
|
||||
encodestr_zero();
|
||||
encodestr_ff();
|
||||
encodestr_empty();
|
||||
encode_stream();
|
||||
decodestr_lower();
|
||||
decodestr_upper();
|
||||
decodestr_mixed();
|
||||
decodestr_empty();
|
||||
decodestr_odd();
|
||||
decodestr_bad();
|
||||
decodestr_bad_mid();
|
||||
roundtrip_all_bytes();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -614,43 +614,3 @@ fn streq(a: str, b: str) bool = {
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
runesz_ranges();
|
||||
utf8sz_classify();
|
||||
encode_ascii();
|
||||
encode_two_byte();
|
||||
encode_three_byte();
|
||||
encode_four_byte();
|
||||
decode_one_byte();
|
||||
decode_two_byte();
|
||||
decode_three_byte();
|
||||
decode_four_byte();
|
||||
decode_surrogate();
|
||||
decode_overlong();
|
||||
decode_out_of_range();
|
||||
decode_bad_continuation();
|
||||
decode_max_in_range();
|
||||
decode_truncated();
|
||||
decode_done();
|
||||
validate_mixed_ok();
|
||||
validate_malformed();
|
||||
validate_empty_ok();
|
||||
roundtrip();
|
||||
prev_done_at_start();
|
||||
prev_one_byte();
|
||||
prev_two_byte();
|
||||
prev_three_byte();
|
||||
prev_four_byte();
|
||||
prev_mixed_roundtrip();
|
||||
prev_continuation_only_more();
|
||||
prev_incomplete_invalid();
|
||||
prev_surrogate_invalid();
|
||||
prev_overlong_invalid();
|
||||
prev_extracont_invalid();
|
||||
prev_max_in_range();
|
||||
prev_min_out_of_range();
|
||||
remaining_slice_position();
|
||||
strerror_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -104,10 +104,3 @@ fn errtag(e: errors.error) int = {
|
||||
assert(!(!streq(os.strerror(os.EINVAL), "Invalid argument")));
|
||||
assert(!(!streq(os.strerror(5), "Unknown error")));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
mapping();
|
||||
opaquetail();
|
||||
strerrortext();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -631,50 +631,3 @@ fn errsource() io.stream = {
|
||||
assert(!(!streq(r, "1.5 -2.5")));
|
||||
os.free(r.ptr: *void, r.len: u64);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
fprintbarestr();
|
||||
fprintintstr();
|
||||
fprintboolrune();
|
||||
fprintempty();
|
||||
fprintlnmulti();
|
||||
fprintlnempty();
|
||||
fprintfixedshort();
|
||||
fprintclosed();
|
||||
fprintf_implicit();
|
||||
fprintf_indexed();
|
||||
fprintf_literal_braces();
|
||||
fprintf_width_right();
|
||||
fprintf_width_left();
|
||||
fprintf_width_center();
|
||||
fprintf_pad_underscore();
|
||||
fprintf_base_hex();
|
||||
fprintf_base_oct_bin();
|
||||
fprintf_prec_int();
|
||||
fprintf_prec_str_trunc();
|
||||
fprintf_sign_neg();
|
||||
fprintfln_basic();
|
||||
fprintf_closed();
|
||||
bsprintf_basic();
|
||||
fprintf_bool_rune();
|
||||
bsprintf_trunc();
|
||||
bsprintf_width_trunc();
|
||||
asprintf_basic();
|
||||
asprintf_growth();
|
||||
asprintf_empty();
|
||||
asprintf_indexed_mods();
|
||||
fprintf_f64_basic();
|
||||
fprintf_f64_int_valued();
|
||||
fprintf_f64_neg();
|
||||
fprintf_f64_zero();
|
||||
fprintf_f64_small_frac();
|
||||
fprintf_f64_huge();
|
||||
fprintf_f64_sign_plus();
|
||||
fprintf_f64_sign_space();
|
||||
fprintf_f64_width_right();
|
||||
fprintf_f64_width_left();
|
||||
fprint_f64_variadic();
|
||||
bsprintf_f64();
|
||||
asprintf_f64();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -247,15 +247,3 @@ fn check(pat: str, s: str, expected: bool, flags: i32) void = {
|
||||
let nesc: i32 = 2; // NOESCAPE
|
||||
check("a\\*.c", "a*.c", false, nesc);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
basic();
|
||||
brackets();
|
||||
ctype();
|
||||
period();
|
||||
noescape();
|
||||
musl_basic();
|
||||
pathname();
|
||||
combined();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -476,17 +476,3 @@ fn streq(a: str, b: str) bool = {
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
flagcluster();
|
||||
paramflag();
|
||||
separator();
|
||||
repeatedflag();
|
||||
baredash();
|
||||
errortable();
|
||||
strerrortext();
|
||||
nooptionsbare();
|
||||
printusage_cases();
|
||||
printhelp_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -43,12 +43,3 @@ fn check(s: str, want: u32) void = {
|
||||
check("'The central enemy of reliability is complexity.' - Geer et al",
|
||||
3170309588u32);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
vec_empty();
|
||||
vec_helloworld();
|
||||
vec_hareiscool();
|
||||
vec_bdale();
|
||||
vec_geer();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -49,12 +49,3 @@ fn check(s: str, ccitt: u16, cmda: u16, dect: u16, ansi: u16) void = {
|
||||
check("I want peace and I'm willing to fight for it. -- Harry Truman",
|
||||
0xB0E8u16, 0xFE1Fu16, 0x4659u16, 0x5062u16);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
vec_empty();
|
||||
vec_truman();
|
||||
vec_animals();
|
||||
vec_twain();
|
||||
vec_peace();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -52,13 +52,3 @@ fn check(s: str, ieee: u32, cast: u32, koop: u32) void = {
|
||||
check("GNU's not UNIX",
|
||||
224734747u32, 200511816u32, 332335539u32);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
vec_empty();
|
||||
vec_fire();
|
||||
vec_setfire();
|
||||
vec_blm();
|
||||
vec_unix();
|
||||
vec_gnu();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -55,14 +55,3 @@ fn check(s: str, ecma: u64, iso: u64) void = {
|
||||
check("Black lives matter",
|
||||
0x159BB7B6086BF47Eu64, 0xC218CBB390CF44EBu64);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
vec_empty();
|
||||
vec_oscar();
|
||||
vec_hegel();
|
||||
vec_chapelain();
|
||||
vec_unix();
|
||||
vec_gnu();
|
||||
vec_blm();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -68,10 +68,3 @@ fn putstr(s: str, into: []u8, off: i32) i32 = {
|
||||
let empty: [1]u8;
|
||||
assert(!(siphash.sum24(key[0:16], empty[0:0]) != 0x2A51AE0682925836u64));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
refkey_msgN();
|
||||
ascii();
|
||||
empty();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -238,18 +238,3 @@ fn streq(a: str, b: str) bool = {
|
||||
// can assert WEXITSTATUS == 255 without the test process itself
|
||||
// terminating. lib/os doesn't ship process spawning yet; revisit
|
||||
// when that lands.
|
||||
|
||||
export fn main() i32 = {
|
||||
defaultwiredtoglobal();
|
||||
lprintlnbasic();
|
||||
lprintlnsingle();
|
||||
lprintlnempty();
|
||||
silentwritesnothing();
|
||||
setloggerswap();
|
||||
lprintflnbasic();
|
||||
printflnglobal();
|
||||
silentignoresprintfln();
|
||||
lprintflnindexed();
|
||||
lprintflnmods();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -383,52 +383,3 @@ import types;
|
||||
assert(!(types.U64_MIN != 0u64));
|
||||
assert(!(types.RUNE_MIN != '\0'));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_addi8();
|
||||
test_addi16();
|
||||
test_addi32();
|
||||
test_addi64();
|
||||
test_addu8();
|
||||
test_addu16();
|
||||
test_addu32();
|
||||
test_addu64();
|
||||
test_subi8();
|
||||
test_subi16();
|
||||
test_subi32();
|
||||
test_subi64();
|
||||
test_subu8();
|
||||
test_subu16();
|
||||
test_subu32();
|
||||
test_subu64();
|
||||
test_muli8();
|
||||
test_muli16();
|
||||
test_muli32();
|
||||
test_mulu8();
|
||||
test_mulu16();
|
||||
test_mulu32();
|
||||
test_sat_addi8();
|
||||
test_sat_addi16();
|
||||
test_sat_addi32();
|
||||
test_sat_addi64();
|
||||
test_sat_addu8();
|
||||
test_sat_addu16();
|
||||
test_sat_addu32();
|
||||
test_sat_addu64();
|
||||
test_sat_subi8();
|
||||
test_sat_subi16();
|
||||
test_sat_subi32();
|
||||
test_sat_subi64();
|
||||
test_sat_subu8();
|
||||
test_sat_subu16();
|
||||
test_sat_subu32();
|
||||
test_sat_subu64();
|
||||
test_sat_muli8();
|
||||
test_sat_muli16();
|
||||
test_sat_muli32();
|
||||
test_sat_mulu8();
|
||||
test_sat_mulu16();
|
||||
test_sat_mulu32();
|
||||
test_types_min();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -52,12 +52,3 @@ import random;
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
seq();
|
||||
deterministic();
|
||||
u32n_inrange();
|
||||
u64n_pow2();
|
||||
u64n_nonpow2();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -524,17 +524,3 @@ fn putstr(s: str, into: []u8, off: i32) i32 = {
|
||||
let c: (void | io.error) = io.close(s);
|
||||
match (c) { case void => {}; case let e: io.error => abort(); };
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
fixedread();
|
||||
fixedwritecases();
|
||||
dynamicgrowcases();
|
||||
dynamicreset();
|
||||
borrowedreadcases();
|
||||
stringview();
|
||||
dynamicfromseed();
|
||||
seekcases();
|
||||
emptyseek();
|
||||
dynamicseek();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -106,12 +106,3 @@ fn streq(a: str, b: str) bool = {
|
||||
assert(!(p[4095] != 165u8));
|
||||
os.free(p.ptr: *void, 4096u64);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_getenv_set();
|
||||
test_getenv_empty();
|
||||
test_getenv_unset();
|
||||
test_getenv_prefix_no_match();
|
||||
test_alloc_free_roundtrip();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -204,18 +204,3 @@ fn makebig(n: i32) str = {
|
||||
let bp = makebig(os.PATH_MAX);
|
||||
assert(!(os.exists(bp)));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_stat_regfile();
|
||||
test_stat_subdir();
|
||||
test_stat_noent();
|
||||
test_stat_symlink_follow();
|
||||
test_lstat_symlink_nofollow();
|
||||
test_fstat_regfile();
|
||||
test_exists_regfile();
|
||||
test_exists_subdir();
|
||||
test_exists_noent();
|
||||
test_stat_toolong();
|
||||
test_exists_toolong();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -267,15 +267,3 @@ import path;
|
||||
assert(!(pop(&buf) as str != "foo"));
|
||||
assert(!(string(&buf) != "/"));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
push_cases();
|
||||
isroot_cases();
|
||||
string_cases();
|
||||
dirname_basename_cases();
|
||||
abs_cases();
|
||||
local_cases();
|
||||
parent_cases();
|
||||
popsplit_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -2568,55 +2568,3 @@ type prrow = struct {
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
lit_and_match();
|
||||
size_aliases_distinct();
|
||||
void_aliases_distinct();
|
||||
charset_payload();
|
||||
repeat_payload();
|
||||
struct_shapes_and_finish();
|
||||
compile_literal_program();
|
||||
compile_any_program();
|
||||
compile_empty_program();
|
||||
thread_shape();
|
||||
newmatch_discriminates();
|
||||
result_free_noop();
|
||||
strerror_identity();
|
||||
is_consuming_kinds();
|
||||
delete_thread_middle();
|
||||
add_thread_dedup_inherit();
|
||||
run_thread_literal_program();
|
||||
run_thread_anchored_route();
|
||||
search_matches();
|
||||
search_early_exit();
|
||||
search_no_match();
|
||||
test_matches();
|
||||
find_cases();
|
||||
findall_content();
|
||||
findall_fields();
|
||||
fold3_programs();
|
||||
fold3_compile_errors();
|
||||
find_last_groupstart_cases();
|
||||
shift_direct();
|
||||
fold3_find_cases();
|
||||
fold4_programs();
|
||||
fold4_charsets();
|
||||
fold4_compile_errors();
|
||||
fold4_find_cases();
|
||||
fold4_findall();
|
||||
add_thread_dup_independence();
|
||||
fold5_compile_errors();
|
||||
run_thread_group_arms();
|
||||
fold5_find_cases();
|
||||
fold5_optional_group();
|
||||
fold5_submatches();
|
||||
parse_repetition_cases();
|
||||
fold5b_compile_errors();
|
||||
fold5b_find_cases();
|
||||
fold5b_findall();
|
||||
fold6_compile_errors();
|
||||
fold6_charsets();
|
||||
fold6_find_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -178,11 +178,3 @@ fn checkquote(in: str, expected: str) void = {
|
||||
let s: str = shlex.strerror(e);
|
||||
assert(!(!streq(s, "Invalid shell syntax")));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_split();
|
||||
test_quote();
|
||||
test_quotestr();
|
||||
test_strerror();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -174,16 +174,3 @@ fn chkf32(n: f32, want: str) bool = {
|
||||
assert(!(!rt64(math.f64frombits(0x0010000000000000u64)))); // F64_MIN_NORMAL
|
||||
assert(!(!rt64(math.f64frombits(0x7FEFFFFFFFFFFFFFu64)))); // F64_MAX_NORMAL
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
f64tos_fixed();
|
||||
f64tos_scientific();
|
||||
f64tos_special();
|
||||
f32tos_fixed();
|
||||
f32tos_scientific();
|
||||
f32tos_extremes();
|
||||
f32tos_special();
|
||||
f64_roundtrip();
|
||||
os.exit(0);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -296,17 +296,3 @@ fn cks(id: i32, got: str, want: str) void = {
|
||||
cks(99, i32tos(-2147483648i32, base.DEC), "-2147483648");
|
||||
cks(100, u8tos(255u8, base.HEX_LOWER), "ff");
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
test_stoi64();
|
||||
test_stoi64_bases();
|
||||
test_stou64();
|
||||
test_stou64_bases();
|
||||
test_stoi_stou_stoz();
|
||||
test_u64tos_bases();
|
||||
test_u64tos();
|
||||
test_i64tos_bases();
|
||||
test_i64tos();
|
||||
test_word_wrappers();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -225,11 +225,3 @@ fn nan32(s: str) bool = {
|
||||
assert(!(!ovf32("1.0p+128", base.HEX)));
|
||||
assert(!(!chk32("1.0p-151", base.HEX, 0.0f32)));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
stof64_dec();
|
||||
stof32_dec();
|
||||
stof64_hex();
|
||||
stof32_hex();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -1671,52 +1671,3 @@ fn expect_str(toks: []str, i: i32, want: str) void = {
|
||||
assert(!(!streq(a7, "abc")));
|
||||
assert(!(!streq(b7, "")));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
dup_cases();
|
||||
dupall_cases();
|
||||
concat_cases();
|
||||
join_cases();
|
||||
hasprefix_cases();
|
||||
hassuffix_cases();
|
||||
contains_cases();
|
||||
byteindex_str_cases();
|
||||
byteindex_rune_cases();
|
||||
rbyteindex_cases();
|
||||
index_cases();
|
||||
rindex_cases();
|
||||
trimprefix_cases();
|
||||
trimsuffix_cases();
|
||||
ltrim_cases();
|
||||
rtrim_cases();
|
||||
trim_cases();
|
||||
compare_cases();
|
||||
sub_cases();
|
||||
bytesub_cases();
|
||||
utf8_roundtrip_cases();
|
||||
iter_empty_cases();
|
||||
iter_ascii_cases();
|
||||
iter_twobyte_cases();
|
||||
iter_threebyte_cases();
|
||||
iter_fourbyte_cases();
|
||||
iter_mixed_cases();
|
||||
iter_prev_at_start_cases();
|
||||
iter_prev_ascii_cases();
|
||||
iter_full_cases();
|
||||
iter_position_cases();
|
||||
iter_iterstr_reverse_cases();
|
||||
iter_slice_cases();
|
||||
tokenize_cases();
|
||||
rtokenize_cases();
|
||||
peek_token_cases();
|
||||
remaining_tokens_cases();
|
||||
splitn_cases();
|
||||
rsplitn_cases();
|
||||
split_cases();
|
||||
lpad_cases();
|
||||
rpad_cases();
|
||||
replace_cases();
|
||||
cut_cases();
|
||||
rcut_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -246,11 +246,3 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
|
||||
assert(!(os.rmdir(d2) != 0));
|
||||
assert(!(os.rmdir(dsnap) != 0));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
namedroundtrip();
|
||||
namedoverwrite();
|
||||
dirlifecycle();
|
||||
diruniqueness();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -157,22 +157,3 @@ import time;
|
||||
assert(!(time.compare(a, b) != -1i8));
|
||||
assert(!(time.compare(b, a) != 1i8));
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
constants();
|
||||
nowmonotonic();
|
||||
nowrealtime();
|
||||
addzero();
|
||||
addpos_nocarry();
|
||||
addpos_carry();
|
||||
addpos_fullsecond();
|
||||
addneg_noborrow();
|
||||
addneg_borrow();
|
||||
diffsimple();
|
||||
diffneg();
|
||||
comparelt();
|
||||
comparegt();
|
||||
compareeq();
|
||||
comparensec_only();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -100,8 +100,3 @@ fn checkname(k: nkind, want: str) void = {
|
||||
// named value (68); 69 is out of band, exercising the "?" tail.
|
||||
checkname(69: nkind, "?");
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
nkname_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -307,11 +307,3 @@ fn checkfloat(src: str, want: u64) void = {
|
||||
checkfloat("1.0e308", 0x7FE1CCF385EBC8A0u64);
|
||||
checkfloat("2.225073858507202e-308", 0x0010000000000001u64);
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
tokname_cases();
|
||||
kwlookup_cases();
|
||||
tokprint_cases();
|
||||
floatfold_cases();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -3614,7 +3614,7 @@ type lflags = struct {
|
||||
// touches no C-built code at runtime. The C `ww` driver in cmd/ww/
|
||||
// still drives the C-built w6c/w6a/w6l. Test 993 pins the two
|
||||
// pipelines to byte-identical output on a corpus.
|
||||
fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, incs: *u8, lf: *lflags) i32 = {
|
||||
fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, incs: *u8, lf: *lflags, istest: i32) i32 = {
|
||||
let c6: *u8 = joinpathlit(selfdir, "w6c_ww");
|
||||
let a6: *u8 = joinpathlit(selfdir, "w6a_ww");
|
||||
let l6: *u8 = joinpathlit(selfdir, "w6l_ww");
|
||||
@@ -3729,15 +3729,17 @@ fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, inc
|
||||
};
|
||||
os.close(cf);
|
||||
|
||||
// Step 2: w6c -o <stem>.s <stem>.combined.ww
|
||||
// Step 2: w6c [-T] -o <stem>.s <stem>.combined.ww
|
||||
{
|
||||
let argv: []*u8 = alloc([], 5u64)!;
|
||||
argv.len = 5;
|
||||
argv[0] = "w6c\0".ptr;
|
||||
argv[1] = "-o\0".ptr;
|
||||
argv[2] = asmf;
|
||||
argv[3] = combined;
|
||||
argv[4] = nil;
|
||||
let argv: []*u8 = alloc([], 6u64)!;
|
||||
let p: i32 = 0;
|
||||
argv[p] = "w6c\0".ptr; p += 1;
|
||||
if (istest != 0) { argv[p] = "-T\0".ptr; p += 1; };
|
||||
argv[p] = "-o\0".ptr; p += 1;
|
||||
argv[p] = asmf; p += 1;
|
||||
argv[p] = combined; p += 1;
|
||||
argv[p] = nil; p += 1;
|
||||
argv.len = p;
|
||||
if (procrun(c6, argv.ptr) != 0) {
|
||||
cerr("ww: w6c failed\n");
|
||||
return 1;
|
||||
@@ -4079,7 +4081,7 @@ fn dobuild(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
lf.nlibdirs = nlibdirs;
|
||||
lf.libs = libs.ptr;
|
||||
lf.nlibs = nlibs;
|
||||
return buildone(selfdir, resolved, isdir, out, objstem, incs.ptr, &lf);
|
||||
return buildone(selfdir, resolved, isdir, out, objstem, incs.ptr, &lf, 0i32);
|
||||
};
|
||||
|
||||
// Format the scratch path /tmp/ww_run_<pid> into buf. Returns NUL-
|
||||
@@ -4235,7 +4237,7 @@ fn dorun(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
lf.nlibs = nlibs;
|
||||
// objstem = tmp → intermediates at /tmp/ww_run_<pid>.{s,o,combined.ww},
|
||||
// never next to the source (T3).
|
||||
if (buildone(selfdir, resolved, isdir, tmp.ptr, tmp.ptr, incs.ptr, &lf) != 0) {
|
||||
if (buildone(selfdir, resolved, isdir, tmp.ptr, tmp.ptr, incs.ptr, &lf, 0i32) != 0) {
|
||||
os.remove(pathstr(tmp.ptr));
|
||||
return 1;
|
||||
};
|
||||
@@ -4265,11 +4267,11 @@ fn dorun(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
// directory: open the dir, getdents64, build+run each *_test.ww,
|
||||
// report ok/FAIL per file, return 0 iff all pass.
|
||||
|
||||
fn runsingletest(selfdir: *u8, src: *u8) i32 = {
|
||||
fn runsingletest(selfdir: *u8, src: *u8, incs: *u8) i32 = {
|
||||
let tmp: []u8 = alloc([], (os.PATH_MAX: u64))!;
|
||||
tmp.len = os.PATH_MAX;
|
||||
makeruntmp(tmp.ptr);
|
||||
if (buildone(selfdir, src, 0, tmp.ptr, nil, "\0".ptr, nil) != 0) {
|
||||
if (buildone(selfdir, src, 0, tmp.ptr, nil, incs, nil, 1i32) != 0) {
|
||||
os.remove(pathstr(tmp.ptr));
|
||||
return 1;
|
||||
};
|
||||
@@ -4324,7 +4326,7 @@ fn rundirtests(selfdir: *u8, dir: *u8) i32 = {
|
||||
let tmp: []u8 = alloc([], (os.PATH_MAX: u64))!;
|
||||
tmp.len = os.PATH_MAX;
|
||||
makeruntmp(tmp.ptr);
|
||||
let bres: i32 = buildone(selfdir, path.ptr, 0, tmp.ptr, nil, tincs.ptr, nil);
|
||||
let bres: i32 = buildone(selfdir, path.ptr, 0, tmp.ptr, nil, tincs.ptr, nil, 1i32);
|
||||
if (bres != 0) {
|
||||
fail += 1;
|
||||
cerr("FAIL ");
|
||||
@@ -4360,18 +4362,55 @@ fn rundirtests(selfdir: *u8, dir: *u8) i32 = {
|
||||
};
|
||||
|
||||
fn dotest(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
let target: *u8;
|
||||
if (start >= argc) {
|
||||
// -I parsing mirrors dobuild/dorun so a single-file test can resolve
|
||||
// transitive imports (e.g. 905_nkname asttest → tok); coupled to the
|
||||
// -T flip (task #5/#10).
|
||||
let target: *u8 = nil;
|
||||
let incs: []u8 = alloc([], (os.PATH_MAX: u64) * 2u64)!;
|
||||
incs.len = ((os.PATH_MAX: u64) * 2u64): i32;
|
||||
let incoff: u64 = 0u64;
|
||||
cstrseal(incs.ptr, 0u64);
|
||||
|
||||
let i: i32 = start;
|
||||
for (i < argc) {
|
||||
let p: *u8 = argv[i];
|
||||
if (p[0u64] == 45u8) { // '-'
|
||||
if (p[1u64] == 73u8) { // '-I'
|
||||
let dir: *u8 = nil;
|
||||
if (p[2u64] != 0u8) {
|
||||
dir = p + 2u64;
|
||||
} else {
|
||||
if (i + 1 >= argc) {
|
||||
cerr("ww test: -I needs an argument\n");
|
||||
return 2;
|
||||
};
|
||||
i += 1;
|
||||
dir = argv[i];
|
||||
};
|
||||
if (incoff > 0u64) {
|
||||
incs[incoff] = 58u8; // ':'
|
||||
incoff += 1u64;
|
||||
};
|
||||
incoff = cstrinto(incs.ptr, incoff, dir);
|
||||
cstrseal(incs.ptr, incoff);
|
||||
} else {
|
||||
cerr("ww test: unknown flag\n");
|
||||
return 2;
|
||||
};
|
||||
} else {
|
||||
if (target == nil) { target = p; };
|
||||
};
|
||||
i += 1;
|
||||
};
|
||||
if (target == nil) {
|
||||
let dot: [2]u8 = ['.': u8, 0u8];
|
||||
target = &dot[0];
|
||||
} else {
|
||||
target = argv[start];
|
||||
};
|
||||
|
||||
// single-file mode: literal *.ww that exists
|
||||
if (cstrendswithlit(target, ".ww")) {
|
||||
if (os.access(pathstr(target), 0i32) == 0) {
|
||||
return runsingletest(selfdir, target);
|
||||
return runsingletest(selfdir, target, incs.ptr);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -828,7 +828,7 @@ type lflags = struct {
|
||||
// touches no C-built code at runtime. The C `ww` driver in cmd/ww/
|
||||
// still drives the C-built w6c/w6a/w6l. Test 993 pins the two
|
||||
// pipelines to byte-identical output on a corpus.
|
||||
fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, incs: *u8, lf: *lflags) i32 = {
|
||||
fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, incs: *u8, lf: *lflags, istest: i32) i32 = {
|
||||
let c6: *u8 = joinpathlit(selfdir, "w6c_ww");
|
||||
let a6: *u8 = joinpathlit(selfdir, "w6a_ww");
|
||||
let l6: *u8 = joinpathlit(selfdir, "w6l_ww");
|
||||
@@ -943,15 +943,17 @@ fn buildone(selfdir: *u8, src: *u8, entryisdir: i32, out: *u8, objstem: *u8, inc
|
||||
};
|
||||
os.close(cf);
|
||||
|
||||
// Step 2: w6c -o <stem>.s <stem>.combined.ww
|
||||
// Step 2: w6c [-T] -o <stem>.s <stem>.combined.ww
|
||||
{
|
||||
let argv: []*u8 = alloc([], 5u64)!;
|
||||
argv.len = 5;
|
||||
argv[0] = "w6c\0".ptr;
|
||||
argv[1] = "-o\0".ptr;
|
||||
argv[2] = asmf;
|
||||
argv[3] = combined;
|
||||
argv[4] = nil;
|
||||
let argv: []*u8 = alloc([], 6u64)!;
|
||||
let p: i32 = 0;
|
||||
argv[p] = "w6c\0".ptr; p += 1;
|
||||
if (istest != 0) { argv[p] = "-T\0".ptr; p += 1; };
|
||||
argv[p] = "-o\0".ptr; p += 1;
|
||||
argv[p] = asmf; p += 1;
|
||||
argv[p] = combined; p += 1;
|
||||
argv[p] = nil; p += 1;
|
||||
argv.len = p;
|
||||
if (procrun(c6, argv.ptr) != 0) {
|
||||
cerr("ww: w6c failed\n");
|
||||
return 1;
|
||||
@@ -1293,7 +1295,7 @@ fn dobuild(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
lf.nlibdirs = nlibdirs;
|
||||
lf.libs = libs.ptr;
|
||||
lf.nlibs = nlibs;
|
||||
return buildone(selfdir, resolved, isdir, out, objstem, incs.ptr, &lf);
|
||||
return buildone(selfdir, resolved, isdir, out, objstem, incs.ptr, &lf, 0i32);
|
||||
};
|
||||
|
||||
// Format the scratch path /tmp/ww_run_<pid> into buf. Returns NUL-
|
||||
@@ -1449,7 +1451,7 @@ fn dorun(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
lf.nlibs = nlibs;
|
||||
// objstem = tmp → intermediates at /tmp/ww_run_<pid>.{s,o,combined.ww},
|
||||
// never next to the source (T3).
|
||||
if (buildone(selfdir, resolved, isdir, tmp.ptr, tmp.ptr, incs.ptr, &lf) != 0) {
|
||||
if (buildone(selfdir, resolved, isdir, tmp.ptr, tmp.ptr, incs.ptr, &lf, 0i32) != 0) {
|
||||
os.remove(pathstr(tmp.ptr));
|
||||
return 1;
|
||||
};
|
||||
@@ -1479,11 +1481,11 @@ fn dorun(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
// directory: open the dir, getdents64, build+run each *_test.ww,
|
||||
// report ok/FAIL per file, return 0 iff all pass.
|
||||
|
||||
fn runsingletest(selfdir: *u8, src: *u8) i32 = {
|
||||
fn runsingletest(selfdir: *u8, src: *u8, incs: *u8) i32 = {
|
||||
let tmp: []u8 = alloc([], (os.PATH_MAX: u64))!;
|
||||
tmp.len = os.PATH_MAX;
|
||||
makeruntmp(tmp.ptr);
|
||||
if (buildone(selfdir, src, 0, tmp.ptr, nil, "\0".ptr, nil) != 0) {
|
||||
if (buildone(selfdir, src, 0, tmp.ptr, nil, incs, nil, 1i32) != 0) {
|
||||
os.remove(pathstr(tmp.ptr));
|
||||
return 1;
|
||||
};
|
||||
@@ -1538,7 +1540,7 @@ fn rundirtests(selfdir: *u8, dir: *u8) i32 = {
|
||||
let tmp: []u8 = alloc([], (os.PATH_MAX: u64))!;
|
||||
tmp.len = os.PATH_MAX;
|
||||
makeruntmp(tmp.ptr);
|
||||
let bres: i32 = buildone(selfdir, path.ptr, 0, tmp.ptr, nil, tincs.ptr, nil);
|
||||
let bres: i32 = buildone(selfdir, path.ptr, 0, tmp.ptr, nil, tincs.ptr, nil, 1i32);
|
||||
if (bres != 0) {
|
||||
fail += 1;
|
||||
cerr("FAIL ");
|
||||
@@ -1574,18 +1576,55 @@ fn rundirtests(selfdir: *u8, dir: *u8) i32 = {
|
||||
};
|
||||
|
||||
fn dotest(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
|
||||
let target: *u8;
|
||||
if (start >= argc) {
|
||||
// -I parsing mirrors dobuild/dorun so a single-file test can resolve
|
||||
// transitive imports (e.g. 905_nkname asttest → tok); coupled to the
|
||||
// -T flip (task #5/#10).
|
||||
let target: *u8 = nil;
|
||||
let incs: []u8 = alloc([], (os.PATH_MAX: u64) * 2u64)!;
|
||||
incs.len = ((os.PATH_MAX: u64) * 2u64): i32;
|
||||
let incoff: u64 = 0u64;
|
||||
cstrseal(incs.ptr, 0u64);
|
||||
|
||||
let i: i32 = start;
|
||||
for (i < argc) {
|
||||
let p: *u8 = argv[i];
|
||||
if (p[0u64] == 45u8) { // '-'
|
||||
if (p[1u64] == 73u8) { // '-I'
|
||||
let dir: *u8 = nil;
|
||||
if (p[2u64] != 0u8) {
|
||||
dir = p + 2u64;
|
||||
} else {
|
||||
if (i + 1 >= argc) {
|
||||
cerr("ww test: -I needs an argument\n");
|
||||
return 2;
|
||||
};
|
||||
i += 1;
|
||||
dir = argv[i];
|
||||
};
|
||||
if (incoff > 0u64) {
|
||||
incs[incoff] = 58u8; // ':'
|
||||
incoff += 1u64;
|
||||
};
|
||||
incoff = cstrinto(incs.ptr, incoff, dir);
|
||||
cstrseal(incs.ptr, incoff);
|
||||
} else {
|
||||
cerr("ww test: unknown flag\n");
|
||||
return 2;
|
||||
};
|
||||
} else {
|
||||
if (target == nil) { target = p; };
|
||||
};
|
||||
i += 1;
|
||||
};
|
||||
if (target == nil) {
|
||||
let dot: [2]u8 = ['.': u8, 0u8];
|
||||
target = &dot[0];
|
||||
} else {
|
||||
target = argv[start];
|
||||
};
|
||||
|
||||
// single-file mode: literal *.ww that exists
|
||||
if (cstrendswithlit(target, ".ww")) {
|
||||
if (os.access(pathstr(target), 0i32) == 0) {
|
||||
return runsingletest(selfdir, target);
|
||||
return runsingletest(selfdir, target, incs.ptr);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user