test: prove canonical directory package identity

This commit is contained in:
2026-08-13 02:48:17 +09:00
parent 0aff801def
commit cc6799c3b1
5 changed files with 530 additions and 149 deletions

View File

@@ -17,7 +17,7 @@ package direnum_test;
//
// rootorder — a private rootok/ dir built DIRECTLY (z.ww ORDER-Z
// value()=17 vs a.ww ORDER-A leading comment + main): build exit 0,
// the binary exits 17, and the driver's <out>.sepwork/rootok.unit.ww
// the binary exits 17, and the driver's local-identity owner unit
// stores ORDER-A strictly before ORDER-Z (byte-sorted deterministic
// source order); the two stages' units are byte-identical.
//
@@ -128,6 +128,7 @@ fn rejectpair(label: str, td: str, target: str, needle: str) void = {
"package rootok;\n// ORDER-A\n",
"fn main() i32 = { return value(); };\n"));
let drvs: []str = ["ww", "ww_ww"];
let identity: str = testenv.localpackageidentity(rootok, "rootok");
let units: []str = ["", ""];
let s: i32 = 0;
for (s < 2) {
@@ -143,7 +144,7 @@ fn rejectpair(label: str, td: str, target: str, needle: str) void = {
fail("rootorder", strings.concat(drvs[s], " exit != 17"));
};
units[s] = testenv.readfile(strings.concat(out,
".sepwork/rootok.unit.ww"));
".sepwork/", identity, ".unit.ww"));
let a: i32 = testenv.pos(units[s], "ORDER-A");
let z: i32 = testenv.pos(units[s], "ORDER-Z");
if (a < 0 || z < 0 || a >= z) {
@@ -153,7 +154,7 @@ fn rejectpair(label: str, td: str, target: str, needle: str) void = {
s += 1;
};
if (!testenv.same(units[0], units[1])) {
fail("rootorder", "C/WW rootok.unit.ww differ");
fail("rootorder", "C/WW local root units differ");
};
testenv.clean(td);
};