mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
test: Enable -Dtest-target-filter=... to work for test-c-abi.
This commit is contained in:
parent
1e0267a96b
commit
9c7776a938
2 changed files with 22 additions and 5 deletions
|
|
@ -541,7 +541,11 @@ pub fn build(b: *std.Build) !void {
|
|||
enable_ios_sdk,
|
||||
enable_symlinks_windows,
|
||||
));
|
||||
test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release));
|
||||
test_step.dependOn(tests.addCAbiTests(b, .{
|
||||
.test_target_filters = test_target_filters,
|
||||
.skip_non_native = skip_non_native,
|
||||
.skip_release = skip_release,
|
||||
}));
|
||||
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
|
||||
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
|
||||
test_step.dependOn(tests.addCliTests(b));
|
||||
|
|
|
|||
|
|
@ -1486,19 +1486,32 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
|
|||
return step;
|
||||
}
|
||||
|
||||
pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *Step {
|
||||
const CAbiTestOptions = struct {
|
||||
test_target_filters: []const []const u8,
|
||||
skip_non_native: bool,
|
||||
skip_release: bool,
|
||||
};
|
||||
|
||||
pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
|
||||
const step = b.step("test-c-abi", "Run the C ABI tests");
|
||||
|
||||
const optimize_modes: [3]OptimizeMode = .{ .Debug, .ReleaseSafe, .ReleaseFast };
|
||||
|
||||
for (optimize_modes) |optimize_mode| {
|
||||
if (optimize_mode != .Debug and skip_release) continue;
|
||||
if (optimize_mode != .Debug and options.skip_release) continue;
|
||||
|
||||
for (c_abi_targets) |c_abi_target| {
|
||||
if (skip_non_native and !c_abi_target.target.isNative()) continue;
|
||||
if (options.skip_non_native and !c_abi_target.target.isNative()) continue;
|
||||
|
||||
const resolved_target = b.resolveTargetQuery(c_abi_target.target);
|
||||
const target = resolved_target.result;
|
||||
const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");
|
||||
|
||||
if (options.test_target_filters.len > 0) {
|
||||
for (options.test_target_filters) |filter| {
|
||||
if (std.mem.indexOf(u8, triple_txt, filter) != null) break;
|
||||
} else continue;
|
||||
}
|
||||
|
||||
if (target.os.tag == .windows and target.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/14908
|
||||
|
|
@ -1507,7 +1520,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S
|
|||
|
||||
const test_step = b.addTest(.{
|
||||
.name = b.fmt("test-c-abi-{s}-{s}-{s}{s}{s}{s}", .{
|
||||
target.zigTriple(b.allocator) catch @panic("OOM"),
|
||||
triple_txt,
|
||||
target.cpu.model.name,
|
||||
@tagName(optimize_mode),
|
||||
if (c_abi_target.use_llvm == true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue