Skip to content

Commit 14fc49c

Browse files
committed
test(toolchain): make musl frontend assertions host-aware
B1 changed the musl frontend candidate list on Windows hosts (.exe first), and these two assertions pinned the bare spelling as front(). They pass on Linux either way, which is exactly why the break only showed up in Windows CI — the same blind spot that let B1 itself survive. Adds expected_musl_frontend() next to the existing expected_musl_xim() helper, mirroring how the mingw test already handles the host split. The helper states why .exe comes first rather than leaving a bare constant.
1 parent 6c13349 commit 14fc49c

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/unit/test_toolchain_registry.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ static std::string expected_musl_xim() {
1818
else return host_musl() + "-gcc";
1919
}
2020

21+
// Frontend candidates are host-aware for the same reason the mingw ones are:
22+
// they are resolved with filesystem::exists, and on a Windows host the file on
23+
// disk is `<triple>-g++.exe`. The .exe spelling comes first so it wins on a
24+
// case-insensitive filesystem where both would match.
25+
static std::string expected_musl_frontend(const std::string& triple) {
26+
if constexpr (mcpp::platform::is_windows) return triple + "-g++.exe";
27+
else return triple + "-g++";
28+
}
29+
2130
// ── canonical two-axis identity ──────────────────────────────────────────────
2231

2332
TEST(ToolchainRegistry, MapsGccSpecToGccPackage) {
@@ -57,7 +66,7 @@ TEST(ToolchainRegistry, LegacyMuslSuffixNormalizesToMuslTarget) {
5766
EXPECT_EQ(pkg.ximName, expected_musl_xim());
5867
EXPECT_EQ(pkg.ximVersion, "15.1.0");
5968
ASSERT_FALSE(pkg.frontendCandidates.empty());
60-
EXPECT_EQ(pkg.frontendCandidates.front(), host_musl() + "-g++");
69+
EXPECT_EQ(pkg.frontendCandidates.front(), expected_musl_frontend(host_musl()));
6170
EXPECT_FALSE(pkg.needsGccPostInstallFixup);
6271
}
6372

@@ -73,7 +82,7 @@ TEST(ToolchainRegistry, CrossArchMuslTargetPicksTripleNamedPackage) {
7382
auto pkg = to_xim_package(spec);
7483
EXPECT_EQ(pkg.ximName, spec.target.str() + "-gcc");
7584
ASSERT_FALSE(pkg.frontendCandidates.empty());
76-
EXPECT_EQ(pkg.frontendCandidates.front(), spec.target.str() + "-g++");
85+
EXPECT_EQ(pkg.frontendCandidates.front(), expected_musl_frontend(spec.target.str()));
7786
EXPECT_FALSE(pkg.needsGccPostInstallFixup);
7887
}
7988

0 commit comments

Comments
 (0)