ww: report no test files for empty test packages
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
package no_tests;
|
||||
|
||||
fn init() void = { abort(); };
|
||||
|
||||
export fn value() int = { return 1; };
|
||||
|
||||
@@ -1407,8 +1407,8 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
expectexit(&outw, 0);
|
||||
assert(same(outc.stdout, outw.stdout));
|
||||
assert(same(outc.stderr, outw.stderr) && outc.stderr.len == 0);
|
||||
assert(has(outc.stdout, strings.concat("? ", plain, " [no tests]\n")));
|
||||
assert(has(outc.stdout, strings.concat("? ", cmdno, " [no tests]\n")));
|
||||
assert(has(outc.stdout, strings.concat("? ", plain, " [no test files]\n")));
|
||||
assert(has(outc.stdout, strings.concat("? ", cmdno, " [no test files]\n")));
|
||||
assert(!has(outc.stdout, "plain-init"));
|
||||
assert(!has(outc.stdout, "cmdno-init"));
|
||||
assert(!has(outc.stdout, "cmdno-main"));
|
||||
@@ -1968,13 +1968,29 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
|
||||
@test fn empty_and_invalid_package_classes() void = {
|
||||
let root: str = fresh();
|
||||
let av: []str = [driver("ww"), "test", packagepath("no_tests")];
|
||||
let stages: []str = ["ww", "ww_ww"];
|
||||
let out: commandout;
|
||||
runcommand(root, "notests", av,
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(has(out.stdout, " [no tests]\n"));
|
||||
assert(!has(out.stdout, " ... ok"));
|
||||
let nofiles: str = strings.concat("? ", packagepath("no_tests"),
|
||||
" [no test files]\n");
|
||||
let si: i32 = 0;
|
||||
for (si < stages.len) {
|
||||
let av: []str = [driver(stages[si]), "test", packagepath("no_tests")];
|
||||
runcommand(root, strings.concat("notests-explicit-", stages[si]), av,
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(same(out.stdout, nofiles));
|
||||
assert(out.stderr.len == 0);
|
||||
assert(!has(out.stdout, " ... ok"));
|
||||
|
||||
let implicit: []str = [driver(stages[si]), "test"];
|
||||
runcommanddir(root, strings.concat("notests-implicit-", stages[si]),
|
||||
packagepath("no_tests"), implicit,
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(same(out.stdout, nofiles));
|
||||
assert(out.stderr.len == 0);
|
||||
si += 1;
|
||||
};
|
||||
|
||||
let bad: []str = [driver("ww"), "test", packagepath("bad_external")];
|
||||
runcommand(root, "badexternal", bad,
|
||||
@@ -2000,7 +2016,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 1);
|
||||
assert(has(out.stderr, "cannot find package nowhere"));
|
||||
assert(!has(out.stdout, "[no tests]"));
|
||||
assert(!has(out.stdout, "[no test files]"));
|
||||
|
||||
// A test file is part of its variant even when it only supplies helpers.
|
||||
// Its imports and package clause must therefore reach the shared loader;
|
||||
@@ -2011,8 +2027,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
"package helperbad;\nexport fn value() i32 = { return 1; };\n");
|
||||
writefile(strings.concat(helperbad, "/helper_test.ww"),
|
||||
"package helperbad_test;\nimport nowhere;\nfn helper() void = { };\n");
|
||||
let stages: []str = ["ww", "ww_ww"];
|
||||
let si: i32 = 0;
|
||||
si = 0;
|
||||
for (si < stages.len) {
|
||||
let helperav: []str = [driver(stages[si]), "test", helperbad];
|
||||
runcommand(root, strings.concat("helper-only-", stages[si]), helperav,
|
||||
@@ -2078,7 +2093,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(has(out.stdout, "multiline.actually_runs ... ok\n"));
|
||||
assert(!has(out.stdout, "[no tests]"));
|
||||
assert(!has(out.stdout, "[no test files]"));
|
||||
|
||||
let commented: str = strings.concat(root, "/commented-test");
|
||||
assert(os.mkdir(commented, 448i32) == 0);
|
||||
@@ -2093,7 +2108,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
(30i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(has(out.stdout, "ok "));
|
||||
assert(!has(out.stdout, " [no tests]\n"));
|
||||
assert(!has(out.stdout, " [no test files]\n"));
|
||||
assert(!has(out.stdout, "phantom"));
|
||||
|
||||
// Go's complete empty-package matrix: production-only, internal-only,
|
||||
@@ -2163,9 +2178,9 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
};
|
||||
shi += 1;
|
||||
};
|
||||
assert(has(shaperefs[0], " [no tests]\n"));
|
||||
assert(has(shaperefs[0], " [no test files]\n"));
|
||||
assert(occurrences(shaperefs[0], strings.concat(
|
||||
"? ", prodonly, " [no tests]\n")) == 1);
|
||||
"? ", prodonly, " [no test files]\n")) == 1);
|
||||
assert(has(shaperefs[1], "shapeinternal.internal_runs ... ok\n"));
|
||||
assert(has(shaperefs[2], "shapeexternal.external_runs ... ok\n"));
|
||||
assert(occurrences(shaperefs[3], " ... ok\n") == 2);
|
||||
@@ -3979,7 +3994,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
expectexit(&out, 0);
|
||||
assert(occurrences(out.stdout, "built ") == 0);
|
||||
assert(has(out.stdout, strings.concat(
|
||||
"? ", gamma, " [no tests]\n")));
|
||||
"? ", gamma, " [no test files]\n")));
|
||||
assert(os.exists(publicalpha) && os.exists(publicbeta));
|
||||
assert(!os.exists(publicgamma));
|
||||
assert(!os.exists(strings.concat(alpha, "/alpha_test.test")));
|
||||
@@ -5039,7 +5054,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(has(out.stdout, strings.concat("ok ", suite,
|
||||
"/p051 [p051]\n")));
|
||||
assert(has(out.stdout, strings.concat("? ", suite,
|
||||
"/p256 [no tests]\n")));
|
||||
"/p256 [no test files]\n")));
|
||||
|
||||
let beforecompiler: i32 = readfile(compilertraces[si]).len;
|
||||
runcommandenv(root, strings.concat("dynamic-coordinator-warm-",
|
||||
@@ -8228,7 +8243,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(has(out.stdout, "selected_internal_pair ... ok\n"));
|
||||
assert(has(out.stdout, "selected_external_pair ... ok\n"));
|
||||
assert(has(out.stdout, strings.concat("? ", notests,
|
||||
" [no tests]\n")));
|
||||
" [no test files]\n")));
|
||||
assert(!has(out.stdout, "wrong_target_test"));
|
||||
assert(!has(out.stderr, "only_windows"));
|
||||
assert(!has(readfile(compilertrace), "dep.wrong"));
|
||||
@@ -9307,11 +9322,11 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(has(seq, strings.concat("ok ", tree,
|
||||
"/domain/app [app]\n")));
|
||||
assert(has(seq, strings.concat("? ", tree,
|
||||
"/gamma [no tests]\n")));
|
||||
"/gamma [no test files]\n")));
|
||||
assert(has(seq, strings.concat("? ", tree,
|
||||
"/vendor [no tests]\n")));
|
||||
"/vendor [no test files]\n")));
|
||||
assert(has(seq, strings.concat("? ", tree,
|
||||
"/vendorx [no tests]\n")));
|
||||
"/vendorx [no test files]\n")));
|
||||
let rootreport: i32 = pos(seq, strings.concat("ok ", tree,
|
||||
" [rootpkg]\n"));
|
||||
let alphareport: i32 = pos(seq, strings.concat("ok ", tree,
|
||||
@@ -9323,11 +9338,11 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
let domainreport: i32 = pos(seq, strings.concat("ok ", tree,
|
||||
"/domain/app [app]\n"));
|
||||
let gammareport: i32 = pos(seq, strings.concat("? ", tree,
|
||||
"/gamma [no tests]\n"));
|
||||
"/gamma [no test files]\n"));
|
||||
let vendorreport: i32 = pos(seq, strings.concat("? ", tree,
|
||||
"/vendor [no tests]\n"));
|
||||
"/vendor [no test files]\n"));
|
||||
let vendorxreport: i32 = pos(seq, strings.concat("? ", tree,
|
||||
"/vendorx [no tests]\n"));
|
||||
"/vendorx [no test files]\n"));
|
||||
assert(rootreport >= 0 && rootreport < alphareport
|
||||
&& alphareport < appreport && appreport < innerreport
|
||||
&& innerreport < domainreport && domainreport < gammareport
|
||||
@@ -9342,11 +9357,11 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(occurrences(seq, strings.concat("ok ", tree,
|
||||
"/domain/app [app]\n")) == 1);
|
||||
assert(occurrences(seq, strings.concat("? ", tree,
|
||||
"/gamma [no tests]\n")) == 1);
|
||||
"/gamma [no test files]\n")) == 1);
|
||||
assert(occurrences(seq, strings.concat("? ", tree,
|
||||
"/vendor [no tests]\n")) == 1);
|
||||
"/vendor [no test files]\n")) == 1);
|
||||
assert(occurrences(seq, strings.concat("? ", tree,
|
||||
"/vendorx [no tests]\n")) == 1);
|
||||
"/vendorx [no test files]\n")) == 1);
|
||||
assert(!has(seq, ".hidden"));
|
||||
assert(!has(seq, "_skip"));
|
||||
assert(!has(seq, "/testdata"));
|
||||
@@ -9488,7 +9503,7 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(same(outc.stdout, outw.stdout));
|
||||
assert(same(outc.stderr, outw.stderr));
|
||||
assert(has(outc.stdout, strings.concat("? ", tree,
|
||||
"/vendor [no tests]\n")));
|
||||
"/vendor [no test files]\n")));
|
||||
assert(has(outc.stdout, strings.concat("ok ", tree,
|
||||
"/vendor/bad [bad]\n")));
|
||||
assert(!has(outc.stdout, "/vendor/bad/vendor/deep"));
|
||||
@@ -9506,14 +9521,14 @@ fn cwdwritedata(dir: str, label: str) void = {
|
||||
assert(same(outc.stdout, outw.stdout));
|
||||
assert(same(outc.stderr, outw.stderr));
|
||||
assert(has(outc.stdout, strings.concat("? ", tree,
|
||||
"/app/vendor/lib/math [no tests]\n")));
|
||||
"/app/vendor/lib/math [no test files]\n")));
|
||||
let vendorroots: []str = [driver("ww"), "test", "-I", tree,
|
||||
strings.concat(tree, "/app/vendor/...")];
|
||||
runcommand(root, "tree-pattern-below-vendor", vendorroots,
|
||||
(30i64 * (time.second: i64)): time.duration, &outc);
|
||||
expectexit(&outc, 0);
|
||||
assert(has(outc.stdout, strings.concat("? ", tree,
|
||||
"/app/vendor/lib/math [no tests]\n")));
|
||||
"/app/vendor/lib/math [no test files]\n")));
|
||||
|
||||
// A child symlink is never traversed. The same symlink is followed when it
|
||||
// is itself the explicit traversal root, then canonical output names it once.
|
||||
@@ -12690,7 +12705,8 @@ fn runtimepath(relative: str) str = {
|
||||
let fanpkg: str = strings.concat(fanarg, "pkg.test");
|
||||
assert(os.exists(fanabin) && os.exists(fanpkg));
|
||||
assert(!os.exists(strings.concat(fanarg, "znone.test")));
|
||||
assert(has(out.stdout, strings.concat("? ", none, " [no tests]\n")));
|
||||
assert(has(out.stdout, strings.concat("? ", none,
|
||||
" [no test files]\n")));
|
||||
if (i == 0) {
|
||||
fanabytes = readfile(fanabin);
|
||||
fanpkgbytes = readfile(fanpkg);
|
||||
@@ -12945,7 +12961,7 @@ fn runtimepath(relative: str) str = {
|
||||
(60i64 * (time.second: i64)): time.duration, &out);
|
||||
expectexit(&out, 0);
|
||||
assert(has(out.stdout, strings.concat("? ", none,
|
||||
" [no tests]\n")));
|
||||
" [no test files]\n")));
|
||||
assert(out.stderr.len == 0 && !os.exists(noneroot));
|
||||
|
||||
// Pinned builderTest makes the install action depend on the run action.
|
||||
|
||||
Reference in New Issue
Block a user