aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-06-25 00:36:42 +0200
committerJakub Konka <kubkon@jakubkonka.com>2022-06-25 17:59:09 +0200
commita6fbdfabb9b60262594da012b8d877a43d8d8e99 (patch)
tree5ba41dac34c70b6772172928c5b9aba1e0e202d0 /test
parent8c1feef4cd3af223ed8278bd55e8191936b526f0 (diff)
downloadzig-a6fbdfabb9b60262594da012b8d877a43d8d8e99.tar.gz
zig-a6fbdfabb9b60262594da012b8d877a43d8d8e99.zip
link-tests: add -headerpad_size test scenario
Diffstat (limited to 'test')
-rw-r--r--test/link/macho/headerpad_size/build.zig25
-rw-r--r--test/link/macho/headerpad_size/main.c3
2 files changed, 28 insertions, 0 deletions
diff --git a/test/link/macho/headerpad_size/build.zig b/test/link/macho/headerpad_size/build.zig
new file mode 100644
index 0000000000..0a02405e79
--- /dev/null
+++ b/test/link/macho/headerpad_size/build.zig
@@ -0,0 +1,25 @@
+const std = @import("std");
+const Builder = std.build.Builder;
+
+pub fn build(b: *Builder) void {
+ const mode = b.standardReleaseOptions();
+
+ const test_step = b.step("test", "Test");
+ test_step.dependOn(b.getInstallStep());
+
+ const exe = b.addExecutable("main", null);
+ exe.setBuildMode(mode);
+ exe.addCSourceFile("main.c", &.{});
+ exe.linkLibC();
+ exe.headerpad_size = 0x10000;
+
+ const check = exe.checkObject(.macho);
+ check.checkStart("sectname __text");
+ check.checkNext("offset {offset}");
+ check.checkComputeCompare("offset", .{ .op = .gte, .value = .{ .literal = 0x10000 } });
+
+ test_step.dependOn(&check.step);
+
+ const run = exe.run();
+ test_step.dependOn(&run.step);
+}
diff --git a/test/link/macho/headerpad_size/main.c b/test/link/macho/headerpad_size/main.c
new file mode 100644
index 0000000000..ca68d24cc7
--- /dev/null
+++ b/test/link/macho/headerpad_size/main.c
@@ -0,0 +1,3 @@
+int main(int argc, char* argv[]) {
+ return 0;
+}