Skip to content

Commit fa79f53

Browse files
committed
test/macho: simplify testing range extension thunks
1 parent cbb8093 commit fa79f53

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

test/link/macho.zig

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,25 +2204,28 @@ fn testThunks(b: *Build, opts: Options) *Step {
22042204

22052205
const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
22062206
\\#include <stdio.h>
2207-
\\__attribute__((aligned(0x8000000))) int bar() {
2208-
\\ return 42;
2207+
\\void bar() {
2208+
\\ printf("bar");
22092209
\\}
2210-
\\int foobar();
2211-
\\int foo() {
2212-
\\ return bar() - foobar();
2213-
\\}
2214-
\\__attribute__((aligned(0x8000000))) int foobar() {
2215-
\\ return 42;
2210+
\\void foo() {
2211+
\\ fprintf(stdout, "foo");
22162212
\\}
22172213
\\int main() {
2218-
\\ printf("bar=%d, foo=%d, foobar=%d", bar(), foo(), foobar());
2219-
\\ return foo();
2214+
\\ foo();
2215+
\\ bar();
2216+
\\ return 0;
22202217
\\}
22212218
});
22222219

2220+
const check = exe.checkObject();
2221+
check.checkInSymtab();
2222+
check.checkContains("_printf__thunk");
2223+
check.checkInSymtab();
2224+
check.checkContains("_fprintf__thunk");
2225+
test_step.dependOn(&check.step);
2226+
22232227
const run = addRunArtifact(exe);
2224-
run.expectStdOutEqual("bar=42, foo=0, foobar=42");
2225-
run.expectExitCode(0);
2228+
run.expectStdOutEqual("foobar");
22262229
test_step.dependOn(&run.step);
22272230

22282231
return test_step;

0 commit comments

Comments
 (0)