Skip to content

Commit a8b5b0b

Browse files
committed
test: musl payload expectation is host-aware (musl-gcc only exists for Linux hosts)
On macOS/Windows a linux-musl target is cross by definition, so to_xim_package resolves the triple-named package — caught by ci-macos.
1 parent 11b066d commit a8b5b0b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/unit/test_toolchain_registry.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ static std::string host_musl() {
1010
return std::string(mcpp::platform::host_arch) + "-linux-musl";
1111
}
1212

13+
// The host-native `musl-gcc` package only exists for Linux hosts; on other
14+
// hosts the payload mapping resolves the triple-named package (a linux-musl
15+
// target from macOS/Windows is cross by definition).
16+
static std::string expected_musl_xim() {
17+
if constexpr (mcpp::platform::is_linux) return "musl-gcc";
18+
else return host_musl() + "-gcc";
19+
}
20+
1321
// ── canonical two-axis identity ──────────────────────────────────────────────
1422

1523
TEST(ToolchainRegistry, MapsGccSpecToGccPackage) {
@@ -46,7 +54,7 @@ TEST(ToolchainRegistry, LegacyMuslSuffixNormalizesToMuslTarget) {
4654
EXPECT_FALSE(spec->compatHint.empty()); // legacy spelling → hint
4755

4856
auto pkg = to_xim_package(*spec);
49-
EXPECT_EQ(pkg.ximName, "musl-gcc");
57+
EXPECT_EQ(pkg.ximName, expected_musl_xim());
5058
EXPECT_EQ(pkg.ximVersion, "15.1.0");
5159
ASSERT_FALSE(pkg.frontendCandidates.empty());
5260
EXPECT_EQ(pkg.frontendCandidates.front(), host_musl() + "-g++");
@@ -133,7 +141,7 @@ TEST(ToolchainRegistry, ResolvesPartialMuslVersion) {
133141
auto resolved = with_resolved_xim_version(*spec, "15.1.0");
134142
auto pkg = to_xim_package(resolved);
135143
EXPECT_EQ(resolved.version, "15.1.0");
136-
EXPECT_EQ(pkg.ximName, "musl-gcc");
144+
EXPECT_EQ(pkg.ximName, expected_musl_xim());
137145
EXPECT_EQ(pkg.ximVersion, "15.1.0");
138146
EXPECT_EQ(pkg.display_spec(),
139147
std::format("gcc@15.1.0 → {}", host_musl()));

0 commit comments

Comments
 (0)