diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-01-13 18:09:32 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-01-24 12:34:39 +0100 |
| commit | 6cdcf61a5ce193104c3c0f14189014f65bcd104d (patch) | |
| tree | 46ee9a48bf658d7506b32aaad1b244dc9419b3d8 /test/link/macho | |
| parent | aa50bca1516f6fc2c9d6c7ca66ef8585b4b5e197 (diff) | |
| download | zig-6cdcf61a5ce193104c3c0f14189014f65bcd104d.tar.gz zig-6cdcf61a5ce193104c3c0f14189014f65bcd104d.zip | |
test/link/macho: upgrade and migrate dead_strip test
Diffstat (limited to 'test/link/macho')
| -rw-r--r-- | test/link/macho/dead_strip/build.zig | 58 | ||||
| -rw-r--r-- | test/link/macho/dead_strip/main.c | 14 |
2 files changed, 0 insertions, 72 deletions
diff --git a/test/link/macho/dead_strip/build.zig b/test/link/macho/dead_strip/build.zig deleted file mode 100644 index a5bb28df9f..0000000000 --- a/test/link/macho/dead_strip/build.zig +++ /dev/null @@ -1,58 +0,0 @@ -const std = @import("std"); - -pub const requires_symlinks = true; - -pub fn build(b: *std.Build) void { - const optimize: std.builtin.OptimizeMode = .Debug; - const target = b.resolveTargetQuery(.{ .os_tag = .macos }); - - const test_step = b.step("test", "Test the program"); - b.default_step = test_step; - - { - // Without -dead_strip, we expect `iAmUnused` symbol present - const exe = createScenario(b, optimize, target, "no-gc"); - - const check = exe.checkObject(); - check.checkInSymtab(); - check.checkContains("(__TEXT,__text) external _iAmUnused"); - test_step.dependOn(&check.step); - - const run = b.addRunArtifact(exe); - run.skip_foreign_checks = true; - run.expectStdOutEqual("Hello!\n"); - test_step.dependOn(&run.step); - } - - { - // With -dead_strip, no `iAmUnused` symbol should be present - const exe = createScenario(b, optimize, target, "yes-gc"); - exe.link_gc_sections = true; - - const check = exe.checkObject(); - check.checkInSymtab(); - check.checkNotPresent("(__TEXT,__text) external _iAmUnused"); - test_step.dependOn(&check.step); - - const run = b.addRunArtifact(exe); - run.skip_foreign_checks = true; - run.expectStdOutEqual("Hello!\n"); - test_step.dependOn(&run.step); - } -} - -fn createScenario( - b: *std.Build, - optimize: std.builtin.OptimizeMode, - target: std.Build.ResolvedTarget, - name: []const u8, -) *std.Build.Step.Compile { - const exe = b.addExecutable(.{ - .name = name, - .optimize = optimize, - .target = target, - }); - exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} }); - exe.linkLibC(); - return exe; -} diff --git a/test/link/macho/dead_strip/main.c b/test/link/macho/dead_strip/main.c deleted file mode 100644 index 4756e2ca13..0000000000 --- a/test/link/macho/dead_strip/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdio.h> - -void printMe() { - printf("Hello!\n"); -} - -int main(int argc, char* argv[]) { - printMe(); - return 0; -} - -void iAmUnused() { - printf("YOU SHALL NOT PASS!\n"); -} |
