build: add build test check for availability of IOS SDK on the host

This commit is contained in:
Jakub Konka 2023-08-18 11:57:12 +02:00
parent 1e899b8769
commit 517a2c7caf
2 changed files with 13 additions and 3 deletions

View file

@ -129,6 +129,7 @@ pub fn build(b: *std.Build) !void {
"Whether LLVM has the experimental target xtensa enabled", "Whether LLVM has the experimental target xtensa enabled",
) orelse false; ) orelse false;
const enable_macos_sdk = b.option(bool, "enable-macos-sdk", "Run tests requiring presence of macOS SDK and frameworks") orelse false; const enable_macos_sdk = b.option(bool, "enable-macos-sdk", "Run tests requiring presence of macOS SDK and frameworks") orelse false;
const enable_ios_sdk = b.option(bool, "enable-ios-sdk", "Run tests requiring presence of iOS SDK and frameworks") orelse false;
const enable_symlinks_windows = b.option(bool, "enable-symlinks-windows", "Run tests requiring presence of symlinks on Windows") orelse false; const enable_symlinks_windows = b.option(bool, "enable-symlinks-windows", "Run tests requiring presence of symlinks on Windows") orelse false;
const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h"); const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
@ -485,11 +486,12 @@ pub fn build(b: *std.Build) !void {
b, b,
optimization_modes, optimization_modes,
enable_macos_sdk, enable_macos_sdk,
enable_ios_sdk,
false, false,
enable_symlinks_windows, enable_symlinks_windows,
)); ));
test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release)); test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release));
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, false, enable_symlinks_windows)); test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, false, enable_symlinks_windows));
test_step.dependOn(tests.addStackTraceTests(b, test_filter, optimization_modes)); test_step.dependOn(tests.addStackTraceTests(b, test_filter, optimization_modes));
test_step.dependOn(tests.addCliTests(b)); test_step.dependOn(tests.addCliTests(b));
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, optimization_modes)); test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, optimization_modes));

View file

@ -566,6 +566,7 @@ pub fn addStandaloneTests(
b: *std.Build, b: *std.Build,
optimize_modes: []const OptimizeMode, optimize_modes: []const OptimizeMode,
enable_macos_sdk: bool, enable_macos_sdk: bool,
enable_ios_sdk: bool,
omit_stage2: bool, omit_stage2: bool,
enable_symlinks_windows: bool, enable_symlinks_windows: bool,
) *Step { ) *Step {
@ -615,10 +616,13 @@ pub fn addStandaloneTests(
case.import.requires_symlinks; case.import.requires_symlinks;
const requires_macos_sdk = @hasDecl(case.import, "requires_macos_sdk") and const requires_macos_sdk = @hasDecl(case.import, "requires_macos_sdk") and
case.import.requires_macos_sdk; case.import.requires_macos_sdk;
const requires_ios_sdk = @hasDecl(case.import, "requires_ios_sdk") and
case.import.requires_ios_sdk;
const bad = const bad =
(requires_stage2 and omit_stage2) or (requires_stage2 and omit_stage2) or
(requires_symlinks and omit_symlinks) or (requires_symlinks and omit_symlinks) or
(requires_macos_sdk and !enable_macos_sdk); (requires_macos_sdk and !enable_macos_sdk) or
(requires_ios_sdk and !enable_ios_sdk);
if (!bad) { if (!bad) {
const dep = b.anonymousDependency(case.build_root, case.import, .{}); const dep = b.anonymousDependency(case.build_root, case.import, .{});
const dep_step = dep.builder.default_step; const dep_step = dep.builder.default_step;
@ -635,6 +639,7 @@ pub fn addStandaloneTests(
pub fn addLinkTests( pub fn addLinkTests(
b: *std.Build, b: *std.Build,
enable_macos_sdk: bool, enable_macos_sdk: bool,
enable_ios_sdk: bool,
omit_stage2: bool, omit_stage2: bool,
enable_symlinks_windows: bool, enable_symlinks_windows: bool,
) *Step { ) *Step {
@ -648,10 +653,13 @@ pub fn addLinkTests(
case.import.requires_symlinks; case.import.requires_symlinks;
const requires_macos_sdk = @hasDecl(case.import, "requires_macos_sdk") and const requires_macos_sdk = @hasDecl(case.import, "requires_macos_sdk") and
case.import.requires_macos_sdk; case.import.requires_macos_sdk;
const requires_ios_sdk = @hasDecl(case.import, "requires_ios_sdk") and
case.import.requires_ios_sdk;
const bad = const bad =
(requires_stage2 and omit_stage2) or (requires_stage2 and omit_stage2) or
(requires_symlinks and omit_symlinks) or (requires_symlinks and omit_symlinks) or
(requires_macos_sdk and !enable_macos_sdk); (requires_macos_sdk and !enable_macos_sdk) or
(requires_ios_sdk and !enable_ios_sdk);
if (!bad) { if (!bad) {
const dep = b.anonymousDependency(case.build_root, case.import, .{}); const dep = b.anonymousDependency(case.build_root, case.import, .{});
const dep_step = dep.builder.default_step; const dep_step = dep.builder.default_step;