From f45844ffa851050aef46edddd7329c2b91e559b6 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 13 Aug 2026 05:57:16 +0900 Subject: [PATCH] test: close long package reuse proofs --- docs/build-system.md | 11 ++++++---- test/package/package_test.ww | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/docs/build-system.md b/docs/build-system.md index 273f0ab8..8e324d2f 100644 --- a/docs/build-system.md +++ b/docs/build-system.md @@ -3458,10 +3458,13 @@ keeps these values separately: - `storage`: an internal scratch basename that is never passed as package identity. -The first four values, not `storage`, participate in directory-action -interning, source-import edges, module-reset ownership, compiler `--import` -arguments, export ownership, diagnostics, generated-main construction, and -symbol qualification. The reversible outside-root form remains +`canon` participates in command-local directory-action interning, diagnostics, +and storage-address derivation. The complete `path`, together with the +semantic `variant` and `role`, is the persisted/compiler owner carried through +source-import edges, module-reset and export ownership, compiler `--import` +arguments, generated-main construction, and symbol qualification; `storage` +participates in none of those identities. The reversible outside-root form +remains `__wwlocal.p.` and is allocated to its exact length. It is neither truncated nor replaced by a digest, and `__wwlocal` remains unavailable to source imports. Package diff --git a/test/package/package_test.ww b/test/package/package_test.ww index 232e865b..deb47cdc 100644 --- a/test/package/package_test.ww +++ b/test/package/package_test.ww @@ -124,6 +124,26 @@ fn runcommandenv(root: str, name: str, argv: []str, env: []str, out.stderr = readfile(c.stderrpath); }; +fn runcommandenvdir(root: str, name: str, argv: []str, env: []str, + dir: str, lifetime: time.duration, out: *commandout) void = { + let c: exec.command; + c.path = argv[0]; + c.argv = argv; + c.env = env; + c.dir = dir; + c.stdoutpath = strings.concat(root, "/", name, ".stdout"); + c.stderrpath = strings.concat(root, "/", name, ".stderr"); + c.deadline = time.add(time.now(time.clock.monotonic), lifetime); + c.grace = (100i64 * (time.millisecond: i64)): time.duration; + let r: exec.result; + exec.run(&c, &r); + assert(r.errno == 0 && r.cleanuperrno == 0); + out.termination = r.termination; + out.code = r.code; + out.stdout = readfile(c.stdoutpath); + out.stderr = readfile(c.stderrpath); +}; + fn clean(root: str) void = { let av: []str = ["/bin/rm", "-rf", "--", root]; let c: exec.command; @@ -703,6 +723,22 @@ fn mkdirall(path: str) void = { action, suffixes[xi])))); xi += 1; }; + let relative: str = strings.concat(".", + strings.sub(real, root.len, real.len)); + let relativeav: []str = [driver(stages[si]), "test", "-w", work, + relative]; + runcommandenvdir(root, strings.concat("relative-warm-", stages[si]), + relativeav, env, root, + (60i64 * (time.second: i64)): time.duration, &out); + expectexit(&out, 0); + assert(has(out.stdout, "real.value_is_one ... ok\n")); + assert(same(coldtrace, readfile(trace))); + xi = 0; + for (xi < suffixes.len) { + assert(same(references[xi], readfile(strings.concat(key, "/", + action, suffixes[xi])))); + xi += 1; + }; si += 1; }; clean(root); @@ -3419,6 +3455,10 @@ fn mkdirall(path: str) void = { ".unit.new>")) == 1); assert(has(readfile(strings.concat(work, artifacts[0], ".s")), strings.concat(commandid, ".value"))); + assert(has(readfile(strings.concat(work, artifacts[1], ".s")), + strings.concat(commandid, ".command_internal"))); + assert(has(readfile(strings.concat(work, artifacts[2], ".s")), + strings.concat(externalid, ".command_external"))); let warmrefs: []str = alloc([], reference.len: u64)!; warmrefs.len = reference.len; ai = 0;