authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-27 23:06:11+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-28 18:35:01+02:00
log7e17cbbda5de49759f7b130320578ed96b3810a1
treea90abc977cd1df6f9bdf5bbe893ce2866390e5bc
parent8e05e6a1ed3089ce1161cca9980f9939440a421b

test: migrate riscv64 incremental tests


4 files changed, 48 insertions(+), 34 deletions(-)

test/cases.zig-1
......@@ -12,7 +12,6 @@ pub fn addCases(ctx: *TestContext) !void {
1212 try @import("stage2/arm.zig").addCases(ctx);
1313 try @import("stage2/aarch64.zig").addCases(ctx);
1414 try @import("stage2/llvm.zig").addCases(ctx);
15 try @import("stage2/riscv64.zig").addCases(ctx);
1615 try @import("stage2/plan9.zig").addCases(ctx);
1716 try @import("stage2/x86_64.zig").addCases(ctx);
1817 try @import("stage2/sparcv9.zig").addCases(ctx);
test/incremental/riscv64-linux/hello_world_with_updates.0.zig created+21
......@@ -0,0 +1,21 @@
1pub fn main() void {
2 print();
3}
4
5fn print() void {
6 asm volatile ("ecall"
7 :
8 : [number] "{a7}" (64),
9 [arg1] "{a0}" (1),
10 [arg2] "{a1}" (@ptrToInt("Hello, World!\n")),
11 [arg3] "{a2}" ("Hello, World!\n".len),
12 : "rcx", "r11", "memory"
13 );
14 return;
15}
16
17// run
18// target=riscv64-linux
19//
20// Hello, World!
21//
test/incremental/riscv64-linux/hello_world_with_updates.1.zig created+27
......@@ -0,0 +1,27 @@
1pub fn main() void {
2 print();
3 print();
4 print();
5 print();
6}
7
8fn print() void {
9 asm volatile ("ecall"
10 :
11 : [number] "{a7}" (64),
12 [arg1] "{a0}" (1),
13 [arg2] "{a1}" (@ptrToInt("Hello, World!\n")),
14 [arg3] "{a2}" ("Hello, World!\n".len),
15 : "rcx", "r11", "memory"
16 );
17 return;
18}
19
20// run
21// target=riscv64-linux
22//
23// Hello, World!
24// Hello, World!
25// Hello, World!
26// Hello, World!
27//
test/stage2/riscv64.zig deleted-33
......@@ -1,33 +0,0 @@
1const std = @import("std");
2const TestContext = @import("../../src/test.zig").TestContext;
3
4const linux_riscv64 = std.zig.CrossTarget{
5 .cpu_arch = .riscv64,
6 .os_tag = .linux,
7};
8
9pub fn addCases(ctx: *TestContext) !void {
10 {
11 var case = ctx.exe("riscv64 hello world", linux_riscv64);
12 // Regular old hello world
13 case.addCompareOutput(
14 \\pub fn main() void {
15 \\ print();
16 \\}
17 \\
18 \\fn print() void {
19 \\ asm volatile ("ecall"
20 \\ :
21 \\ : [number] "{a7}" (64),
22 \\ [arg1] "{a0}" (1),
23 \\ [arg2] "{a1}" (@ptrToInt("Hello, World!\n")),
24 \\ [arg3] "{a2}" ("Hello, World!\n".len)
25 \\ : "rcx", "r11", "memory"
26 \\ );
27 \\ return;
28 \\}
29 ,
30 "Hello, World!\n",
31 );
32 }
33}