aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-05-14 10:05:01 +0200
committerJakub Konka <kubkon@jakubkonka.com>2021-05-14 11:02:43 +0200
commit8eea5eddf773a8d1f9f883e71d00409e454ee0bd (patch)
treead94c3581a3e8a93d44b05d8abedb35820ee2152 /test
parent826179bff40fdbd8c3b11138897fcfbb3367def8 (diff)
downloadzig-8eea5eddf773a8d1f9f883e71d00409e454ee0bd.tar.gz
zig-8eea5eddf773a8d1f9f883e71d00409e454ee0bd.zip
macho: fix bug with symbol growth and realloc
Diffstat (limited to 'test')
-rw-r--r--test/stage2/darwin.zig29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/stage2/darwin.zig b/test/stage2/darwin.zig
index 232bc42d25..f8d82391cc 100644
--- a/test/stage2/darwin.zig
+++ b/test/stage2/darwin.zig
@@ -41,7 +41,34 @@ pub fn addCases(ctx: *TestContext) !void {
"Hello, World!\n",
);
- // Now change the message only
+ // Print it 4 times and force growth and realloc.
+ case.addCompareOutput(
+ \\extern "c" fn write(usize, usize, usize) usize;
+ \\extern "c" fn exit(usize) noreturn;
+ \\
+ \\export fn _start() noreturn {
+ \\ print();
+ \\ print();
+ \\ print();
+ \\ print();
+ \\
+ \\ exit(0);
+ \\}
+ \\
+ \\fn print() void {
+ \\ const msg = @ptrToInt("Hello, World!\n");
+ \\ const len = 14;
+ \\ _ = write(1, msg, len);
+ \\}
+ ,
+ \\Hello, World!
+ \\Hello, World!
+ \\Hello, World!
+ \\Hello, World!
+ \\
+ );
+
+ // Print it once, and change the message.
case.addCompareOutput(
\\extern "c" fn write(usize, usize, usize) usize;
\\extern "c" fn exit(usize) noreturn;