test: prove canonical directory package identity
This commit is contained in:
@@ -88,6 +88,7 @@ fn samefile(a: str, b: str, why: str) void = {
|
||||
let cwork: str = strings.concat(stems[0], ".sepwork/");
|
||||
let cwork2: str = strings.concat(stems[1], ".sepwork/");
|
||||
let wwork: str = strings.concat(stems[2], ".sepwork/");
|
||||
let appidentity: str = testenv.localpackageidentity(app, "main");
|
||||
let foounit: str = testenv.readfile(strings.concat(cwork,
|
||||
"example.foo.unit.ww"));
|
||||
let wantfoo: str = strings.concat("//ww:module-reset example.foo\n", afoosrc,
|
||||
@@ -97,14 +98,15 @@ 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 main\n", appsrc,
|
||||
let wantroot: str = strings.concat("//ww:module-reset ", appidentity,
|
||||
"\n", appsrc,
|
||||
"\n");
|
||||
if (!testenv.same(wantroot, testenv.readfile(strings.concat(cwork,
|
||||
"main.unit.ww")))) {
|
||||
appidentity, ".unit.ww")))) {
|
||||
fail("root unit is not exactly its owned source");
|
||||
};
|
||||
let keys: []str = ["example.base", "example.bar", "example.foo",
|
||||
"main"];
|
||||
appidentity];
|
||||
let suffixes: []str = [".unit.ww", ".wwi", ".a"];
|
||||
i = 0;
|
||||
for (i < keys.len) {
|
||||
@@ -122,6 +124,47 @@ fn samefile(a: str, b: str, why: str) void = {
|
||||
samefile(stems[0], stems[1], "C executables are not deterministic");
|
||||
samefile(stems[0], stems[2], "C/WW executables differ");
|
||||
|
||||
// The same canonical directory is now observed as an imported dependency,
|
||||
// a literal root, an explicit logical root, an equivalent path spelling,
|
||||
// and a symlink spelling. Every route must publish the one example.foo
|
||||
// action with byte-identical owner unit, export, and archive.
|
||||
let fooalias: str = strings.concat(td, "/foo-alias");
|
||||
assert(os.symlink(foo, fooalias) == 0);
|
||||
let rootouts: []str = [strings.concat(td, "/foo-root-c"),
|
||||
strings.concat(td, "/foo-root-w"),
|
||||
strings.concat(td, "/foo-logical-c"),
|
||||
strings.concat(td, "/foo-logical-w"),
|
||||
strings.concat(td, "/foo-equivalent-c"),
|
||||
strings.concat(td, "/foo-equivalent-w"),
|
||||
strings.concat(td, "/foo-relative-c"),
|
||||
strings.concat(td, "/foo-relative-w"),
|
||||
strings.concat(td, "/foo-alias-c"),
|
||||
strings.concat(td, "/foo-alias-w")];
|
||||
let rootdrivers: []str = ["ww", "ww_ww", "ww", "ww_ww", "ww",
|
||||
"ww_ww", "ww", "ww_ww", "ww", "ww_ww"];
|
||||
let roottags: []str = ["literal-c", "literal-w", "logical-c",
|
||||
"logical-w", "equivalent-c", "equivalent-w", "relative-c",
|
||||
"relative-w", "alias-c", "alias-w"];
|
||||
let roottargets: []str = [foo, foo, "example.foo", "example.foo",
|
||||
strings.concat(foo, "/../foo"), strings.concat(foo, "/../foo"),
|
||||
"late/example/foo", "late/example/foo", fooalias, fooalias];
|
||||
i = 0;
|
||||
for (i < rootouts.len) {
|
||||
let rav: []str = [testenv.driver(rootdrivers[i]), "build", "-p",
|
||||
"-I", early, "-I", late, "-o", rootouts[i], roottargets[i]];
|
||||
expectcode(td, strings.concat("foo_root_", roottags[i]), rav, 0);
|
||||
let rw: str = strings.concat(rootouts[i], ".sepwork/");
|
||||
let rsuffixes: []str = [".unit.ww", ".wwi", ".a"];
|
||||
let ri: i32 = 0;
|
||||
for (ri < rsuffixes.len) {
|
||||
let artifact: str = strings.concat("example.foo", rsuffixes[ri]);
|
||||
samefile(strings.concat(cwork, artifact), strings.concat(rw, artifact),
|
||||
"canonical foo action changed across root spellings");
|
||||
ri += 1;
|
||||
};
|
||||
i += 1;
|
||||
};
|
||||
|
||||
let cerr: testenv.commandout;
|
||||
let werr: testenv.commandout;
|
||||
let cav: []str = [testenv.driver("ww"), "build", "-I", early,
|
||||
|
||||
Reference in New Issue
Block a user