build: make executable and test roots package actions
This commit is contained in:
@@ -97,12 +97,14 @@ fn samefile(a: str, b: str, why: str) void = {
|
||||
|| testenv.has(foounit, "//ww:module ")) {
|
||||
fail("foo unit is not exactly its sorted, owned source set");
|
||||
};
|
||||
let wantroot: str = strings.concat("//ww:module-reset\n", appsrc, "\n");
|
||||
let wantroot: str = strings.concat("//ww:module-reset main\n", appsrc,
|
||||
"\n");
|
||||
if (!testenv.same(wantroot, testenv.readfile(strings.concat(cwork,
|
||||
"__root.unit.ww")))) {
|
||||
fail("root unit is not exactly its owned source");
|
||||
};
|
||||
let keys: []str = ["example.base", "example.bar", "example.foo"];
|
||||
let keys: []str = ["example.base", "example.bar", "example.foo",
|
||||
"__root"];
|
||||
let suffixes: []str = [".unit.ww", ".wwi", ".a"];
|
||||
i = 0;
|
||||
for (i < keys.len) {
|
||||
@@ -117,10 +119,6 @@ fn samefile(a: str, b: str, why: str) void = {
|
||||
};
|
||||
i += 1;
|
||||
};
|
||||
samefile(strings.concat(cwork, "__root.unit.ww"), strings.concat(cwork2,
|
||||
"__root.unit.ww"), "root unit changed across clean C builds");
|
||||
samefile(strings.concat(cwork, "__root.unit.ww"), strings.concat(wwork,
|
||||
"__root.unit.ww"), "root unit differs between stages");
|
||||
samefile(stems[0], stems[1], "C executables are not deterministic");
|
||||
samefile(stems[0], stems[2], "C/WW executables differ");
|
||||
|
||||
|
||||
@@ -286,7 +286,8 @@ fn rejectstable(dir: str, label: str, target: str, needle: str) void = {
|
||||
|| testenv.has(apiiface, "hidden")) {
|
||||
fail("self-contained", "api export leaked unrelated or private declarations");
|
||||
};
|
||||
let expectedunit: str = strings.concat("//ww:module-reset\n", mainsrc, "\n");
|
||||
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")))) {
|
||||
@@ -405,7 +406,7 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
let unit: str = testenv.readfile(strings.concat(scratch,
|
||||
"__root.unit.ww"));
|
||||
let rootbody: str = testenv.readfile(strings.concat(main, "/main.ww"));
|
||||
let wantroot: str = strings.concat("//ww:module-reset\n", rootbody,
|
||||
let wantroot: str = strings.concat("//ww:module-reset main\n", rootbody,
|
||||
"\n");
|
||||
if (!testenv.same(unit, wantroot) || testenv.has(unit,
|
||||
"//ww:module ")) {
|
||||
@@ -530,6 +531,8 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
let referenceunit: str = "";
|
||||
let referencewwi: str = "";
|
||||
let referencearchive: str = "";
|
||||
let referencerootwwi: str = "";
|
||||
let referencerootarchive: str = "";
|
||||
let referencebin: str = "";
|
||||
let referencecompiler: str = "";
|
||||
let referenceassembler: str = "";
|
||||
@@ -567,7 +570,7 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
"__root.unit.ww"));
|
||||
let depunit: str = testenv.readfile(strings.concat(work,
|
||||
"dep.unit.ww"));
|
||||
if (!testenv.has(rootunit, "//ww:module-reset\npackage main;")
|
||||
if (!testenv.has(rootunit, "//ww:module-reset main\npackage main;")
|
||||
|| testenv.has(rootunit, "//ww:module ")
|
||||
|| !testenv.has(depunit, "//ww:module-reset dep\npackage dep;")
|
||||
|| testenv.has(depunit, "//ww:module ")) {
|
||||
@@ -578,8 +581,8 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
|| !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, "__root.wwi"))
|
||||
|| !testenv.exists(strings.concat(work, "__root.a"))) {
|
||||
fail("library-roots", "package artifacts do not match root ownership");
|
||||
};
|
||||
let ctrace: str = testenv.readfile(compilertrace);
|
||||
@@ -603,6 +606,10 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
"BEGIN<-c><--import><leaf><", work, "leaf.wwi><-I><", work,
|
||||
"dep.wwi><-o><", work,
|
||||
"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>"))
|
||||
|| testenv.occurrences(atrace, "\n") != 3
|
||||
|| !testenv.has(atrace, strings.concat("BEGIN<-o><", work,
|
||||
"dep.o><", work, "dep.s>"))) {
|
||||
@@ -610,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.o>"))
|
||||
work, "__root.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>"))
|
||||
@@ -643,6 +650,10 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
"dep.wwi")));
|
||||
referencearchive = strings.dup(testenv.readfile(strings.concat(work,
|
||||
"dep.a")));
|
||||
referencerootwwi = strings.dup(testenv.readfile(strings.concat(work,
|
||||
"__root.wwi")));
|
||||
referencerootarchive = strings.dup(testenv.readfile(strings.concat(work,
|
||||
"__root.a")));
|
||||
referencebin = strings.dup(testenv.readfile(bin));
|
||||
referencecompiler = strings.dup(ctrace);
|
||||
referenceassembler = strings.dup(atrace);
|
||||
@@ -653,6 +664,10 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
work, "dep.wwi")))
|
||||
|| !testenv.same(referencearchive, testenv.readfile(strings.concat(
|
||||
work, "dep.a")))
|
||||
|| !testenv.same(referencerootwwi,
|
||||
testenv.readfile(strings.concat(work, "__root.wwi")))
|
||||
|| !testenv.same(referencerootarchive,
|
||||
testenv.readfile(strings.concat(work, "__root.a")))
|
||||
|| !testenv.same(referencebin, testenv.readfile(bin))
|
||||
|| !testenv.same(referencecompiler, ctrace)
|
||||
|| !testenv.same(referenceassembler, atrace)
|
||||
@@ -723,7 +738,7 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
runav) != 42) {
|
||||
fail("library-roots", "empty override did not use default roots");
|
||||
};
|
||||
if (!testenv.has(rootunit, "//ww:module-reset\npackage main;")
|
||||
if (!testenv.has(rootunit, "//ww:module-reset main\npackage main;")
|
||||
|| testenv.has(rootunit, "//ww:module ")
|
||||
|| !testenv.exists(strings.concat(emptywork, "types.wwi"))
|
||||
|| !testenv.exists(strings.concat(emptywork, "types.a"))
|
||||
@@ -870,7 +885,7 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
let depunitpath: str = strings.concat(work, "/dep.unit.ww");
|
||||
let rootunit: str = testenv.readfile(rootunitpath);
|
||||
let depunit: str = testenv.readfile(depunitpath);
|
||||
if (!testenv.has(rootunit, "//ww:module-reset\npackage main;")
|
||||
if (!testenv.has(rootunit, "//ww:module-reset main\npackage main;")
|
||||
|| testenv.has(rootunit, "//ww:module ")
|
||||
|| !testenv.has(depunit, "//ww:module-reset dep\npackage dep;")
|
||||
|| testenv.has(depunit, "//ww:module ")) {
|
||||
@@ -880,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, "/__root.wwi"))
|
||||
|| !testenv.exists(strings.concat(work, "/__root.a"))
|
||||
|| !testenv.same(testenv.readfile(strings.concat(work,
|
||||
"/.wwtool.ww")), testenv.readfile(copied[si]))
|
||||
|| !testenv.same(testenv.readfile(strings.concat(work,
|
||||
@@ -890,7 +905,7 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
"/.wwtool.w6a")), testenv.readfile(assembler))
|
||||
|| !testenv.same(testenv.readfile(strings.concat(work,
|
||||
"/.wwtool.stamp")),
|
||||
"ww workdir fmt 6 mode build asm 0\n")) {
|
||||
"ww workdir fmt 7 mode build asm 0\n")) {
|
||||
fail("driver-identity", "persistent artifacts or identities are incomplete");
|
||||
};
|
||||
let coldwwi: str = testenv.readfile(strings.concat(work, "/dep.wwi"));
|
||||
@@ -905,7 +920,8 @@ fn writediamond(td: str, reverse: bool) str = {
|
||||
"/dep.wwi.new><-o><", work,
|
||||
"/dep.s.new><", work, "/dep.unit.new>"))
|
||||
|| !testenv.has(coldcompiler, strings.concat(
|
||||
"BEGIN<-c><--import><dep><", work, "/dep.wwi><-o><", work,
|
||||
"BEGIN<--entry><-c><--import><dep><", work,
|
||||
"/dep.wwi><-I><", work, "/__root.wwi.new><-o><", work,
|
||||
"/__root.s.new><", work,
|
||||
"/__root.unit.new>"))
|
||||
|| testenv.occurrences(coldassembler, "\n") != 3
|
||||
@@ -916,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.o>"))
|
||||
"><", work, "/__root.a>"))
|
||||
|| testenv.pos(coldlinker, strings.concat("<", work,
|
||||
"/dep.a>")) < 0
|
||||
|| testenv.pos(coldlinker, strings.concat("<", work,
|
||||
|
||||
@@ -8,19 +8,16 @@ package sepbuild_test;
|
||||
//
|
||||
// sepbuild (#46 commit-3) — build_one_sep END-TO-END on the real lib
|
||||
// chain root -> os -> {rt,time} (transitive-closure discovery + topo):
|
||||
// build+run exit 7 both stages; {time,rt,os}.wwi + __root.s
|
||||
// materialize (#69: the root is compiled without -I, so no
|
||||
// __root.wwi); per-package .s/.wwi/.unit.ww and the final binary
|
||||
// build+run exit 7 both stages; {time,rt,os,__root}.wwi/.a
|
||||
// materialize; per-package .s/.wwi/.a/.unit.ww and the final binary
|
||||
// byte-id cs vs ww; every .unit.ww is the package's own sorted source
|
||||
// set; `ww run` routes through the same sole sep path (exit 7 both
|
||||
// stages).
|
||||
//
|
||||
// seproot (#69 BUG-1) — a ROOT whose `export fn use(a: *t)` names an
|
||||
// unexported local `type t` builds (exit 37 both stages) because the
|
||||
// root is compiled WITHOUT the -I .wwi-producer flag: __root.wwi must
|
||||
// NOT exist; replaying the driver's own __root.unit.ww plus c.wwi
|
||||
// through w6c/w6c_ww with -I must REJECT (the isolated bug) while -c
|
||||
// -o alone must accept; __root.s carries the exported fn.
|
||||
// seproot — a ROOT whose `export fn use(a: *t)` reaches an unexported
|
||||
// local `type t` builds and emits a deterministic self-contained .wwi/.a.
|
||||
// The private type is carried as compiler export data without `export`, and
|
||||
// an importing source still cannot qualify `main.t`.
|
||||
//
|
||||
// sepstructdef (#70 BUG-2) — a dep exporting aggregate-init defs
|
||||
// (struct-lit + array-lit) sep-builds and links (exit 20 both
|
||||
@@ -91,29 +88,25 @@ fn samefile(label: str, what: str, a: str, b: str) void = {
|
||||
s += 1;
|
||||
};
|
||||
|
||||
// discovery/topo: the transitive package set materialized. #69: the
|
||||
// root emits no .wwi (compiled without -I); its .s stands in.
|
||||
// discovery/topo: every reachable package action materialized.
|
||||
let pkgs: []str = ["time", "rt", "os", "__root"];
|
||||
let i: i32 = 0;
|
||||
for (i < pkgs.len) {
|
||||
let suffix: str = ".wwi";
|
||||
if (testenv.same(pkgs[i], "__root")) { suffix = ".s"; };
|
||||
if (!testenv.exists(strings.concat(td, "/prog.cs.sepwork/",
|
||||
pkgs[i], suffix))) {
|
||||
fail("sepbuild", strings.concat(pkgs[i], suffix,
|
||||
pkgs[i], ".wwi")) || !testenv.exists(strings.concat(td,
|
||||
"/prog.cs.sepwork/", pkgs[i], ".a"))) {
|
||||
fail("sepbuild", strings.concat(pkgs[i], ".wwi/.a",
|
||||
" missing (discovery/topo)"));
|
||||
};
|
||||
i += 1;
|
||||
};
|
||||
|
||||
// cs==ww (rule 10): per-package artifacts + the final binary
|
||||
let sufs: []str = [".s", ".wwi", ".unit.ww"];
|
||||
let sufs: []str = [".s", ".wwi", ".a", ".unit.ww"];
|
||||
let p: i32 = 0;
|
||||
for (p < pkgs.len) {
|
||||
let k: i32 = 0;
|
||||
for (k < sufs.len) {
|
||||
if (testenv.same(pkgs[p], "__root")
|
||||
&& testenv.same(sufs[k], ".wwi")) { k += 1; continue; };
|
||||
samefile("sepbuild", strings.concat(pkgs[p], sufs[k]),
|
||||
strings.concat(td, "/prog.cs.sepwork/", pkgs[p], sufs[k]),
|
||||
strings.concat(td, "/prog.ww.sepwork/", pkgs[p], sufs[k]));
|
||||
@@ -171,15 +164,13 @@ fn samefile(label: str, what: str, a: str, b: str) void = {
|
||||
s += 1;
|
||||
};
|
||||
|
||||
// cs==ww; the root's .wwi is intentionally absent (asserted below)
|
||||
// cs==ww for the complete package artifacts, including the root archive.
|
||||
let pkgs: []str = ["c", "__root"];
|
||||
let sufs: []str = [".s", ".wwi", ".unit.ww"];
|
||||
let sufs: []str = [".s", ".wwi", ".a", ".unit.ww"];
|
||||
let p: i32 = 0;
|
||||
for (p < pkgs.len) {
|
||||
let k: i32 = 0;
|
||||
for (k < sufs.len) {
|
||||
if (testenv.same(pkgs[p], "__root")
|
||||
&& testenv.same(sufs[k], ".wwi")) { k += 1; continue; };
|
||||
samefile("seproot", strings.concat(pkgs[p], sufs[k]),
|
||||
strings.concat(td, "/prog.cs.sepwork/", pkgs[p], sufs[k]),
|
||||
strings.concat(td, "/prog.ww.sepwork/", pkgs[p], sufs[k]));
|
||||
@@ -190,38 +181,51 @@ fn samefile(label: str, what: str, a: str, b: str) void = {
|
||||
samefile("seproot", "the final binary",
|
||||
strings.concat(td, "/prog.cs"), strings.concat(td, "/prog.ww"));
|
||||
|
||||
// the fix: the root is compiled WITHOUT -I, so no __root.wwi
|
||||
// The reachable private nominal is compiler data, not a public source name.
|
||||
let s2: i32 = 0;
|
||||
for (s2 < 2) {
|
||||
if (testenv.exists(strings.concat(td, "/prog.", tags[s2],
|
||||
".sepwork/__root.wwi"))) {
|
||||
let rootiface: str = strings.concat(td, "/prog.", tags[s2],
|
||||
".sepwork/__root.wwi");
|
||||
let ifacebytes: str = testenv.readfile(rootiface);
|
||||
if (!testenv.has(ifacebytes, "type t = struct { v: i32 }")
|
||||
|| testenv.has(ifacebytes, "export type t")
|
||||
|| !testenv.has(ifacebytes, "export fn use(a: *t) i32;")) {
|
||||
fail("seproot", strings.concat(drvs[s2],
|
||||
" produced __root.wwi (-I still passed for the root)"));
|
||||
" did not carry a private reachable type as compiler data"));
|
||||
};
|
||||
s2 += 1;
|
||||
};
|
||||
|
||||
// replay the pre-fix invocation on the driver's own __root.unit.ww:
|
||||
// with -I the export-check FIRES (the isolated bug); without it the
|
||||
// post-fix invocation accepts. Both compilers.
|
||||
// Replay the package compile with -I: both compilers accept and emit the
|
||||
// same self-contained export. A source importer cannot name its private t.
|
||||
let unit: str = strings.concat(td, "/prog.cs.sepwork/__root.unit.ww");
|
||||
let ciface: str = strings.concat(td, "/prog.cs.sepwork/c.wwi");
|
||||
let consumer: str = strings.concat(td, "/consumer.ww");
|
||||
testenv.writefile(consumer, strings.concat(
|
||||
"package consumer;\n",
|
||||
"import main;\n",
|
||||
"fn forbidden(v: *main.t) void = {};\n"));
|
||||
let comps: []str = ["w6c", "w6c_ww"];
|
||||
let c: i32 = 0;
|
||||
for (c < 2) {
|
||||
let wwi: str = strings.concat(td, "/nv.", comps[c], ".wwi");
|
||||
let asmf: str = strings.concat(td, "/nv.", comps[c], ".s");
|
||||
let rav: []str = [testenv.driver(comps[c]), "-c", "--import", "c",
|
||||
ciface, "-I", wwi, "-o", asmf, unit];
|
||||
if (runcode(td, strings.concat("nvI_", comps[c]), rav) == 0) {
|
||||
fail("seproot", strings.concat(comps[c], " -c -I accepted the ",
|
||||
"root export-over-unexported-type (vacuous gate)"));
|
||||
let rav: []str = [testenv.driver(comps[c]), "--entry", "-c",
|
||||
"--import", "c", ciface, "-I", wwi, "-o", asmf, unit];
|
||||
if (runcode(td, strings.concat("reexport_", comps[c]), rav) != 0) {
|
||||
fail("seproot", strings.concat(comps[c],
|
||||
" rejected the self-contained root export"));
|
||||
};
|
||||
let aav: []str = [testenv.driver(comps[c]), "-c", "--import", "c",
|
||||
ciface, "-o", asmf, unit];
|
||||
if (runcode(td, strings.concat("nvO_", comps[c]), aav) != 0) {
|
||||
fail("seproot", strings.concat(comps[c], " -c -o (no -I) ",
|
||||
"rejected the root unit (post-fix invocation)"));
|
||||
let rejectav: []str = [testenv.driver(comps[c]), "-c", "--import",
|
||||
"main", wwi, "-o", asmf, consumer];
|
||||
let reject: testenv.commandout;
|
||||
testenv.runcommand(td, td, strings.concat("private_", comps[c]),
|
||||
rejectav, tmo(), &reject);
|
||||
if (reject.termination != exec.termination.EXIT || reject.code == 0
|
||||
|| !testenv.has(reject.stderr,
|
||||
"package 'main' has no exported declaration 't'")) {
|
||||
fail("seproot", strings.concat(comps[c],
|
||||
" exposed the compiler-private type to source importers"));
|
||||
};
|
||||
c += 1;
|
||||
};
|
||||
|
||||
@@ -69,7 +69,8 @@ fn cmpsepwork(label: str, csdir: str, wwdir: str) void = {
|
||||
let i: i32 = 0;
|
||||
for (i < names.len) {
|
||||
if (strings.hassuffix(names[i], ".s")
|
||||
|| strings.hassuffix(names[i], ".wwi")) {
|
||||
|| strings.hassuffix(names[i], ".wwi")
|
||||
|| strings.hassuffix(names[i], ".a")) {
|
||||
seen += 1;
|
||||
if (!testenv.same(
|
||||
testenv.readfile(strings.concat(csdir, "/", names[i])),
|
||||
@@ -81,7 +82,7 @@ fn cmpsepwork(label: str, csdir: str, wwdir: str) void = {
|
||||
i += 1;
|
||||
};
|
||||
// an existing-but-empty sepwork would pass the loop vacuously
|
||||
if (seen == 0) { fail(label, "no .s/.wwi in cs sepwork"); };
|
||||
if (seen == 0) { fail(label, "no package artifacts in cs sepwork"); };
|
||||
};
|
||||
|
||||
@test fn coloimport() void = {
|
||||
@@ -210,11 +211,11 @@ fn depmainrow(label: str, entry: str, want: i32, deps: str,
|
||||
l += 1;
|
||||
};
|
||||
|
||||
// the root emits no .wwi post-#69, so its suffix set omits .wwi
|
||||
let parts: []str = ["aa.s", "aa.wwi", "aa.unit.ww", "__root.s",
|
||||
"__root.unit.ww"];
|
||||
// Both the dependency and raw explicit root emit complete package artifacts.
|
||||
let parts: []str = ["aa.s", "aa.wwi", "aa.a", "aa.unit.ww",
|
||||
"__root.s", "__root.wwi", "__root.a", "__root.unit.ww"];
|
||||
|
||||
// cs==ww (rule 10) per layout over the fixed 5-part table
|
||||
// cs==ww (rule 10) per layout over the complete package-artifact table
|
||||
let l2: i32 = 0;
|
||||
for (l2 < 2) {
|
||||
let p: i32 = 0;
|
||||
|
||||
@@ -4,12 +4,11 @@ package seplink_test;
|
||||
// retired native carriers test/wcc/989_separchive_run.c and
|
||||
// 989_sepcycle_dup.c; every assertion preserved.
|
||||
//
|
||||
// archive (#46 commit-5a) — `ww build` wraps each DEP package's .o in
|
||||
// a deterministic single-member .a and links the ROOT as a positional
|
||||
// .o (force-loaded): build+run exit 7 both stages; __root.a absent,
|
||||
// __root.o + helper.a present; cs helper.a == ww helper.a (rule 10,
|
||||
// the .a byte-id substrate); 3 cold cstage rebuilds emit
|
||||
// byte-identical helper.a (zeroed mtime/uid/gid, fixed mode/member —
|
||||
// archive — `ww build` wraps every package action's .o in the existing
|
||||
// deterministic single-member .a and links the root archive first:
|
||||
// build+run exit 7 both stages; __root.a + helper.a present; both archives
|
||||
// are byte-identical across stages; 3 cold cstage rebuilds emit
|
||||
// byte-identical archives (zeroed mtime/uid/gid, fixed mode/member —
|
||||
// a floating byte would poison the content cache key).
|
||||
//
|
||||
// archivedup (#31 PASS 3) — two dep packages force the same link
|
||||
@@ -94,22 +93,20 @@ fn runcode(dir: str, name: str, argv: []str) i32 = {
|
||||
s += 1;
|
||||
};
|
||||
|
||||
// layout: root stays a positional force-loaded .o, deps become .a
|
||||
if (testenv.exists(strings.concat(td, "/prog.cs.sepwork/__root.a"))) {
|
||||
fail("archive", "root wrapped in .a (should stay positional .o)");
|
||||
};
|
||||
if (!testenv.exists(strings.concat(td, "/prog.cs.sepwork/__root.o"))) {
|
||||
fail("archive", "missing root .o");
|
||||
};
|
||||
if (!testenv.exists(strings.concat(td, "/prog.cs.sepwork/helper.a"))) {
|
||||
fail("archive", "missing dep helper.a");
|
||||
// layout: root and dependency are both package archives.
|
||||
if (!testenv.exists(strings.concat(td, "/prog.cs.sepwork/__root.a"))
|
||||
|| !testenv.exists(strings.concat(td, "/prog.cs.sepwork/helper.a"))) {
|
||||
fail("archive", "missing root or dependency archive");
|
||||
};
|
||||
|
||||
// rule 10: the .a byte-id substrate
|
||||
// rule 10: the complete .a byte-id substrate
|
||||
if (!testenv.same(
|
||||
testenv.readfile(strings.concat(td, "/prog.cs.sepwork/helper.a")),
|
||||
testenv.readfile(strings.concat(td, "/prog.ww.sepwork/helper.a")))) {
|
||||
fail("archive", "cs helper.a != ww helper.a (rule 10 .a byte-id)");
|
||||
testenv.readfile(strings.concat(td, "/prog.ww.sepwork/helper.a")))
|
||||
|| !testenv.same(
|
||||
testenv.readfile(strings.concat(td, "/prog.cs.sepwork/__root.a")),
|
||||
testenv.readfile(strings.concat(td, "/prog.ww.sepwork/__root.a")))) {
|
||||
fail("archive", "cs package archives != ww package archives");
|
||||
};
|
||||
|
||||
// determinism: 3 cold cstage rebuilds -> byte-identical .a
|
||||
@@ -132,9 +129,18 @@ fn runcode(dir: str, name: str, argv: []str) i32 = {
|
||||
let a2: str = testenv.readfile(strings.concat(det2,
|
||||
".sepwork/helper.a"));
|
||||
if (!testenv.same(a0, a1) || !testenv.same(a1, a2)) {
|
||||
fail("archive", strings.concat(".a not deterministic across 3 ",
|
||||
fail("archive", strings.concat("dependency .a not deterministic across 3 ",
|
||||
"builds (floating bytes poison the cache key)"));
|
||||
};
|
||||
let r0: str = testenv.readfile(strings.concat(det0,
|
||||
".sepwork/__root.a"));
|
||||
let r1: str = testenv.readfile(strings.concat(det1,
|
||||
".sepwork/__root.a"));
|
||||
let r2: str = testenv.readfile(strings.concat(det2,
|
||||
".sepwork/__root.a"));
|
||||
if (!testenv.same(r0, r1) || !testenv.same(r1, r2)) {
|
||||
fail("archive", "root .a not deterministic across 3 builds");
|
||||
};
|
||||
testenv.clean(td);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user