diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-04-28 00:26:30 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-04-28 18:35:01 +0200 |
| commit | 495bb12e6a5b5783fa14cc08c2c940ee60b80607 (patch) | |
| tree | b24cfd90268c57570bcfe4a9a243c4f333cd1f63 /test | |
| parent | ed51a5d02af58b3d11b555233781d71e6bde60af (diff) | |
| download | zig-495bb12e6a5b5783fa14cc08c2c940ee60b80607.tar.gz zig-495bb12e6a5b5783fa14cc08c2c940ee60b80607.zip | |
test: migrate plan9 and sparcv9 incremental tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases.zig | 2 | ||||
| -rw-r--r-- | test/incremental/plan9/exit.zig | 5 | ||||
| -rw-r--r-- | test/incremental/plan9/hello_world_with_updates.0.zig | 28 | ||||
| -rw-r--r-- | test/incremental/plan9/hello_world_with_updates.1.zig | 10 | ||||
| -rw-r--r-- | test/incremental/sparcv9-linux/hello_world.zig | 27 | ||||
| -rw-r--r-- | test/stage2/plan9.zig | 55 | ||||
| -rw-r--r-- | test/stage2/sparcv9.zig | 39 |
7 files changed, 70 insertions, 96 deletions
diff --git a/test/cases.zig b/test/cases.zig index f90233df0f..2d4da15789 100644 --- a/test/cases.zig +++ b/test/cases.zig @@ -10,9 +10,7 @@ pub fn addCases(ctx: *TestContext) !void { try @import("compile_errors.zig").addCases(ctx); try @import("stage2/cbe.zig").addCases(ctx); try @import("stage2/llvm.zig").addCases(ctx); - try @import("stage2/plan9.zig").addCases(ctx); try @import("stage2/x86_64.zig").addCases(ctx); - try @import("stage2/sparcv9.zig").addCases(ctx); // https://github.com/ziglang/zig/issues/10968 //try @import("stage2/nvptx.zig").addCases(ctx); } diff --git a/test/incremental/plan9/exit.zig b/test/incremental/plan9/exit.zig new file mode 100644 index 0000000000..735818fb83 --- /dev/null +++ b/test/incremental/plan9/exit.zig @@ -0,0 +1,5 @@ +pub fn main() void {} + +// run +// target=x86_64-plan9,aarch64-plan9 +// diff --git a/test/incremental/plan9/hello_world_with_updates.0.zig b/test/incremental/plan9/hello_world_with_updates.0.zig new file mode 100644 index 0000000000..7e7c373251 --- /dev/null +++ b/test/incremental/plan9/hello_world_with_updates.0.zig @@ -0,0 +1,28 @@ +pub fn main() void { + const str = "Hello World!\n"; + asm volatile ( + \\push $0 + \\push %%r10 + \\push %%r11 + \\push $1 + \\push $0 + \\syscall + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + : + // pwrite + : [syscall_number] "{rbp}" (51), + [hey] "{r11}" (@ptrToInt(str)), + [strlen] "{r10}" (str.len), + : "rcx", "rbp", "r11", "memory" + ); +} + +// run +// target=x86_64-plan9 +// +// Hello World +// diff --git a/test/incremental/plan9/hello_world_with_updates.1.zig b/test/incremental/plan9/hello_world_with_updates.1.zig new file mode 100644 index 0000000000..4111a8dc08 --- /dev/null +++ b/test/incremental/plan9/hello_world_with_updates.1.zig @@ -0,0 +1,10 @@ +const std = @import("std"); +pub fn main() void { + const str = "Hello World!\n"; + _ = std.os.plan9.pwrite(1, str, str.len, 0); +} + +// run +// +// Hello World +// diff --git a/test/incremental/sparcv9-linux/hello_world.zig b/test/incremental/sparcv9-linux/hello_world.zig new file mode 100644 index 0000000000..327a8c56ad --- /dev/null +++ b/test/incremental/sparcv9-linux/hello_world.zig @@ -0,0 +1,27 @@ +const msg = "Hello, World!\n"; + +pub export fn _start() noreturn { + asm volatile ("ta 0x6d" + : + : [number] "{g1}" (4), + [arg1] "{o0}" (1), + [arg2] "{o1}" (@ptrToInt(msg)), + [arg3] "{o2}" (msg.len), + : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" + ); + + asm volatile ("ta 0x6d" + : + : [number] "{g1}" (1), + [arg1] "{o0}" (0), + : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" + ); + + unreachable; +} + +// run +// target=sparcv9-linux +// +// Hello, World! +// diff --git a/test/stage2/plan9.zig b/test/stage2/plan9.zig deleted file mode 100644 index c82f95aa7b..0000000000 --- a/test/stage2/plan9.zig +++ /dev/null @@ -1,55 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -pub fn addCases(ctx: *TestContext) !void { - const x64: std.zig.CrossTarget = .{ - .cpu_arch = .x86_64, - .os_tag = .plan9, - }; - const aarch64: std.zig.CrossTarget = .{ - .cpu_arch = .aarch64, - .os_tag = .plan9, - }; - { - var case = ctx.exe("plan9: exiting correctly x64", x64); - case.addCompareOutput("pub fn main() void {}", ""); - } - { - var case = ctx.exe("plan9: exiting correctly arm", aarch64); - case.addCompareOutput("pub fn main() void {}", ""); - } - { - var case = ctx.exe("plan9: hello world", x64); - case.addCompareOutput( - \\pub fn main() void { - \\ const str = "Hello World!\n"; - \\ asm volatile ( - \\ \\push $0 - \\ \\push %%r10 - \\ \\push %%r11 - \\ \\push $1 - \\ \\push $0 - \\ \\syscall - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ : - \\ // pwrite - \\ : [syscall_number] "{rbp}" (51), - \\ [hey] "{r11}" (@ptrToInt(str)), - \\ [strlen] "{r10}" (str.len) - \\ : "rcx", "rbp", "r11", "memory" - \\ ); - \\} - , "Hello World\n"); - case.addCompareOutput( - \\const std = @import("std"); - \\pub fn main() void { - \\ const str = "Hello World!\n"; - \\ _ = std.os.plan9.pwrite(1, str, str.len, 0); - \\} - , "Hello World\n"); - } -} diff --git a/test/stage2/sparcv9.zig b/test/stage2/sparcv9.zig deleted file mode 100644 index d5611a7fae..0000000000 --- a/test/stage2/sparcv9.zig +++ /dev/null @@ -1,39 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_sparcv9 = std.zig.CrossTarget{ - .cpu_arch = .sparcv9, - .os_tag = .linux, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exe("sparcv9 hello world", linux_sparcv9); - // Regular old hello world - case.addCompareOutput( - \\const msg = "Hello, World!\n"; - \\ - \\pub export fn _start() noreturn { - \\ asm volatile ("ta 0x6d" - \\ : - \\ : [number] "{g1}" (4), - \\ [arg1] "{o0}" (1), - \\ [arg2] "{o1}" (@ptrToInt(msg)), - \\ [arg3] "{o2}" (msg.len) - \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" - \\ ); - \\ - \\ asm volatile ("ta 0x6d" - \\ : - \\ : [number] "{g1}" (1), - \\ [arg1] "{o0}" (0) - \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" - \\ ); - \\ - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - } -} |
