Skip to content

Commit c52004d

Browse files
committed
tests: 860 holds that more than one compile is under way at -j 4 and one at -j 1 (each compile waits for its own scan); the mingw suite states 182's limit, which the runner reads for a selected case; the design records the scans, the limit and the -B
1 parent 1eb7de1 commit c52004d

3 files changed

Lines changed: 45 additions & 42 deletions

File tree

‎.agents/docs/2026-11-20-test-architecture-upgrade-design.md‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,16 +962,23 @@ doctest 适配器(5.14)、依赖的调试信息(5.15)。boost-m 自己
962962
架构构建 openkal 集合,超过命令的十分钟。无 Visual Studio 的 Windows 上,182 在用例自己的 home 中安装 GNU 行的工具链:
963963
缓存热时 54 s,xlings 版本改变使缓存冷时超过五分钟。两个用例按测量陈述各自的时间(30 分钟、15 分钟)。
964964
- **860 在 macOS 上。** 三个处理器的 runner 上三次编译没有全部重叠(macos-15 与 xcode-27 均出现过,不是每次)。临时
965-
探测排除了内存阈值:三个、六个编译器运行时两种镜像上的可用内存为 2.9–3.5 GB,远高于 1 GiB。与 Linux 的差别在于用例
966-
home 的第一次构建同时编译引擎的模块,clang 下其代码生成可在接口发布后继续占用预算的槽位。用例先构建一次使模块进入
967-
home 的缓存,再测量三个程序的编译;失败时报告图的全部步骤。
965+
探测排除了内存阈值:三个、六个编译器运行时两种镜像上的可用内存为 2.9–3.5 GB,远高于 1 GiB。图的全部步骤(失败时
966+
报告)表明原因在扫描:每次编译等待其单元自己的扫描,同一文件的三次扫描在图开始后 1.9、3.5、7.7 s 结束,第一次编译
967+
在第三次开始前已经结束,而其间有两次同时进行。调度保证的是多于一次编译同时进行,而不是三次同时;用例在 `-j 4`
968+
下断言同时进行的编译至少两次,在 `-j 1` 下恰为一次。
969+
- **两处推导的 `-B`。** 以路径指名的 GCC 陈述 `tools.as` 后,`std` 模块的编译指向该汇编器,普通编译与链接仍由归档
970+
工具所在的目录推导;这样的 GCC 驱动旁没有归档工具,于是没有 `-B`,驱动从 PATH 运行宿主的 `as`(bases 925 在 CI
971+
上失败)。编译与链接改为取
972+
`gcc::binutils_prefix_dir` 的同一个答案。
973+
- **选中用例的时限。** 182 陈述的时限没有生效:程序的列表只列出顶层的用例,选中其下的用例时,运行器的时限是被列出
974+
者陈述的(SPEC-017 O5)。时限改由套件陈述。
968975
- **面的账本:用到而未记录。** 门禁列出 29 项没有通过的用例。其中数项已被用例运行而没有记录:kit 只为 `mcpp()`
969976
运行的命令设置记录文件,以会话、在另一程序之下(`unshare -rn`)或由用例自行运行的命令不写出。kit 改为为它组成的
970977
每条命令设置记录,`mcpp()` 在命令结束时陈述,其余在用例结束时(mtest 的 `at_case_end`)陈述;`options::wrap`
971978
使在另一程序之下运行的命令经由 kit(bundle 990、homes 919)。
972979
- **面的账本:没有用例。** 新用例 1134 至 1140 与已有用例中的步骤覆盖 17 项:加速器的测试与数据库、平台的链接
973980
驱动与封装工具及其 `tools`、平台阶段的指令、平台依赖、C 库声明的测量、伴随的 binutils、另一系统的工具链、链接的
974-
伴随文件、`fetch --package`、模块图的全量核对、上限与信号量。豁免七项,各陈述理由:只由脚本运行的 `--system`;
981+
伴随文件、`fetch --package`、模块图的全量核对、上限与信号量。豁免六项,各陈述理由:只由脚本运行的 `--system`;
975982
没有输入能到达的 `ambiguous-request` 与 `layer-ordering`;只在 Windows 上到达的两个原因;需要自备载体包的
976983
`carrier`。
977984
- **一个答案的两处写法。** `why` 的两种 JSON 对没有记号的拒绝分别报告 `other` 与 `none`;改由拒绝记录的一个函数

‎tests/e2e/windows/mingw.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ void self_contained(const std::string& imports, std::string_view what) {
4040
expect(fatal(!s::contains_nocase(imports, dll))) << what << " imports a toolchain DLL (" << dll << "): " << imports;
4141
}
4242

43-
E2E mingw{"mingw", s::home_fixture, [] {
43+
// The time the suite states is the runner's limit for a case selected in it (SPEC-017 O5). Case
44+
// 182 installs the GNU row's toolchain in a home of its own (an archive of 276 MB): 54 s on a
45+
// runner whose caches were warm, beyond five minutes on one whose caches were cold (CI, 2026-11-20
46+
// and 2026-11-21).
47+
E2E mingw{"mingw", s::home_fixture, timeout{std::chrono::minutes{15}}, [] {
4448
"97 mingw toolchain"_test[s::windows] = [] {
4549
// `toolchain install mingw 16.1.0` installs the payload; `toolchain default mingw@16.1.0`
4650
// persists gcc@16.1.0 and x86_64-windows-gnu, both starred by `list`; a project with a named
@@ -80,10 +84,7 @@ E2E mingw{"mingw", s::home_fixture, [] {
8084
expect(fatal(e2e::succeeded(alone))) << "the build.mcpp helper does not run without the toolchain on PATH: " << s::text(alone);
8185
};
8286

83-
// A home of its own installs the GNU row's toolchain (an archive of 276 MB): 54 s on a runner
84-
// whose caches were warm, beyond five minutes on one whose caches were cold (CI, 2026-11-20
85-
// and 2026-11-21).
86-
"182 windows no msvc fallback"_test[s::windows][s::no_msvc][timeout{std::chrono::minutes{15}}] = [] {
87+
"182 windows no msvc fallback"_test[s::windows][s::no_msvc] = [] {
8788
// A Windows machine without Visual Studio (the CI job masks it) builds on first use: the
8889
// default becomes the GNU-ABI row, the build says so, `list` stars gcc and
8990
// x86_64-windows-gnu, a second build is silent, the program runs alone, and a project that

‎tests/e2e/workspace/graph.cpp‎

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,10 @@ export int consumer_flag_v() {
381381

382382
// Holds the machine: compiles at the same time need the budget's slots (SPEC-017 O11).
383383
"860 a workspaces programs compile at the same time"_test[resource{"machine"}] = [] {
384-
// A: at -j 4 the members' build programs compile at the same time, and three run. B: at
385-
// -j 1 they compile one after another and run in the same order. C: when two do not
386-
// compile, the failure reported is that of the first to run, at either -j.
384+
// A: at -j 4 the members' build programs compile at the same time -- more than one is under
385+
// way at once -- and three run. B: at -j 1 they compile one after another and run in the
386+
// same order. C: when two do not compile, the failure reported is that of the first to
387+
// run, at either -j.
387388
s::project ws(s::case_dir() / "ws", {{"mcpp.toml", "[workspace]\nmembers = [\"pa\", \"pb\", \"pc\"]\n"}});
388389
for (std::string m : {"pa", "pb", "pc"}) {
389390
ws.write(m + "/mcpp.toml", std::format("[package]\nname = \"{0}\"\nversion = \"0.1.0\"\n\n[targets.{0}]\nkind = \"bin\"\nmain = \"src/main.cpp\"\n", m));
@@ -405,47 +406,41 @@ export int consumer_flag_v() {
405406
auto clean = [&] {
406407
for (std::string d : {"target", "pa/target", "pb/target", "pc/target"}) fs::remove_all(ws.at(d));
407408
};
408-
// What A measures is the programs' compiles alone. The first build of the case's home
409-
// also compiles the engine's module (`import mcpp`) into the home's cache, and under
410-
// clang its code generation may continue after its interface is published, holding a
411-
// slot of the budget: on three processors the three compiles then did not all overlap
412-
// (macOS, CI 2026-11-21). A later build stages the module from the cache.
413-
auto r = ws.mcpp({"build", "--workspace", "-j", "4"}, inherited);
414-
expect(fatal(e2e::succeeded(r))) << "A: the workspace did not build at -j 4: " << s::text(r);
415-
clean();
416-
r = ws.mcpp({"build", "--workspace", "-j", "4"}, inherited);
417-
expect(fatal(e2e::succeeded(r))) << "A: the workspace did not build again at -j 4: " << s::text(r);
418-
long latest_start = 0, earliest_end = std::numeric_limits<long>::max();
419-
for (std::string m : {"pa", "pb", "pc"}) {
420-
const auto sp = span(m);
421-
expect(fatal(sp.has_value())) << "A: the build programs' .ninja_log does not record every compile";
422-
latest_start = std::max(latest_start, sp->first);
423-
earliest_end = std::min(earliest_end, sp->second);
424-
}
409+
// The members' compiles, and the most of them under way at one instant.
410+
const auto compiles = [&](std::string_view part) {
411+
std::vector<std::pair<long, long>> out;
412+
for (std::string m : {"pa", "pb", "pc"}) {
413+
const auto sp = span(m);
414+
expect(fatal(sp.has_value())) << part << ": the build programs' .ninja_log does not record the compile of " << m;
415+
out.push_back(*sp);
416+
}
417+
return out;
418+
};
419+
const auto most_at_once = [](const std::vector<std::pair<long, long>>& spans) {
420+
std::size_t most = 0;
421+
for (const auto& [at, _] : spans)
422+
most = std::max<std::size_t>(most, std::ranges::count_if(spans, [&](const auto& o) { return o.first <= at && at < o.second; }));
423+
return most;
424+
};
425425
const auto graph_rows = [&] {
426426
std::string text;
427427
for (const auto& log : s::find_files(ws.at("target/.build-mcpp/host"), R"(\.ninja_log)"))
428428
for (const auto& row : ninja_rows(log)) text += std::format("\n {} {} {}", row[0], row[1], row[3]);
429429
return text;
430430
};
431-
expect(fatal(latest_start < earliest_end)) << "A: the compiles did not overlap at -j 4 (latest start " << latest_start << ", earliest end " << earliest_end << "); the graph's steps:" << graph_rows();
431+
// Not all three at one instant: each compile waits for its own unit's scan, and on three
432+
// processors the scans of the same file ended 1.9, 3.5 and 7.7 s into the graph, so the
433+
// first compile had ended before the third began while two were under way together
434+
// (macOS, CI 2026-11-21).
435+
auto r = ws.mcpp({"build", "--workspace", "-j", "4"}, inherited);
436+
expect(fatal(e2e::succeeded(r))) << "A: the workspace did not build at -j 4: " << s::text(r);
437+
expect(fatal(most_at_once(compiles("A")) >= 2u)) << "A: no two compiles were under way at once at -j 4; the graph's steps:" << graph_rows();
432438
const auto order = ran(s::text(r), "p[abc]");
433439
expect(fatal(order.size() == 3u)) << "A: expected three programs to run, got " << order.size() << ": " << s::text(r);
434440
clean();
435441
r = ws.mcpp({"build", "--workspace", "-j", "1"}, inherited);
436442
expect(fatal(e2e::succeeded(r))) << "B: the workspace did not build at -j 1: " << s::text(r);
437-
std::vector<std::pair<long, long>> spans;
438-
for (std::string m : {"pa", "pb", "pc"}) {
439-
const auto sp = span(m);
440-
expect(fatal(sp.has_value())) << "B: the build programs' .ninja_log does not record the compile of " << m;
441-
spans.push_back(*sp);
442-
}
443-
std::ranges::sort(spans);
444-
long prev_end = 0;
445-
for (const auto& [st, en] : spans) {
446-
expect(fatal(st >= prev_end)) << "B: two compiles overlapped at -j 1";
447-
prev_end = en;
448-
}
443+
expect(fatal(most_at_once(compiles("B")) == 1u)) << "B: two compiles overlapped at -j 1; the graph's steps:" << graph_rows();
449444
expect(fatal(ran(s::text(r), "p[abc]") == order)) << "B: the programs ran in another order at -j 1 than at -j 4";
450445
const auto first = order[0], second = order[1];
451446
ws.write(first + "/build.mcpp", "#include <regex>\n#include <map>\n#error T860-failure-in-" + first + "\nint main() { return 0; }\n");

0 commit comments

Comments
 (0)