wwtest: native package-test coordinator
Single-directory package-test planner: discovers *.ww, groups white-box and external <pkg>_test sources, composes the combined test package, builds it through the sibling ww driver, and runs it with the runtime's -package/-list/-timeout-ms contract. test/package holds its E2E corpus and the manual runtime fixture set.
This commit is contained in:
5
test/package/cases/assert_failure/assert_failure_test.ww
Normal file
5
test/package/cases/assert_failure/assert_failure_test.ww
Normal file
@@ -0,0 +1,5 @@
|
||||
package assert_failure_test;
|
||||
|
||||
@test fn assertion_failure() void = {
|
||||
assert(false, "synthetic assertion failure");
|
||||
};
|
||||
25
test/package/cases/descendant/descendant_test.ww
Normal file
25
test/package/cases/descendant/descendant_test.ww
Normal file
@@ -0,0 +1,25 @@
|
||||
package descendant_test;
|
||||
|
||||
import os;
|
||||
|
||||
@test fn normal_return_clears_descendant() void = {
|
||||
let ready: [2]i32;
|
||||
assert(os.pipe(&ready) == 0);
|
||||
let pid: i32 = os.fork();
|
||||
assert(pid >= 0);
|
||||
if (pid == 0) {
|
||||
os.close(ready[0]);
|
||||
let mask: u64 = 1u64 << ((os.SIGTERM - 1): u64);
|
||||
if (os.sigprocmask(os.SIG_BLOCK, &mask, nil: *u64) != 0) {
|
||||
os.exit(120);
|
||||
};
|
||||
let b: [1]u8 = [1u8];
|
||||
if (os.write(ready[1], &b[0], 1u64) != 1i64) { os.exit(121); };
|
||||
os.close(ready[1]);
|
||||
for (true) { };
|
||||
};
|
||||
os.close(ready[1]);
|
||||
let b: [1]u8;
|
||||
assert(os.read(ready[0], &b[0], 1u64) == 1i64);
|
||||
os.close(ready[0]);
|
||||
};
|
||||
5
test/package/cases/multi_fail/multi_fail_test.ww
Normal file
5
test/package/cases/multi_fail/multi_fail_test.ww
Normal file
@@ -0,0 +1,5 @@
|
||||
package multi_fail_test;
|
||||
|
||||
@test fn first_failure() void = { assert(false); };
|
||||
@test fn second_failure() void = { assert(false); };
|
||||
@test fn continuation_after_failures() void = { assert(true); };
|
||||
5
test/package/cases/nonzero/nonzero_test.ww
Normal file
5
test/package/cases/nonzero/nonzero_test.ww
Normal file
@@ -0,0 +1,5 @@
|
||||
package nonzero_test;
|
||||
|
||||
import os;
|
||||
|
||||
@test fn deliberate_nonzero_exit() void = { os.exit(7); };
|
||||
18
test/package/cases/pass/pass_test.ww
Normal file
18
test/package/cases/pass/pass_test.ww
Normal file
@@ -0,0 +1,18 @@
|
||||
package pass_test;
|
||||
|
||||
import test;
|
||||
|
||||
@test fn alpha_pass() void = {
|
||||
assert(test.current() == "pass_test.alpha_pass");
|
||||
};
|
||||
|
||||
@test fn beta_skip() void = {
|
||||
test.skip("synthetic unavailable feature");
|
||||
};
|
||||
|
||||
@test fn gamma_expected_abort() void = {
|
||||
test.expectabort();
|
||||
abort();
|
||||
};
|
||||
|
||||
@test fn delta_pass() void = { assert(6 * 7 == 42); };
|
||||
5
test/package/cases/premature/premature_test.ww
Normal file
5
test/package/cases/premature/premature_test.ww
Normal file
@@ -0,0 +1,5 @@
|
||||
package premature_test;
|
||||
|
||||
import os;
|
||||
|
||||
@test fn clean_exit_without_completion() void = { os.exit(0); };
|
||||
7
test/package/cases/signal/signal_test.ww
Normal file
7
test/package/cases/signal/signal_test.ww
Normal file
@@ -0,0 +1,7 @@
|
||||
package signal_test;
|
||||
|
||||
import os;
|
||||
|
||||
@test fn signal_is_not_exit() void = {
|
||||
os.kill(os.getpid(), os.SIGTERM);
|
||||
};
|
||||
16
test/package/cases/timeout/timeout_test.ww
Normal file
16
test/package/cases/timeout/timeout_test.ww
Normal file
@@ -0,0 +1,16 @@
|
||||
package timeout_test;
|
||||
|
||||
import os;
|
||||
|
||||
@test fn timeout_clears_term_resistant_descendant() void = {
|
||||
let pid: i32 = os.fork();
|
||||
assert(pid >= 0);
|
||||
if (pid == 0) {
|
||||
let mask: u64 = 1u64 << ((os.SIGTERM - 1): u64);
|
||||
if (os.sigprocmask(os.SIG_BLOCK, &mask, nil: *u64) != 0) {
|
||||
os.exit(120);
|
||||
};
|
||||
for (true) { };
|
||||
};
|
||||
for (true) { };
|
||||
};
|
||||
Reference in New Issue
Block a user