test: follow canonical directory root artifacts

This commit is contained in:
2026-08-13 00:59:59 +09:00
parent 22ee8f5ae6
commit 853090174b
3 changed files with 34 additions and 34 deletions

View File

@@ -100,11 +100,11 @@ fn samefile(a: str, b: str, why: str) void = {
let wantroot: str = strings.concat("//ww:module-reset main\n", appsrc,
"\n");
if (!testenv.same(wantroot, testenv.readfile(strings.concat(cwork,
"__root.unit.ww")))) {
"main.unit.ww")))) {
fail("root unit is not exactly its owned source");
};
let keys: []str = ["example.base", "example.bar", "example.foo",
"__root"];
"main"];
let suffixes: []str = [".unit.ww", ".wwi", ".a"];
i = 0;
for (i < keys.len) {

View File

@@ -289,8 +289,8 @@ fn rejectstable(dir: str, label: str, target: str, needle: str) void = {
let expectedunit: str = strings.concat("//ww:module-reset main\n",
mainsrc, "\n");
if (!testenv.same(expectedunit, testenv.readfile(strings.concat(cwork,
"__root.unit.ww"))) || !testenv.same(expectedunit,
testenv.readfile(strings.concat(wwork, "__root.unit.ww")))) {
"main.unit.ww"))) || !testenv.same(expectedunit,
testenv.readfile(strings.concat(wwork, "main.unit.ww")))) {
fail("self-contained", "consumer unit was not exactly its owned source");
};
if (!testenv.exists(strings.concat(cwork, "implementation.a"))
@@ -404,7 +404,7 @@ fn writediamond(td: str, reverse: bool) str = {
fail("diamond", "shared package was not interned exactly once");
};
let unit: str = testenv.readfile(strings.concat(scratch,
"__root.unit.ww"));
"main.unit.ww"));
let rootbody: str = testenv.readfile(strings.concat(main, "/main.ww"));
let wantroot: str = strings.concat("//ww:module-reset main\n", rootbody,
"\n");
@@ -446,8 +446,8 @@ fn writediamond(td: str, reverse: bool) str = {
let firstscratch: str = strings.concat(firstout, ".sepwork/");
let shuffledscratch: str = strings.concat(shuffledout, ".sepwork/");
if (!testenv.same(testenv.readfile(strings.concat(firstscratch,
"__root.unit.ww")), testenv.readfile(strings.concat(shuffledscratch,
"__root.unit.ww"))) || !testenv.same(testenv.readfile(strings.concat(
"main.unit.ww")), testenv.readfile(strings.concat(shuffledscratch,
"main.unit.ww"))) || !testenv.same(testenv.readfile(strings.concat(
firstscratch, "shared.unit.ww")), testenv.readfile(strings.concat(
shuffledscratch, "shared.unit.ww")))) {
fail("diamond", "shuffled enumeration changed package units");
@@ -567,7 +567,7 @@ fn writediamond(td: str, reverse: bool) str = {
};
let rootunit: str = testenv.readfile(strings.concat(work,
"__root.unit.ww"));
"main.unit.ww"));
let depunit: str = testenv.readfile(strings.concat(work,
"dep.unit.ww"));
if (!testenv.has(rootunit, "//ww:module-reset main\npackage main;")
@@ -580,9 +580,9 @@ fn writediamond(td: str, reverse: bool) str = {
|| !testenv.exists(strings.concat(work, "leaf.a"))
|| !testenv.exists(strings.concat(work, "dep.wwi"))
|| !testenv.exists(strings.concat(work, "dep.a"))
|| !testenv.exists(strings.concat(work, "__root.o"))
|| !testenv.exists(strings.concat(work, "__root.wwi"))
|| !testenv.exists(strings.concat(work, "__root.a"))) {
|| !testenv.exists(strings.concat(work, "main.o"))
|| !testenv.exists(strings.concat(work, "main.wwi"))
|| !testenv.exists(strings.concat(work, "main.a"))) {
fail("library-roots", "package artifacts do not match root ownership");
};
let ctrace: str = testenv.readfile(compilertrace);
@@ -593,13 +593,13 @@ fn writediamond(td: str, reverse: bool) str = {
|| testenv.occurrences(ctrace, strings.concat("<", work,
"dep.unit.ww>")) != 1
|| testenv.occurrences(ctrace, strings.concat("<", work,
"__root.unit.ww>")) != 1
"main.unit.ww>")) != 1
|| testenv.pos(ctrace, strings.concat("<", work,
"leaf.unit.ww>")) >= testenv.pos(ctrace, strings.concat("<",
work, "dep.unit.ww>"))
|| testenv.pos(ctrace, strings.concat("<", work,
"dep.unit.ww>")) >= testenv.pos(ctrace, strings.concat("<",
work, "__root.unit.ww>"))) {
work, "main.unit.ww>"))) {
fail("library-roots", "compiler actions were not deterministic postorder");
};
if (!testenv.has(ctrace, strings.concat(
@@ -608,8 +608,8 @@ fn writediamond(td: str, reverse: bool) str = {
"dep.s><", work, "dep.unit.ww>"))
|| !testenv.has(ctrace, strings.concat(
"BEGIN<--entry><-c><--import><dep><", work,
"dep.wwi><-I><", work, "__root.wwi><-o><", work,
"__root.s><", work, "__root.unit.ww>"))
"dep.wwi><-I><", work, "main.wwi><-o><", work,
"main.s><", work, "main.unit.ww>"))
|| testenv.occurrences(atrace, "\n") != 3
|| !testenv.has(atrace, strings.concat("BEGIN<-o><", work,
"dep.o><", work, "dep.s>"))) {
@@ -617,7 +617,7 @@ fn writediamond(td: str, reverse: bool) str = {
};
if (testenv.occurrences(ltrace, "\n") != 1
|| !testenv.has(ltrace, strings.concat("BEGIN<-o><", bin, "><",
work, "__root.a>"))
work, "main.a>"))
|| testenv.pos(ltrace, strings.concat("<", work, "dep.a>")) < 0
|| testenv.pos(ltrace, strings.concat("<", work, "leaf.a>"))
< testenv.pos(ltrace, strings.concat("<", work, "dep.a>"))
@@ -651,9 +651,9 @@ fn writediamond(td: str, reverse: bool) str = {
referencearchive = strings.dup(testenv.readfile(strings.concat(work,
"dep.a")));
referencerootwwi = strings.dup(testenv.readfile(strings.concat(work,
"__root.wwi")));
"main.wwi")));
referencerootarchive = strings.dup(testenv.readfile(strings.concat(work,
"__root.a")));
"main.a")));
referencebin = strings.dup(testenv.readfile(bin));
referencecompiler = strings.dup(ctrace);
referenceassembler = strings.dup(atrace);
@@ -665,9 +665,9 @@ fn writediamond(td: str, reverse: bool) str = {
|| !testenv.same(referencearchive, testenv.readfile(strings.concat(
work, "dep.a")))
|| !testenv.same(referencerootwwi,
testenv.readfile(strings.concat(work, "__root.wwi")))
testenv.readfile(strings.concat(work, "main.wwi")))
|| !testenv.same(referencerootarchive,
testenv.readfile(strings.concat(work, "__root.a")))
testenv.readfile(strings.concat(work, "main.a")))
|| !testenv.same(referencebin, testenv.readfile(bin))
|| !testenv.same(referencecompiler, ctrace)
|| !testenv.same(referenceassembler, atrace)
@@ -727,7 +727,7 @@ fn writediamond(td: str, reverse: bool) str = {
testenv.runcommandenv(cwd, td, strings.concat("empty-library-",
tags[si]), av, emptyenv, tmo(), &out);
let rootunit: str = testenv.readfile(strings.concat(emptywork,
"__root.unit.ww"));
"main.unit.ww"));
let ctrace: str = testenv.readfile(compilertrace);
let atrace: str = testenv.readfile(assemblertrace);
let ltrace: str = testenv.readfile(linkertrace);
@@ -881,7 +881,7 @@ fn writediamond(td: str, reverse: bool) str = {
" cold build failed: ", out.stderr));
};
let rootunitpath: str = strings.concat(work, "/__root.unit.ww");
let rootunitpath: str = strings.concat(work, "/main.unit.ww");
let depunitpath: str = strings.concat(work, "/dep.unit.ww");
let rootunit: str = testenv.readfile(rootunitpath);
let depunit: str = testenv.readfile(depunitpath);
@@ -895,8 +895,8 @@ fn writediamond(td: str, reverse: bool) str = {
|| !testenv.exists(strings.concat(work, "/leaf.a"))
|| !testenv.exists(strings.concat(work, "/dep.wwi"))
|| !testenv.exists(strings.concat(work, "/dep.a"))
|| !testenv.exists(strings.concat(work, "/__root.wwi"))
|| !testenv.exists(strings.concat(work, "/__root.a"))
|| !testenv.exists(strings.concat(work, "/main.wwi"))
|| !testenv.exists(strings.concat(work, "/main.a"))
|| !testenv.same(testenv.readfile(strings.concat(work,
"/.wwtool.ww")), testenv.readfile(copied[si]))
|| !testenv.same(testenv.readfile(strings.concat(work,
@@ -921,9 +921,9 @@ fn writediamond(td: str, reverse: bool) str = {
"/dep.s.new><", work, "/dep.unit.new>"))
|| !testenv.has(coldcompiler, strings.concat(
"BEGIN<--entry><-c><--import><dep><", work,
"/dep.wwi><-I><", work, "/__root.wwi.new><-o><", work,
"/__root.s.new><", work,
"/__root.unit.new>"))
"/dep.wwi><-I><", work, "/main.wwi.new><-o><", work,
"/main.s.new><", work,
"/main.unit.new>"))
|| testenv.occurrences(coldassembler, "\n") != 3
|| !testenv.has(coldassembler, strings.concat(
"BEGIN<-o><", work, "/dep.o.new><", work,
@@ -932,7 +932,7 @@ fn writediamond(td: str, reverse: bool) str = {
};
if (testenv.occurrences(coldlinker, "\n") != 1
|| !testenv.has(coldlinker, strings.concat("BEGIN<-o><", bin,
"><", work, "/__root.a>"))
"><", work, "/main.a>"))
|| testenv.pos(coldlinker, strings.concat("<", work,
"/dep.a>")) < 0
|| testenv.pos(coldlinker, strings.concat("<", work,
@@ -965,7 +965,7 @@ fn writediamond(td: str, reverse: bool) str = {
|| testenv.occurrences(changedexportcompiler, strings.concat("<", work,
"/dep.unit.new>")) != 2
|| testenv.occurrences(changedexportcompiler, strings.concat("<", work,
"/__root.unit.new>")) != 1
"/main.unit.new>")) != 1
|| testenv.occurrences(changedexportcompiler, "\n") != 5
|| testenv.occurrences(changedexportassembler, "\n") != 5) {
fail("driver-identity", "changed export did not stop at an unchanged importer export");
@@ -999,7 +999,7 @@ fn writediamond(td: str, reverse: bool) str = {
|| testenv.occurrences(testenv.readfile(compilertrace), strings.concat(
"<", work, "/dep.unit.new>")) != 3
|| testenv.occurrences(testenv.readfile(compilertrace), strings.concat(
"<", work, "/__root.unit.new>")) != 1
"<", work, "/main.unit.new>")) != 1
|| testenv.occurrences(testenv.readfile(compilertrace), "\n") != 7
|| testenv.occurrences(testenv.readfile(assemblertrace), "\n") != 7
|| !testenv.same(coldbin, testenv.readfile(bin))) {
@@ -1024,7 +1024,7 @@ fn writediamond(td: str, reverse: bool) str = {
|| testenv.occurrences(changedcompiler, strings.concat("<", work,
"/dep.unit.new>")) != 4
|| testenv.occurrences(changedcompiler, strings.concat("<", work,
"/__root.unit.new>")) != 2
"/main.unit.new>")) != 2
|| testenv.occurrences(changedcompiler, "\n") != 10
|| testenv.occurrences(changedassembler, "\n") != 10
|| testenv.occurrences(changedlinker, "\n") != 5) {

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/__root.unit.ww
// the binary exits 17, and the driver's <out>.sepwork/rootok.unit.ww
// stores ORDER-A strictly before ORDER-Z (byte-sorted deterministic
// source order); the two stages' units are byte-identical.
//
@@ -143,7 +143,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/__root.unit.ww"));
".sepwork/rootok.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 +153,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 __root.unit.ww differ");
fail("rootorder", "C/WW rootok.unit.ww differ");
};
testenv.clean(td);
};