mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
test-link: add -Denable-symlinks-windows to opt-in to using symlinks
Adds a way for standalone tests to declare they need symlinks, and these tests won't be run on windows unless -Denable-symlinks-windows is set
This commit is contained in:
parent
30eb2a1753
commit
57bc61ab26
@ -88,6 +88,7 @@ pub fn build(b: *Builder) !void {
|
||||
"Whether LLVM has the experimental target arc enabled",
|
||||
) 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_symlinks_windows = b.option(bool, "enable-symlinks-windows", "Enable using symlinks on Windows. If this is not set, hardlinks are used.") orelse false;
|
||||
const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
|
||||
|
||||
if (!skip_install_lib_files) {
|
||||
@ -519,9 +520,10 @@ pub fn build(b: *Builder) !void {
|
||||
b.enable_rosetta,
|
||||
b.enable_wasmtime,
|
||||
b.enable_wine,
|
||||
enable_symlinks_windows,
|
||||
));
|
||||
test_step.dependOn(tests.addCAbiTests(b, skip_non_native));
|
||||
test_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk, skip_stage2_tests));
|
||||
test_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk, skip_stage2_tests, enable_symlinks_windows));
|
||||
test_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
|
||||
test_step.dependOn(tests.addCliTests(b, test_filter, modes));
|
||||
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
|
||||
|
@ -49,7 +49,8 @@ Write-Output " zig build test docs..."
|
||||
& "$ZIGINSTALLDIR\bin\zig.exe" build test docs `
|
||||
--search-prefix "$ZIGPREFIXPATH" `
|
||||
-Dstatic-llvm `
|
||||
-Dskip-non-native
|
||||
-Dskip-non-native `
|
||||
-Denable-symlinks-windows
|
||||
CheckLastExitCode
|
||||
|
||||
# Produce the experimental std lib documentation.
|
||||
|
@ -82,83 +82,102 @@ fn addMachOCases(cases: *tests.StandaloneContext) void {
|
||||
cases.addBuildFile("test/link/macho/bugs/13056/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/bugs/13457/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/dead_strip/build.zig", .{
|
||||
.build_modes = false,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/dead_strip_dylibs/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/dylib/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/empty/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/entry/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/headerpad/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
});
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/linksection/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/needed_framework/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/needed_library/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/objc/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/objcpp/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/pagezero/build.zig", .{
|
||||
.build_modes = false,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/search_strategy/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/stack_size/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/tls/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/weak_library/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/macho/weak_framework/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
.requires_symlinks = true,
|
||||
});
|
||||
}
|
||||
|
@ -505,6 +505,7 @@ pub fn addStandaloneTests(
|
||||
enable_rosetta: bool,
|
||||
enable_wasmtime: bool,
|
||||
enable_wine: bool,
|
||||
enable_symlinks_windows: bool,
|
||||
) *build.Step {
|
||||
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
||||
cases.* = StandaloneContext{
|
||||
@ -522,6 +523,7 @@ pub fn addStandaloneTests(
|
||||
.enable_rosetta = enable_rosetta,
|
||||
.enable_wasmtime = enable_wasmtime,
|
||||
.enable_wine = enable_wine,
|
||||
.enable_symlinks_windows = enable_symlinks_windows,
|
||||
};
|
||||
|
||||
standalone.addCases(cases);
|
||||
@ -535,6 +537,7 @@ pub fn addLinkTests(
|
||||
modes: []const Mode,
|
||||
enable_macos_sdk: bool,
|
||||
omit_stage2: bool,
|
||||
enable_symlinks_windows: bool,
|
||||
) *build.Step {
|
||||
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
||||
cases.* = StandaloneContext{
|
||||
@ -547,6 +550,7 @@ pub fn addLinkTests(
|
||||
.enable_macos_sdk = enable_macos_sdk,
|
||||
.target = .{},
|
||||
.omit_stage2 = omit_stage2,
|
||||
.enable_symlinks_windows = enable_symlinks_windows,
|
||||
};
|
||||
link.addCases(cases);
|
||||
return cases.step;
|
||||
@ -1022,6 +1026,7 @@ pub const StandaloneContext = struct {
|
||||
enable_rosetta: bool = false,
|
||||
enable_wasmtime: bool = false,
|
||||
enable_wine: bool = false,
|
||||
enable_symlinks_windows: bool,
|
||||
|
||||
pub fn addC(self: *StandaloneContext, root_src: []const u8) void {
|
||||
self.addAllArgs(root_src, true);
|
||||
@ -1037,11 +1042,13 @@ pub const StandaloneContext = struct {
|
||||
requires_macos_sdk: bool = false,
|
||||
requires_stage2: bool = false,
|
||||
use_emulation: bool = false,
|
||||
requires_symlinks: bool = false,
|
||||
}) void {
|
||||
const b = self.b;
|
||||
|
||||
if (features.requires_macos_sdk and !self.enable_macos_sdk) return;
|
||||
if (features.requires_stage2 and self.omit_stage2) return;
|
||||
if (features.requires_symlinks and !self.enable_symlinks_windows and builtin.os.tag == .windows) return;
|
||||
|
||||
const annotated_case_name = b.fmt("build {s}", .{build_file});
|
||||
if (self.test_filter) |filter| {
|
||||
|
Loading…
Reference in New Issue
Block a user