mirror of
https://github.com/ziglang/zig.git
synced 2025-12-10 08:13:07 +00:00
test/macho: simplify testing range extension thunks
This commit is contained in:
parent
cbb8093455
commit
fa79f53f92
@ -2204,25 +2204,28 @@ fn testThunks(b: *Build, opts: Options) *Step {
|
|||||||
|
|
||||||
const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
|
const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
|
||||||
\\#include <stdio.h>
|
\\#include <stdio.h>
|
||||||
\\__attribute__((aligned(0x8000000))) int bar() {
|
\\void bar() {
|
||||||
\\ return 42;
|
\\ printf("bar");
|
||||||
\\}
|
\\}
|
||||||
\\int foobar();
|
\\void foo() {
|
||||||
\\int foo() {
|
\\ fprintf(stdout, "foo");
|
||||||
\\ return bar() - foobar();
|
|
||||||
\\}
|
|
||||||
\\__attribute__((aligned(0x8000000))) int foobar() {
|
|
||||||
\\ return 42;
|
|
||||||
\\}
|
\\}
|
||||||
\\int main() {
|
\\int main() {
|
||||||
\\ printf("bar=%d, foo=%d, foobar=%d", bar(), foo(), foobar());
|
\\ foo();
|
||||||
\\ return foo();
|
\\ bar();
|
||||||
|
\\ return 0;
|
||||||
\\}
|
\\}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const check = exe.checkObject();
|
||||||
|
check.checkInSymtab();
|
||||||
|
check.checkContains("_printf__thunk");
|
||||||
|
check.checkInSymtab();
|
||||||
|
check.checkContains("_fprintf__thunk");
|
||||||
|
test_step.dependOn(&check.step);
|
||||||
|
|
||||||
const run = addRunArtifact(exe);
|
const run = addRunArtifact(exe);
|
||||||
run.expectStdOutEqual("bar=42, foo=0, foobar=42");
|
run.expectStdOutEqual("foobar");
|
||||||
run.expectExitCode(0);
|
|
||||||
test_step.dependOn(&run.step);
|
test_step.dependOn(&run.step);
|
||||||
|
|
||||||
return test_step;
|
return test_step;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user