ww test: preserve combined product output order
Go 1.26.5 maps each test binary's stdout and stderr to the same product writer. Teach the captured executor to share one open file description for byte-equal output paths, then make directory test products emit that one ordered capture on coordinator stdout. Build captures and inherited-stdio routes remain unchanged.\n\nKeep the executor mechanism, package policy, native Cstage/WWstage proof, and normative contract together so every commit preserves the observable test-output behavior.
This commit is contained in:
@@ -83,6 +83,13 @@ fn childmode(args: []str) void = {
|
||||
if (!writeexact(os.STDERR_FILENO, "route stderr\n")) { os.exit(135); };
|
||||
os.exit(0);
|
||||
};
|
||||
if (eq(mode, "merge")) {
|
||||
if (!writeexact(os.STDOUT_FILENO, "out 1\n")) { os.exit(146); };
|
||||
if (!writeexact(os.STDERR_FILENO, "err 1\n")) { os.exit(147); };
|
||||
if (!writeexact(os.STDOUT_FILENO, "out 2\n")) { os.exit(148); };
|
||||
if (!writeexact(os.STDERR_FILENO, "err 2\n")) { os.exit(149); };
|
||||
os.exit(0);
|
||||
};
|
||||
if (eq(mode, "signal")) {
|
||||
os.kill(os.getpid(), os.SIGKILL);
|
||||
os.exit(120);
|
||||
@@ -251,6 +258,16 @@ fn main() void = {
|
||||
assert(eq(readfile(c.stdoutpath), "route stdout\n"));
|
||||
assert(eq(readfile(c.stderrpath), "route stderr\n"));
|
||||
|
||||
fillcommand(&c, self, "merge", root, "merge",
|
||||
time.second, grace);
|
||||
let mergeerr: str = c.stderrpath;
|
||||
c.stderrpath = c.stdoutpath;
|
||||
exec.run(&c, &r);
|
||||
assert(r.termination == exec.termination.EXIT && r.code == 0);
|
||||
assert(r.errno == 0 && r.cleanuperrno == 0);
|
||||
assert(eq(readfile(c.stdoutpath), "out 1\nerr 1\nout 2\nerr 2\n"));
|
||||
assert(!os.exists(mergeerr));
|
||||
|
||||
fillcommand(&c, self, "signal", root, "signal",
|
||||
time.second, grace);
|
||||
exec.run(&c, &r);
|
||||
@@ -353,6 +370,16 @@ fn main() void = {
|
||||
|| cr.errno != 0 || cr.cleanuperrno != 0) { os.exit(139); };
|
||||
if (!eq(readfile(cc.stdoutpath), "route stdout\n")) { os.exit(140); };
|
||||
if (!eq(readfile(cc.stderrpath), "route stderr\n")) { os.exit(141); };
|
||||
fillcommand(&cc, self, "merge", root, "closedmerge",
|
||||
time.second, grace);
|
||||
let closedmergeerr: str = cc.stderrpath;
|
||||
cc.stderrpath = cc.stdoutpath;
|
||||
exec.run(&cc, &cr);
|
||||
if (cr.termination != exec.termination.EXIT || cr.code != 0
|
||||
|| cr.errno != 0 || cr.cleanuperrno != 0) { os.exit(150); };
|
||||
if (!eq(readfile(cc.stdoutpath),
|
||||
"out 1\nerr 1\nout 2\nerr 2\n")) { os.exit(151); };
|
||||
if (os.exists(closedmergeerr)) { os.exit(152); };
|
||||
os.exit(0);
|
||||
};
|
||||
let closedstatus: i32 = waitchild(closedprobe);
|
||||
@@ -382,12 +409,13 @@ fn main() void = {
|
||||
let captures: []str = [
|
||||
"exit0.out", "exit0.err", "exitdesc.out", "exitdesc.err",
|
||||
"exit7.out", "exit7.err", "exit127.out", "exit127.err",
|
||||
"route.out", "route.err", "signal.out", "signal.err",
|
||||
"route.out", "route.err", "merge.out", "signal.out", "signal.err",
|
||||
"execfail.out", "execfail.err", "pastfail.out", "pastfail.err",
|
||||
"chdirfail.out", "chdirfail.err", "timeout.out", "timeout.err",
|
||||
"exists.out", "runinterrupt.out", "runinterrupt.err",
|
||||
"runinterrupt.ready",
|
||||
"closed.out", "closed.err", "interrupt.out", "interrupt.err",
|
||||
"closed.out", "closed.err", "closedmerge.out",
|
||||
"interrupt.out", "interrupt.err",
|
||||
];
|
||||
let i: i32 = 0;
|
||||
for (i < captures.len) {
|
||||
|
||||
Reference in New Issue
Block a user