Skip to content

Commit 6612505

Browse files
committed
test: verify native GCC mappings and retain ARM64 ELF link evidence
1 parent 553861c commit 6612505

5 files changed

Lines changed: 60 additions & 5 deletions

File tree

‎.agents/docs/2026-10-08-llvm-2313-part2-execution-and-dependencies.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,26 @@ GCC 16.1.0 对照验证:正常环境编译成功;显式不存在的 GCC_ROOT
242242
ARM64 消费门切换至 musl GCC 时同一测试变量造成的前端查找污染,
243243
但 Windows 与 ARM64 的最终通过状态仍须新头执行确认。引擎算法、
244244
编译器归档及镜像摘要不变,无须重新发布资源。
245+
246+
## 12. 2026-10-08 Windows 回归通过与原生 GNU 单测证据
247+
248+
提交 553861c4 的 [bare Windows job](https://github.com/mcpp-community/mcpp/actions/runs/37701315331/job/113069650755)
249+
通过首次 fallback、配置持久化、独立 exe 与显式选择验证;同头 Windows
250+
单测与打包亦通过。该结果验证第 11 节的 GCC_ROOT 根因修复,不能将
251+
此前失败继续作为基础设施豁免。测试抽象层的四项回归纳入 CI fixture
252+
门。Ubuntu GCC 13 不处理本次 GCC_ROOT 控制,而生态 GCC 16 处理;
253+
测试分别保持真实驱动的基线,显式选择生态驱动时要求负控制重现失败。
254+
255+
同头 [原生候选消费门](https://github.com/mcpp-community/mcpp/actions/runs/37701961377)
256+
已通过 LLVM/GNU 冷安装、头文件隔离、std/std.compat、打包部署、
257+
GCC-musl 回归及 GNU 自举。完整单测为 145/147:工具链注册测试仍
258+
将非 x86 Linux 的原生 GCC 映射写成 gcc,现改按实际 musl-gcc
259+
载荷验证;ELF 测试发现静态 libunwind 的 32 个动态导出符号。
260+
GNU host helper、四个真实索引成员与 openkal 原生消费尚未执行。
261+
262+
ARM64 与 x86_64 的 libunwind.a 都具有默认可见的全局符号。
263+
使用同一 ARM64 候选归档交叉链接的异常程序在 QEMU 下运行成功,
264+
静态归档组合导出零个 unwind 符号;额外链接 libunwind.so 则导出
265+
31 个并增加对应 DT_NEEDED。这是定位对照,不能替代原生消费证明。
266+
失败门补存实际测试 ELF、readelf 结果与 build.ninja,再根据链接
267+
闭包判断原因;尚不调整资产、不隐藏导出以替代动态依赖诊断。

‎.github/workflows/ci-aarch64-fresh-install.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,23 @@ jobs:
326326
run: |
327327
set -euo pipefail
328328
"$MCPP_NATIVE_GNU" test --toolchain llvm@23.1.3 --target aarch64-linux-gnu 2>&1 | tee "$MCPP_NATIVE_REPORT_DIR/gnu-tests.log"
329+
- name: Preserve native ELF and link evidence when the suite fails
330+
if: failure()
331+
run: |
332+
set -euo pipefail
333+
evidence="$MCPP_NATIVE_REPORT_DIR/native-link-evidence"
334+
mkdir -p "$evidence"
335+
while IFS= read -r -d '' binary; do
336+
relative="${binary#target/}"
337+
mkdir -p "$evidence/$(dirname "$relative")"
338+
cp "$binary" "$evidence/$relative"
339+
readelf -aW "$binary" > "$evidence/$relative.readelf.txt"
340+
done < <(find target/aarch64-linux-gnu -type f -path '*/bin/unit/test_elf_runtime' -print0)
341+
while IFS= read -r -d '' plan; do
342+
relative="${plan#target/}"
343+
mkdir -p "$evidence/$(dirname "$relative")"
344+
cp "$plan" "$evidence/$relative"
345+
done < <(find target/aarch64-linux-gnu -type f -name build.ninja -print0)
329346
- name: GNU mcpp builds the LLVM path host helper (804 LLVM case only)
330347
env:
331348
MCPP: ${{ env.MCPP_NATIVE_GNU }}

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ jobs:
143143
python3 tests/scripts/test_check_e2e_coverage.py
144144
python3 tests/scripts/test_check_default_toolchain_docs.py
145145
python3 tests/scripts/test_native_candidate_admission.py
146+
python3 -m unittest discover -s tests/scripts -p test_toolchain_env.py
146147
147148
build-linux:
148149
needs: changes

‎tests/scripts/test_toolchain_env.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ def test_real_gcc_compiles_after_helper_without_losing_user_prefix(self):
3030
# missing-cc1plus failure from the isolated Windows fixture.
3131
bad_env = dict(env, GCC_ROOT=str(root / 'missing-gcc-root'))
3232
bad = subprocess.run(args, env=bad_env, capture_output=True, text=True)
33-
self.assertNotEqual(bad.returncode, 0)
34-
self.assertIn('cc1plus', bad.stderr)
33+
# Distro GCC 13 can ignore GCC_ROOT; the ecosystem GCC 16
34+
# relocation build honors it. Preserve each real driver's
35+
# baseline, and require the negative control when that payload
36+
# was explicitly selected for this regression.
37+
if os.environ.get('MCPP_E2E_GCC_DRIVER'):
38+
self.assertNotEqual(bad.returncode, 0)
39+
self.assertIn('cc1plus', bad.stderr)
3540
for context, expected in ((env, 0), (bad_env, bad.returncode)):
3641
after = subprocess.run(
3742
['bash', '-c', 'source "$1"; shift; "$@"', 'bash', str(HELPER), *args],

‎tests/unit/test_toolchain_registry.cpp‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,19 @@ TEST(ToolchainRegistry, MapsGccSpecToGccPackage) {
4646
// gcc family on a Windows host = MinGW-w64 (the GNU-env host toolchain).
4747
EXPECT_EQ(pkg.ximName, "mingw-gcc");
4848
#else
49-
EXPECT_EQ(pkg.ximName, "gcc");
50-
EXPECT_TRUE(pkg.needsGccPostInstallFixup);
5149
ASSERT_FALSE(pkg.frontendCandidates.empty());
52-
EXPECT_EQ(pkg.frontendCandidates.front(), "g++");
50+
if constexpr (mcpp::platform::is_linux
51+
&& mcpp::platform::host_arch != std::string_view("x86_64")) {
52+
// Non-x86 Linux native GCC payloads are musl-backed even when the host
53+
// process uses glibc. Its driver needs no glibc specs fixup.
54+
EXPECT_EQ(pkg.ximName, "musl-gcc");
55+
EXPECT_FALSE(pkg.needsGccPostInstallFixup);
56+
EXPECT_EQ(pkg.frontendCandidates.front(), host_musl() + "-g++");
57+
} else {
58+
EXPECT_EQ(pkg.ximName, "gcc");
59+
EXPECT_TRUE(pkg.needsGccPostInstallFixup);
60+
EXPECT_EQ(pkg.frontendCandidates.front(), "g++");
61+
}
5362
#endif
5463
EXPECT_EQ(pkg.ximVersion, "16.1.0");
5564
EXPECT_EQ(pkg.display_spec(), "gcc@16.1.0");

0 commit comments

Comments
 (0)