authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-11 15:36:47+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-11 15:36:47+01:00
log5b92d0ea45af155a7d3d70aff56301e4c0aee338
treed062ef64406588c597f149a3d0e1efc61094c56a
parenta6bc19ea2a2fb99ee7f09dd451b889b6a5d7f388

stage2 aarch64: add macOS incremental test


2 files changed, 116 insertions(+), 0 deletions(-)

test/stage2/aarch64.zig created+115
......@@ -0,0 +1,115 @@
1const std = @import("std");
2const TestContext = @import("../../src/test.zig").TestContext;
3
4const macos_aarch64 = std.zig.CrossTarget{
5 .cpu_arch = .aarch64,
6 .os_tag = .macos,
7};
8
9pub fn addCases(ctx: *TestContext) !void {
10 // TODO enable when we add codesigning to the self-hosted linker
11 // related to #6971
12 if (false) {
13 var case = ctx.exe("hello world with updates", macos_aarch64);
14
15 // Regular old hello world
16 case.addCompareOutput(
17 \\export fn _start() noreturn {
18 \\ print();
19 \\
20 \\ exit();
21 \\}
22 \\
23 \\fn print() void {
24 \\ asm volatile ("svc #0x80"
25 \\ :
26 \\ : [number] "{x16}" (4),
27 \\ [arg1] "{x0}" (1),
28 \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")),
29 \\ [arg3] "{x2}" (14)
30 \\ : "memory"
31 \\ );
32 \\ return;
33 \\}
34 \\
35 \\fn exit() noreturn {
36 \\ asm volatile ("svc #0x80"
37 \\ :
38 \\ : [number] "{x16}" (1),
39 \\ [arg1] "{x0}" (0)
40 \\ : "memory"
41 \\ );
42 \\ unreachable;
43 \\}
44 ,
45 "Hello, World!\n",
46 );
47 // Now change the message only
48 case.addCompareOutput(
49 \\export fn _start() noreturn {
50 \\ print();
51 \\
52 \\ exit();
53 \\}
54 \\
55 \\fn print() void {
56 \\ asm volatile ("svc #0x80"
57 \\ :
58 \\ : [number] "{x16}" (4),
59 \\ [arg1] "{x0}" (1),
60 \\ [arg2] "{x1}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")),
61 \\ [arg3] "{x2}" (104)
62 \\ : "memory"
63 \\ );
64 \\ return;
65 \\}
66 \\
67 \\fn exit() noreturn {
68 \\ asm volatile ("svc #0x80"
69 \\ :
70 \\ : [number] "{x16}" (1),
71 \\ [arg1] "{x0}" (0)
72 \\ : "memory"
73 \\ );
74 \\ unreachable;
75 \\}
76 ,
77 "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n",
78 );
79 // Now we print it twice.
80 case.addCompareOutput(
81 \\export fn _start() noreturn {
82 \\ print();
83 \\ print();
84 \\
85 \\ exit();
86 \\}
87 \\
88 \\fn print() void {
89 \\ asm volatile ("svc #0x80"
90 \\ :
91 \\ : [number] "{x16}" (4),
92 \\ [arg1] "{x0}" (1),
93 \\ [arg2] "{x1}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")),
94 \\ [arg3] "{x2}" (104)
95 \\ : "memory"
96 \\ );
97 \\ return;
98 \\}
99 \\
100 \\fn exit() noreturn {
101 \\ asm volatile ("svc #0x80"
102 \\ :
103 \\ : [number] "{x16}" (1),
104 \\ [arg1] "{x0}" (0)
105 \\ : "memory"
106 \\ );
107 \\ unreachable;
108 \\}
109 ,
110 \\What is up? This is a longer message that will force the data to be relocated in virtual address space.
111 \\What is up? This is a longer message that will force the data to be relocated in virtual address space.
112 \\
113 );
114 }
115}
test/stage2/test.zig+1
......@@ -31,6 +31,7 @@ pub fn addCases(ctx: *TestContext) !void {
3131 try @import("cbe.zig").addCases(ctx);
3232 try @import("spu-ii.zig").addCases(ctx);
3333 try @import("arm.zig").addCases(ctx);
34 try @import("aarch64.zig").addCases(ctx);
3435
3536 {
3637 var case = ctx.exe("hello world with updates", linux_x64);