cmd: share package builds across test directories
This commit is contained in:
815
cmd/ww/main.c
815
cmd/ww/main.c
File diff suppressed because it is too large
Load Diff
@@ -106,8 +106,8 @@ fn pkgusage() void = {
|
|||||||
let s: str = strings.concat(
|
let s: str = strings.concat(
|
||||||
"usage: wwtest package [-c] [-list] [-j N] [-I DIR] [-w DIR] [-run|-filter GLOB] [-timeout-ms=N] [DIR | DIR/...] [-- GLOB ...]\n",
|
"usage: wwtest package [-c] [-list] [-j N] [-I DIR] [-w DIR] [-run|-filter GLOB] [-timeout-ms=N] [DIR | DIR/...] [-- GLOB ...]\n",
|
||||||
" *_test.ww is the sole test-source form; @test elsewhere is rejected\n",
|
" *_test.ww is the sole test-source form; @test elsewhere is rejected\n",
|
||||||
" -c retains the compiled package binaries; -j N runs up to N directory builds or test binaries at once\n",
|
" -c retains the compiled package binaries; -j N runs up to N build or test processes at once\n",
|
||||||
" -w DIR keys a persistent shared build workdir per package directory\n");
|
" -w DIR keys one persistent shared build workdir for the test request\n");
|
||||||
pkgput(os.STDERR_FILENO, s);
|
pkgput(os.STDERR_FILENO, s);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -530,8 +530,8 @@ fn pkgsetplanpaths(p: *pkgplan, groups: []pkggroup, root: str, index: i32,
|
|||||||
if (!pkgmakedir(p.root)) { return false; };
|
if (!pkgmakedir(p.root)) { return false; };
|
||||||
p.workdir = "";
|
p.workdir = "";
|
||||||
if (workroot.len != 0) {
|
if (workroot.len != 0) {
|
||||||
// The first byte-sorted product name is stable metadata in the
|
// The request root and first byte-sorted product name make one stable
|
||||||
// injective directory key; every product in this plan shares the dir.
|
// escaped key for the command-scoped driver workdir.
|
||||||
p.workdir = strings.concat(workroot, "/",
|
p.workdir = strings.concat(workroot, "/",
|
||||||
pkgworkkey(p.dir, groups[p.start].pkg));
|
pkgworkkey(p.dir, groups[p.start].pkg));
|
||||||
match (os.mkdirs(p.workdir, 448)) {
|
match (os.mkdirs(p.workdir, 448)) {
|
||||||
@@ -600,7 +600,7 @@ fn pkgreportcommand(kind: str, g: *pkggroup, r: *exec.result) void = {
|
|||||||
fn pkgstartbuild(p: *pkgplan, groups: []pkggroup, builder: str, includes: []str,
|
fn pkgstartbuild(p: *pkgplan, groups: []pkggroup, builder: str, includes: []str,
|
||||||
h: *exec.process) void = {
|
h: *exec.process) void = {
|
||||||
let ba: []str = alloc([],
|
let ba: []str = alloc([],
|
||||||
(8 + (p.end - p.start) * 5 + includes.len * 2): u64)!;
|
(8 + (p.end - p.start) * 6 + includes.len * 2): u64)!;
|
||||||
append(ba, builder);
|
append(ba, builder);
|
||||||
append(ba, "test");
|
append(ba, "test");
|
||||||
append(ba, "-c");
|
append(ba, "-c");
|
||||||
@@ -611,6 +611,7 @@ fn pkgstartbuild(p: *pkgplan, groups: []pkggroup, builder: str, includes: []str,
|
|||||||
if (g.external) { append(ba, "external"); }
|
if (g.external) { append(ba, "external"); }
|
||||||
else { append(ba, "same"); };
|
else { append(ba, "same"); };
|
||||||
append(ba, g.pkg);
|
append(ba, g.pkg);
|
||||||
|
append(ba, g.dir);
|
||||||
append(ba, g.bin);
|
append(ba, g.bin);
|
||||||
append(ba, g.buildok);
|
append(ba, g.buildok);
|
||||||
i += 1;
|
i += 1;
|
||||||
@@ -976,20 +977,13 @@ export fn packagecommand(args: []str) int = {
|
|||||||
"wwtest package: cannot use -o with multiple packages");
|
"wwtest package: cannot use -o with multiple packages");
|
||||||
return 2;
|
return 2;
|
||||||
};
|
};
|
||||||
let plans: []pkgplan = alloc([], groups.len: u64)!;
|
let plans: []pkgplan = alloc([], 1u64)!;
|
||||||
i = 0;
|
let plan: pkgplan;
|
||||||
for (i < groups.len) {
|
plan.dir = discoverroot;
|
||||||
let p: pkgplan;
|
plan.start = 0;
|
||||||
p.dir = groups[i].dir;
|
plan.end = groups.len;
|
||||||
p.start = i;
|
plan.state = PKGQUEUED;
|
||||||
for (i < groups.len
|
append(plans, plan);
|
||||||
&& strings.compare(groups[i].dir, p.dir) == 0) {
|
|
||||||
i += 1;
|
|
||||||
};
|
|
||||||
p.end = i;
|
|
||||||
p.state = PKGQUEUED;
|
|
||||||
append(plans, p);
|
|
||||||
};
|
|
||||||
|
|
||||||
let borrowed: str = temp.dir();
|
let borrowed: str = temp.dir();
|
||||||
let tmproot: str = strings.dup(borrowed);
|
let tmproot: str = strings.dup(borrowed);
|
||||||
@@ -1009,9 +1003,9 @@ export fn packagecommand(args: []str) int = {
|
|||||||
i += 1;
|
i += 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build one shared package plan per directory. As soon as a plan completes,
|
// Build the complete request in one command-owned package universe. Once
|
||||||
// its successful products may run under the same global -j bound while
|
// the union build completes, successful products run under the same global
|
||||||
// other directory builds remain active. Emission stays ordered below.
|
// -j bound. Emission stays in byte-sorted group order below.
|
||||||
let handles: []exec.process = alloc([], plans.len: u64)!;
|
let handles: []exec.process = alloc([], plans.len: u64)!;
|
||||||
i = 0;
|
i = 0;
|
||||||
for (i < plans.len) {
|
for (i < plans.len) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user