test: migrate plan9 and sparcv9 incremental tests
This commit is contained in:
parent
ed51a5d02a
commit
495bb12e6a
|
@ -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);
|
||||
}
|
||||
|
|
5
test/incremental/plan9/exit.zig
Normal file
5
test/incremental/plan9/exit.zig
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub fn main() void {}
|
||||
|
||||
// run
|
||||
// target=x86_64-plan9,aarch64-plan9
|
||||
//
|
28
test/incremental/plan9/hello_world_with_updates.0.zig
Normal file
28
test/incremental/plan9/hello_world_with_updates.0.zig
Normal file
|
@ -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
|
||||
//
|
10
test/incremental/plan9/hello_world_with_updates.1.zig
Normal file
10
test/incremental/plan9/hello_world_with_updates.1.zig
Normal file
|
@ -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
|
||||
//
|
27
test/incremental/sparcv9-linux/hello_world.zig
Normal file
27
test/incremental/sparcv9-linux/hello_world.zig
Normal file
|
@ -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!
|
||||
//
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user