CI: skip llvm backend tests in the script for testing x86 backend

This commit is contained in:
Andrew Kelley 2025-06-06 23:34:52 -07:00
parent 125a9aa82b
commit 5a52da1b7a
4 changed files with 37 additions and 11 deletions

View File

@ -97,6 +97,7 @@ pub fn build(b: *std.Build) !void {
const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false; const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;
const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false; const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false;
const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false; const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false;
const skip_llvm = b.option(bool, "skip-llvm", "Main test suite skips targets that use LLVM backend") orelse false;
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
@ -445,8 +446,8 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = skip_libc, .skip_libc = skip_libc,
.use_llvm = use_llvm,
// 2923515904 was observed on an x86_64-linux-gnu host. // 2923515904 was observed on an x86_64-linux-gnu host.
.max_rss = 3100000000, .max_rss = 3100000000,
})); }));
@ -467,8 +468,8 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = skip_libc, .skip_libc = skip_libc,
.use_llvm = use_llvm,
})); }));
test_modules_step.dependOn(tests.addModuleTests(b, .{ test_modules_step.dependOn(tests.addModuleTests(b, .{
@ -487,8 +488,8 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = true, .skip_libc = true,
.use_llvm = use_llvm,
.no_builtin = true, .no_builtin = true,
})); }));
@ -508,8 +509,8 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = true, .skip_libc = true,
.use_llvm = use_llvm,
.no_builtin = true, .no_builtin = true,
})); }));
@ -529,8 +530,8 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_libc = skip_libc, .skip_libc = skip_libc,
.use_llvm = use_llvm,
// I observed a value of 5605064704 on the M2 CI. // I observed a value of 5605064704 on the M2 CI.
.max_rss = 6165571174, .max_rss = 6165571174,
})); }));
@ -571,6 +572,7 @@ pub fn build(b: *std.Build) !void {
.skip_windows = skip_windows, .skip_windows = skip_windows,
.skip_macos = skip_macos, .skip_macos = skip_macos,
.skip_linux = skip_linux, .skip_linux = skip_linux,
.skip_llvm = skip_llvm,
.skip_release = skip_release, .skip_release = skip_release,
})); }));
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows)); test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));

View File

@ -63,6 +63,7 @@ stage3-debug/bin/zig build test docs \
-Dskip-netbsd \ -Dskip-netbsd \
-Dskip-windows \ -Dskip-windows \
-Dskip-macos \ -Dskip-macos \
-Dskip-llvm \
-Dtarget=native-native-musl \ -Dtarget=native-native-musl \
--search-prefix "$PREFIX" \ --search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \ --zig-lib-dir "$PWD/../lib" \

View File

@ -2581,12 +2581,16 @@ pub fn standardDynamicLinkerPath(target: Target) DynamicLinker {
} }
pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 { pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {
return ptrBitWidth_arch_abi(cpu.arch, abi);
}
pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
switch (abi) { switch (abi) {
.gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32, .gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32,
.gnuabi64, .muslabi64 => return 64, .gnuabi64, .muslabi64 => return 64,
else => {}, else => {},
} }
return switch (cpu.arch) { return switch (cpu_arch) {
.avr, .avr,
.msp430, .msp430,
=> 16, => 16,

View File

@ -2278,8 +2278,8 @@ const ModuleTestOptions = struct {
skip_windows: bool, skip_windows: bool,
skip_macos: bool, skip_macos: bool,
skip_linux: bool, skip_linux: bool,
skip_llvm: bool,
skip_libc: bool, skip_libc: bool,
use_llvm: ?bool = null,
max_rss: usize = 0, max_rss: usize = 0,
no_builtin: bool = false, no_builtin: bool = false,
build_options: ?*std.Build.Step.Options = null, build_options: ?*std.Build.Step.Options = null,
@ -2306,6 +2306,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
if (options.skip_macos and test_target.target.os_tag == .macos) continue; if (options.skip_macos and test_target.target.os_tag == .macos) continue;
if (options.skip_linux and test_target.target.os_tag == .linux) continue; if (options.skip_linux and test_target.target.os_tag == .linux) continue;
const would_use_llvm = wouldUseLlvm(test_target.use_llvm, test_target.target, test_target.optimize_mode);
if (options.skip_llvm and would_use_llvm) continue;
const resolved_target = b.resolveTargetQuery(test_target.target); const resolved_target = b.resolveTargetQuery(test_target.target);
const target = resolved_target.result; const target = resolved_target.result;
const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");
@ -2326,10 +2329,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
if (options.skip_single_threaded and test_target.single_threaded == true) if (options.skip_single_threaded and test_target.single_threaded == true)
continue; continue;
if (options.use_llvm) |use_llvm| {
if (test_target.use_llvm != use_llvm) continue;
}
// TODO get compiler-rt tests passing for self-hosted backends. // TODO get compiler-rt tests passing for self-hosted backends.
if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and
test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt")) test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt"))
@ -2509,6 +2508,22 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
return step; return step;
} }
fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: OptimizeMode) bool {
if (use_llvm) |x| return x;
if (query.ofmt == .c) return false;
switch (optimize_mode) {
.Debug => {},
else => return true,
}
const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
switch (cpu_arch) {
.x86_64 => if (std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,
.spirv, .spirv32, .spirv64 => return false,
else => return true,
}
return false;
}
const CAbiTestOptions = struct { const CAbiTestOptions = struct {
test_target_filters: []const []const u8, test_target_filters: []const []const u8,
skip_non_native: bool, skip_non_native: bool,
@ -2517,6 +2532,7 @@ const CAbiTestOptions = struct {
skip_windows: bool, skip_windows: bool,
skip_macos: bool, skip_macos: bool,
skip_linux: bool, skip_linux: bool,
skip_llvm: bool,
skip_release: bool, skip_release: bool,
}; };
@ -2536,6 +2552,9 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue; if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue;
if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue; if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue;
const would_use_llvm = wouldUseLlvm(c_abi_target.use_llvm, c_abi_target.target, .Debug);
if (options.skip_llvm and would_use_llvm) continue;
const resolved_target = b.resolveTargetQuery(c_abi_target.target); const resolved_target = b.resolveTargetQuery(c_abi_target.target);
const target = resolved_target.result; const target = resolved_target.result;
const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");