aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/stage2/compare_output.zig74
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",
- );
- }
}