diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-08-04 15:32:16 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-08-04 15:32:16 -0700 |
| commit | c594f8dc26cebbcd371c0136da5ee7bb0eaca2b3 (patch) | |
| tree | d6c5691ec7c7d0d73c918672e905c43ae9f897e2 /test | |
| parent | 02d09d13281a10dbab0d80d07935712b1fc50756 (diff) | |
| download | zig-c594f8dc26cebbcd371c0136da5ee7bb0eaca2b3.tar.gz zig-c594f8dc26cebbcd371c0136da5ee7bb0eaca2b3.zip | |
stage2 tests: support the -Denable-qemu options and friends
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage2/compare_output.zig | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/test/stage2/compare_output.zig b/test/stage2/compare_output.zig index b124a4ef2d..1e4db06572 100644 --- a/test/stage2/compare_output.zig +++ b/test/stage2/compare_output.zig @@ -7,7 +7,7 @@ const linux_x64 = std.zig.CrossTarget{ .os_tag = .linux, }; -const riscv64 = std.zig.CrossTarget{ +const linux_riscv64 = std.zig.CrossTarget{ .cpu_arch = .riscv64, .os_tag = .linux, }; @@ -123,6 +123,42 @@ pub fn addCases(ctx: *TestContext) !void { \\ ); } + + { + var case = ctx.exe("hello world", linux_riscv64); + // Regular old hello world + case.addCompareOutput( + \\export fn _start() noreturn { + \\ print(); + \\ + \\ exit(); + \\} + \\ + \\fn print() void { + \\ asm volatile ("ecall" + \\ : + \\ : [number] "{a7}" (64), + \\ [arg1] "{a0}" (1), + \\ [arg2] "{a1}" (@ptrToInt("Hello, World!\n")), + \\ [arg3] "{a2}" ("Hello, World!\n".len) + \\ : "rcx", "r11", "memory" + \\ ); + \\ return; + \\} + \\ + \\fn exit() noreturn { + \\ asm volatile ("ecall" + \\ : + \\ : [number] "{a7}" (94), + \\ [arg1] "{a0}" (0) + \\ : "rcx", "r11", "memory" + \\ ); + \\ unreachable; + \\} + , + "Hello, World!\n", + ); + } { var case = ctx.exe("adding numbers at comptime", linux_x64); @@ -403,40 +439,4 @@ pub fn addCases(ctx: *TestContext) !void { "", ); } - - { - var case = ctx.exe("hello world with updates", riscv64); - // Regular old hello world - case.addCompareOutput( - \\export fn _start() noreturn { - \\ print(); - \\ - \\ exit(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("ecall" - \\ : - \\ : [number] "{a7}" (64), - \\ [arg1] "{a0}" (1), - \\ [arg2] "{a1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{a2}" ("Hello, World!\n".len) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - \\ - \\fn exit() noreturn { - \\ asm volatile ("ecall" - \\ : - \\ : [number] "{a7}" (94), - \\ [arg1] "{a0}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - } } |
