authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-10 14:46:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:14-07:00
log1a3c1fe820ad9eeaa7b30a1fc6e1b8b8e2b871b6
treea878459c542a83dd9d5f4acf8de95847969fcfc1
parent2956232b427276c6ad1e52678e1cf3651976ec39

test-link: add names to headerpad test


1 files changed, 10 insertions(+), 6 deletions(-)

test/link/macho/headerpad/build.zig+10-6
...@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {...@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {
17fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {17fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
18 {18 {
19 // Test -headerpad_max_install_names19 // Test -headerpad_max_install_names
20 const exe = simpleExe(b, optimize);20 const exe = simpleExe(b, optimize, "headerpad_max_install_names");
21 exe.headerpad_max_install_names = true;21 exe.headerpad_max_install_names = true;
2222
23 const check = exe.checkObject();23 const check = exe.checkObject();
...@@ -42,7 +42,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize...@@ -42,7 +42,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
4242
43 {43 {
44 // Test -headerpad44 // Test -headerpad
45 const exe = simpleExe(b, optimize);45 const exe = simpleExe(b, optimize, "headerpad");
46 exe.headerpad_size = 0x10000;46 exe.headerpad_size = 0x10000;
4747
48 const check = exe.checkObject();48 const check = exe.checkObject();
...@@ -58,7 +58,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize...@@ -58,7 +58,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
5858
59 {59 {
60 // Test both flags with -headerpad overriding -headerpad_max_install_names60 // Test both flags with -headerpad overriding -headerpad_max_install_names
61 const exe = simpleExe(b, optimize);61 const exe = simpleExe(b, optimize, "headerpad_overriding");
62 exe.headerpad_max_install_names = true;62 exe.headerpad_max_install_names = true;
63 exe.headerpad_size = 0x10000;63 exe.headerpad_size = 0x10000;
6464
...@@ -75,7 +75,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize...@@ -75,7 +75,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
7575
76 {76 {
77 // Test both flags with -headerpad_max_install_names overriding -headerpad77 // Test both flags with -headerpad_max_install_names overriding -headerpad
78 const exe = simpleExe(b, optimize);78 const exe = simpleExe(b, optimize, "headerpad_max_install_names_overriding");
79 exe.headerpad_size = 0x1000;79 exe.headerpad_size = 0x1000;
80 exe.headerpad_max_install_names = true;80 exe.headerpad_max_install_names = true;
8181
...@@ -100,9 +100,13 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize...@@ -100,9 +100,13 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
100 }100 }
101}101}
102102
103fn simpleExe(b: *std.Build, optimize: std.builtin.OptimizeMode) *std.Build.CompileStep {103fn simpleExe(
104 b: *std.Build,
105 optimize: std.builtin.OptimizeMode,
106 name: []const u8,
107) *std.Build.CompileStep {
104 const exe = b.addExecutable(.{108 const exe = b.addExecutable(.{
105 .name = "main",109 .name = name,
106 .optimize = optimize,110 .optimize = optimize,
107 });111 });
108 exe.addCSourceFile("main.c", &.{});112 exe.addCSourceFile("main.c", &.{});