test: fork-per-test runtime
Each @test forks into its own process group with a nonblocking control pipe carrying framed ready/complete/skip/expect-abort records; timeouts escalate SIGTERM then SIGKILL over the group. New exports skip, expectabort, current; new flags -list, -timeout-ms=, -package=. A clean exit without a completion frame is a harness error, and the exit code is 0/1 with a discovered/selected/started/completed accounting line. toktest drops its fixed /tmp path for temp.named so parallel invocations cannot collide.
This commit is contained in:
@@ -23,6 +23,7 @@ package main;
|
||||
|
||||
import os;
|
||||
import syntax;
|
||||
import temp;
|
||||
|
||||
|
||||
fn checkname(k: tkind, want: str) void = {
|
||||
@@ -228,8 +229,12 @@ fn checkprint(fd: i32, t: *tok, want: str) void = {
|
||||
// every fputq escape: \\ " \n \t \r, a c<0x20 byte (0x01), c==0x7f,
|
||||
// and a printable ('A'). `want` spells the exact emitted line.
|
||||
@test fn tokprint_cases() void = {
|
||||
let flags: os.flag = os.flag.RDWR | os.flag.CREATE | os.flag.TRUNC;
|
||||
let fd: i32 = os.open("/tmp/ww_s9_tok.tmp", flags, 384i32);
|
||||
let fd: i32 = 0;
|
||||
let path: str;
|
||||
match (temp.named(&fd, &path, "/tmp", temp.mode.RDWR, 384i32)) {
|
||||
case void => {};
|
||||
case let e: os.oserror => abort();
|
||||
};
|
||||
assert(!(fd < 0));
|
||||
|
||||
let t: tok;
|
||||
@@ -262,7 +267,7 @@ fn checkprint(fd: i32, t: *tok, want: str) void = {
|
||||
checkprint(fd, &t, "t:1:1 <none>\n");
|
||||
|
||||
assert(!(os.close(fd) != 0));
|
||||
assert(!(os.remove("/tmp/ww_s9_tok.tmp") != 0));
|
||||
assert(!(os.remove(path) != 0));
|
||||
};
|
||||
|
||||
fn checkfloat(src: str, want: u64) void = {
|
||||
|
||||
Reference in New Issue
Block a user