aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-01-10 16:02:07 +0100
committerGitHub <noreply@github.com>2022-01-10 16:02:07 +0100
commita4e6291fbdf83dec0d353af745c241bc7e01b3f2 (patch)
treed7815bde6915af53e27531c5f1b3737c7fd61a5a /test
parent42ef95d79d9cb60fde8c83bfb2eef49969e7c8e3 (diff)
downloadzig-a4e6291fbdf83dec0d353af745c241bc7e01b3f2.tar.gz
zig-a4e6291fbdf83dec0d353af745c241bc7e01b3f2.zip
stage2: enable zig test on x86_64-macos (#10551)
* stage2: put decls in different MachO sections Use `getDeclVAddrWithReloc` when targeting MachO backend rather than `getDeclVAddr` - this fn returns a zero vaddr and instead creates a relocation on the linker side which will get automatically updated whenever the target decl is moved in memory. This fn also records a rebase of the target pointer so that its value is correctly slid in presence of ASLR. This commit enables `zig test` on x86_64-macos. * stage2: fix output section selection for type,val pairs
Diffstat (limited to 'test')
-rw-r--r--test/stage2/x86_64.zig39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/stage2/x86_64.zig b/test/stage2/x86_64.zig
index 878964e8a2..b0fe97e8f9 100644
--- a/test/stage2/x86_64.zig
+++ b/test/stage2/x86_64.zig
@@ -1761,6 +1761,25 @@ pub fn addCases(ctx: *TestContext) !void {
\\}
, "");
}
+
+ {
+ var case = ctx.exe("access slice element by index - slice_elem_val", target);
+ case.addCompareOutput(
+ \\var array = [_]usize{ 0, 42, 123, 34 };
+ \\var slice: []const usize = &array;
+ \\
+ \\pub fn main() void {
+ \\ assert(slice[0] == 0);
+ \\ assert(slice[1] == 42);
+ \\ assert(slice[2] == 123);
+ \\ assert(slice[3] == 34);
+ \\}
+ \\
+ \\fn assert(ok: bool) void {
+ \\ if (!ok) unreachable;
+ \\}
+ , "");
+ }
}
}
@@ -2014,26 +2033,6 @@ fn addLinuxTestCases(ctx: *TestContext) !void {
\\}
, "");
}
-
- {
- // TODO fixing this will enable zig test on macOS
- var case = ctx.exe("access slice element by index - slice_elem_val", linux_x64);
- case.addCompareOutput(
- \\var array = [_]usize{ 0, 42, 123, 34 };
- \\var slice: []const usize = &array;
- \\
- \\pub fn main() void {
- \\ assert(slice[0] == 0);
- \\ assert(slice[1] == 42);
- \\ assert(slice[2] == 123);
- \\ assert(slice[3] == 34);
- \\}
- \\
- \\fn assert(ok: bool) void {
- \\ if (!ok) unreachable;
- \\}
- , "");
- }
}
fn addMacOsTestCases(ctx: *TestContext) !void {