| author | |
| committer | |
| log | 8d5acf769336051a18c4905b4fc258349092b36e |
| tree | 8137ca4ceb8711edf166aefd441fb89de986c7e6 |
| parent | c8a0d8ff2b8557e3e7c3956a37293a0ce06dd3d0 |
Prune incremental tests by moving non-incremental behavior tests to
behavior test suite instead.54 files changed, 342 insertions(+), 481 deletions(-)
src/test.zig+3-3| ... | @@ -1012,18 +1012,18 @@ pub const TestContext = struct { | ... | @@ -1012,18 +1012,18 @@ pub const TestContext = struct { |
| 1012 | ) !void { | 1012 | ) !void { |
| 1013 | var cases = std.ArrayList(usize).init(ctx.arena); | 1013 | var cases = std.ArrayList(usize).init(ctx.arena); |
| 1014 | 1014 | ||
| 1015 | var it = dir.iterate(); | 1015 | var it = try dir.walk(ctx.arena); |
| 1016 | var filenames = std.ArrayList([]const u8).init(ctx.arena); | 1016 | var filenames = std.ArrayList([]const u8).init(ctx.arena); |
| 1017 | 1017 | ||
| 1018 | while (try it.next()) |entry| { | 1018 | while (try it.next()) |entry| { |
| 1019 | if (entry.kind != .File) continue; | 1019 | if (entry.kind != .File) continue; |
| 1020 | 1020 | ||
| 1021 | // Ignore stuff such as .swp files | 1021 | // Ignore stuff such as .swp files |
| 1022 | switch (Compilation.classifyFileExt(entry.name)) { | 1022 | switch (Compilation.classifyFileExt(entry.basename)) { |
| 1023 | .unknown => continue, | 1023 | .unknown => continue, |
| 1024 | else => {}, | 1024 | else => {}, |
| 1025 | } | 1025 | } |
| 1026 | try filenames.append(try ctx.arena.dupe(u8, entry.name)); | 1026 | try filenames.append(try ctx.arena.dupe(u8, entry.path)); |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| 1029 | // Sort filenames, so that incremental tests are contiguous and in-order | 1029 | // Sort filenames, so that incremental tests are contiguous and in-order |
test/behavior.zig+2| ... | @@ -69,8 +69,10 @@ test { | ... | @@ -69,8 +69,10 @@ test { |
| 69 | _ = @import("behavior/bugs/7003.zig"); | 69 | _ = @import("behavior/bugs/7003.zig"); |
| 70 | _ = @import("behavior/bugs/7027.zig"); | 70 | _ = @import("behavior/bugs/7027.zig"); |
| 71 | _ = @import("behavior/bugs/7047.zig"); | 71 | _ = @import("behavior/bugs/7047.zig"); |
| 72 | _ = @import("behavior/bugs/7187.zig"); | ||
| 72 | _ = @import("behavior/bugs/7250.zig"); | 73 | _ = @import("behavior/bugs/7250.zig"); |
| 73 | _ = @import("behavior/bugs/9584.zig"); | 74 | _ = @import("behavior/bugs/9584.zig"); |
| 75 | _ = @import("behavior/bugs/10138.zig"); | ||
| 74 | _ = @import("behavior/bugs/10147.zig"); | 76 | _ = @import("behavior/bugs/10147.zig"); |
| 75 | _ = @import("behavior/bugs/10970.zig"); | 77 | _ = @import("behavior/bugs/10970.zig"); |
| 76 | _ = @import("behavior/bugs/11046.zig"); | 78 | _ = @import("behavior/bugs/11046.zig"); |
test/behavior/bugs/10138.zig created+34| ... | @@ -0,0 +1,34 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | test "registers get overwritten when ignoring return" { | ||
| 5 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 7 | if (builtin.cpu.arch != .x86_64 or builtin.os.tag != .linux) return error.SkipZigTest; | ||
| 8 | |||
| 9 | const fd = open(); | ||
| 10 | _ = write(fd, "a", 1); | ||
| 11 | _ = close(fd); | ||
| 12 | } | ||
| 13 | |||
| 14 | fn open() usize { | ||
| 15 | return 42; | ||
| 16 | } | ||
| 17 | |||
| 18 | fn write(fd: usize, a: [*]const u8, len: usize) usize { | ||
| 19 | return syscall4(.WRITE, fd, @ptrToInt(a), len); | ||
| 20 | } | ||
| 21 | |||
| 22 | fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { | ||
| 23 | _ = n; | ||
| 24 | _ = a; | ||
| 25 | _ = b; | ||
| 26 | _ = c; | ||
| 27 | return 23; | ||
| 28 | } | ||
| 29 | |||
| 30 | fn close(fd: usize) usize { | ||
| 31 | if (fd != 42) | ||
| 32 | unreachable; | ||
| 33 | return 0; | ||
| 34 | } | ||
test/behavior/bugs/7187.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const expect = std.testing.expect; | ||
| 4 | |||
| 5 | test "miscompilation with bool return type" { | ||
| 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 8 | |||
| 9 | var x: usize = 1; | ||
| 10 | var y: bool = getFalse(); | ||
| 11 | _ = y; | ||
| 12 | |||
| 13 | try expect(x == 1); | ||
| 14 | } | ||
| 15 | |||
| 16 | fn getFalse() bool { | ||
| 17 | return false; | ||
| 18 | } | ||
test/incremental/access_slice_element_by_index_slice_elem_val.zig deleted-17| ... | @@ -1,17 +0,0 @@ | ||
| 1 | var array = [_]usize{ 0, 42, 123, 34 }; | ||
| 2 | var slice: []const usize = &array; | ||
| 3 | |||
| 4 | pub fn main() void { | ||
| 5 | assert(slice[0] == 0); | ||
| 6 | assert(slice[1] == 42); | ||
| 7 | assert(slice[2] == 123); | ||
| 8 | assert(slice[3] == 34); | ||
| 9 | } | ||
| 10 | |||
| 11 | fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // target=x86_64-linux,x86_64-macos | ||
| 17 | // | ||
test/incremental/hello_world_with_updates_x86_64_linux.0.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | // error | ||
| 2 | // output_mode=Exe | ||
| 3 | // target=x86_64-linux | ||
| 4 | // | ||
| 5 | // :109:9: error: struct 'tmp.tmp' has no member named 'main' | ||
test/incremental/hello_world_with_updates_x86_64_linux.1.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | pub export fn _start() noreturn {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // | ||
| 5 | // :1:34: error: expected noreturn, found void | ||
test/incremental/hello_world_with_updates_x86_64_linux.2.zig deleted-32| ... | @@ -1,32 +0,0 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | print(); | ||
| 3 | |||
| 4 | exit(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | asm volatile ("syscall" | ||
| 9 | : | ||
| 10 | : [number] "{rax}" (1), | ||
| 11 | [arg1] "{rdi}" (1), | ||
| 12 | [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), | ||
| 13 | [arg3] "{rdx}" (14), | ||
| 14 | : "rcx", "r11", "memory" | ||
| 15 | ); | ||
| 16 | return; | ||
| 17 | } | ||
| 18 | |||
| 19 | fn exit() noreturn { | ||
| 20 | asm volatile ("syscall" | ||
| 21 | : | ||
| 22 | : [number] "{rax}" (231), | ||
| 23 | [arg1] "{rdi}" (0), | ||
| 24 | : "rcx", "r11", "memory" | ||
| 25 | ); | ||
| 26 | unreachable; | ||
| 27 | } | ||
| 28 | |||
| 29 | // run | ||
| 30 | // | ||
| 31 | // Hello, World! | ||
| 32 | // | ||
test/incremental/hello_world_with_updates_x86_64_linux.3.zig deleted-20| ... | @@ -1,20 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn print() void { | ||
| 6 | asm volatile ("syscall" | ||
| 7 | : | ||
| 8 | : [number] "{rax}" (1), | ||
| 9 | [arg1] "{rdi}" (1), | ||
| 10 | [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), | ||
| 11 | [arg3] "{rdx}" (14), | ||
| 12 | : "rcx", "r11", "memory" | ||
| 13 | ); | ||
| 14 | return; | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
| 19 | // Hello, World! | ||
| 20 | // | ||
test/incremental/hello_world_with_updates_x86_64_linux.4.zig deleted-20| ... | @@ -1,20 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn print() void { | ||
| 6 | asm volatile ("syscall" | ||
| 7 | : | ||
| 8 | : [number] "{rax}" (1), | ||
| 9 | [arg1] "{rdi}" (1), | ||
| 10 | [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), | ||
| 11 | [arg3] "{rdx}" (104), | ||
| 12 | : "rcx", "r11", "memory" | ||
| 13 | ); | ||
| 14 | return; | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
| 19 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 20 | // | ||
test/incremental/hello_world_with_updates_x86_64_linux.5.zig deleted-22| ... | @@ -1,22 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | print(); | ||
| 4 | } | ||
| 5 | |||
| 6 | fn print() void { | ||
| 7 | asm volatile ("syscall" | ||
| 8 | : | ||
| 9 | : [number] "{rax}" (1), | ||
| 10 | [arg1] "{rdi}" (1), | ||
| 11 | [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), | ||
| 12 | [arg3] "{rdx}" (104), | ||
| 13 | : "rcx", "r11", "memory" | ||
| 14 | ); | ||
| 15 | return; | ||
| 16 | } | ||
| 17 | |||
| 18 | // run | ||
| 19 | // | ||
| 20 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 21 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 22 | // | ||
test/incremental/hello_world_with_updates_x86_64_macos.0.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | // error | ||
| 2 | // output_mode=Exe | ||
| 3 | // target=x86_64-macos | ||
| 4 | // | ||
| 5 | // :109:9: error: struct 'tmp.tmp' has no member named 'main' | ||
test/incremental/hello_world_with_updates_x86_64_macos.1.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | pub export fn main() noreturn {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // | ||
| 5 | // :1:32: error: expected noreturn, found void | ||
test/incremental/hello_world_with_updates_x86_64_macos.2.zig deleted-19| ... | @@ -1,19 +0,0 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | extern "c" fn exit(usize) noreturn; | ||
| 3 | |||
| 4 | pub export fn main() noreturn { | ||
| 5 | print(); | ||
| 6 | |||
| 7 | exit(0); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // | ||
test/incremental/hello_world_with_updates_x86_64_macos.3.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 9 | const len = 14; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // Hello, World! | ||
| 16 | // | ||
test/incremental/hello_world_with_updates_x86_64_macos.4.zig deleted-22| ... | @@ -1,22 +0,0 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | print(); | ||
| 7 | print(); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // Hello, World! | ||
| 20 | // Hello, World! | ||
| 21 | // Hello, World! | ||
| 22 | // | ||
test/incremental/hello_world_with_updates_x86_64_macos.5.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 9 | const len = 104; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 16 | // | ||
test/incremental/hello_world_with_updates_x86_64_macos.6.zig deleted-18| ... | @@ -1,18 +0,0 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | } | ||
| 7 | |||
| 8 | fn print() void { | ||
| 9 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 10 | const len = 104; | ||
| 11 | _ = write(1, msg, len); | ||
| 12 | } | ||
| 13 | |||
| 14 | // run | ||
| 15 | // | ||
| 16 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 17 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 18 | // | ||
test/incremental/inline_assembly_x86_64_linux.0.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | const number = 1234; | ||
| 3 | const x = asm volatile ("syscall" | ||
| 4 | : [o] "{rax}" (-> number), | ||
| 5 | : [number] "{rax}" (231), | ||
| 6 | [arg1] "{rdi}" (60), | ||
| 7 | : "rcx", "r11", "memory" | ||
| 8 | ); | ||
| 9 | _ = x; | ||
| 10 | } | ||
| 11 | |||
| 12 | // error | ||
| 13 | // output_mode=Exe | ||
| 14 | // target=x86_64-linux | ||
| 15 | // | ||
| 16 | // :4:27: error: expected type, found comptime_int | ||
test/incremental/inline_assembly_x86_64_linux.1.zig deleted-15| ... | @@ -1,15 +0,0 @@ | ||
| 1 | const S = struct { | ||
| 2 | comptime { | ||
| 3 | asm volatile ( | ||
| 4 | \\zig_moment: | ||
| 5 | \\syscall | ||
| 6 | ); | ||
| 7 | } | ||
| 8 | }; | ||
| 9 | pub fn main() void { | ||
| 10 | _ = S; | ||
| 11 | } | ||
| 12 | |||
| 13 | // error | ||
| 14 | // | ||
| 15 | // :3:13: error: volatile is meaningless on global assembly | ||
test/incremental/inline_assembly_x86_64_linux.2.zig deleted-12| ... | @@ -1,12 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var bruh: u32 = 1; | ||
| 3 | asm ("" | ||
| 4 | : | ||
| 5 | : [bruh] "{rax}" (4) | ||
| 6 | : "memory" | ||
| 7 | ); | ||
| 8 | } | ||
| 9 | |||
| 10 | // error | ||
| 11 | // | ||
| 12 | // :3:5: error: assembly expression with no output must be marked volatile | ||
test/incremental/inline_assembly_x86_64_linux.3.zig deleted-12| ... | @@ -1,12 +0,0 @@ | ||
| 1 | pub fn main() void {} | ||
| 2 | comptime { | ||
| 3 | asm ("" | ||
| 4 | : | ||
| 5 | : [bruh] "{rax}" (4) | ||
| 6 | : "memory" | ||
| 7 | ); | ||
| 8 | } | ||
| 9 | |||
| 10 | // error | ||
| 11 | // | ||
| 12 | // :3:5: error: global assembly cannot have inputs, outputs, or clobbers | ||
test/incremental/issue_10138_callee_preserved_regs_working_x86_64_linux.zig deleted-31| ... | @@ -1,31 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | const fd = open(); | ||
| 3 | _ = write(fd, "a", 1); | ||
| 4 | _ = close(fd); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn open() usize { | ||
| 8 | return 42; | ||
| 9 | } | ||
| 10 | |||
| 11 | fn write(fd: usize, a: [*]const u8, len: usize) usize { | ||
| 12 | return syscall4(.WRITE, fd, @ptrToInt(a), len); | ||
| 13 | } | ||
| 14 | |||
| 15 | fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { | ||
| 16 | _ = n; | ||
| 17 | _ = a; | ||
| 18 | _ = b; | ||
| 19 | _ = c; | ||
| 20 | return 23; | ||
| 21 | } | ||
| 22 | |||
| 23 | fn close(fd: usize) usize { | ||
| 24 | if (fd != 42) | ||
| 25 | unreachable; | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | // run | ||
| 30 | // target=x86_64-linux | ||
| 31 | // | ||
test/incremental/issue_7187_miscompilation_with_bool_return_type.zig deleted-18| ... | @@ -1,18 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var x: usize = 1; | ||
| 3 | var y: bool = getFalse(); | ||
| 4 | _ = y; | ||
| 5 | |||
| 6 | assert(x == 1); | ||
| 7 | } | ||
| 8 | |||
| 9 | fn getFalse() bool { | ||
| 10 | return false; | ||
| 11 | } | ||
| 12 | |||
| 13 | fn assert(ok: bool) void { | ||
| 14 | if (!ok) unreachable; | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
test/incremental/load_store_via_pointer_deref.0.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var x: u32 = undefined; | ||
| 3 | set(&x); | ||
| 4 | assert(x == 123); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn set(x: *u32) void { | ||
| 8 | x.* = 123; | ||
| 9 | } | ||
| 10 | |||
| 11 | fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/load_store_via_pointer_deref.1.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var x: u16 = undefined; | ||
| 3 | set(&x); | ||
| 4 | assert(x == 123); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn set(x: *u16) void { | ||
| 8 | x.* = 123; | ||
| 9 | } | ||
| 10 | |||
| 11 | fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/load_store_via_pointer_deref.2.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var x: u8 = undefined; | ||
| 3 | set(&x); | ||
| 4 | assert(x == 123); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn set(x: *u8) void { | ||
| 8 | x.* = 123; | ||
| 9 | } | ||
| 10 | |||
| 11 | fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/only_1_function_and_it_gets_updated_x86_64_linux.0.zig deleted-13| ... | @@ -1,13 +0,0 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | asm volatile ("syscall" | ||
| 3 | : | ||
| 4 | : [number] "{rax}" (60), // exit | ||
| 5 | [arg1] "{rdi}" (0), | ||
| 6 | : "rcx", "r11", "memory" | ||
| 7 | ); | ||
| 8 | unreachable; | ||
| 9 | } | ||
| 10 | |||
| 11 | // run | ||
| 12 | // target=x86_64-linux | ||
| 13 | // | ||
test/incremental/only_1_function_and_it_gets_updated_x86_64_linux.1.zig deleted-12| ... | @@ -1,12 +0,0 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | asm volatile ("syscall" | ||
| 3 | : | ||
| 4 | : [number] "{rax}" (231), // exit_group | ||
| 5 | [arg1] "{rdi}" (0), | ||
| 6 | : "rcx", "r11", "memory" | ||
| 7 | ); | ||
| 8 | unreachable; | ||
| 9 | } | ||
| 10 | |||
| 11 | // run | ||
| 12 | // | ||
test/incremental/saving_vars_of_different_abi_size_to_stack.0.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | assert(callMe(2) == 24); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn callMe(a: u8) u8 { | ||
| 6 | var b: u8 = a + 10; | ||
| 7 | const c = 2 * b; | ||
| 8 | return c; | ||
| 9 | } | ||
| 10 | |||
| 11 | pub fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; // assertion failure | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/saving_vars_of_different_abi_size_to_stack.1.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | assert(callMe(2) == 24); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn callMe(a: u16) u16 { | ||
| 6 | var b: u16 = a + 10; | ||
| 7 | const c = 2 * b; | ||
| 8 | return c; | ||
| 9 | } | ||
| 10 | |||
| 11 | pub fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; // assertion failure | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/saving_vars_of_different_abi_size_to_stack.2.zig deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | assert(callMe(2) == 24); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn callMe(a: u32) u32 { | ||
| 6 | var b: u32 = a + 10; | ||
| 7 | const c = 2 * b; | ||
| 8 | return c; | ||
| 9 | } | ||
| 10 | |||
| 11 | pub fn assert(ok: bool) void { | ||
| 12 | if (!ok) unreachable; // assertion failure | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
| 16 | // | ||
test/incremental/subtracting_numbers_at_runtime.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | sub(7, 4); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn sub(a: u32, b: u32) void { | ||
| 6 | if (a - b != 3) unreachable; | ||
| 7 | } | ||
| 8 | |||
| 9 | // run | ||
| 10 | // | ||
test/incremental/unwrap_error_union_simple_errors.0.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | maybeErr() catch unreachable; | ||
| 3 | } | ||
| 4 | |||
| 5 | fn maybeErr() !void { | ||
| 6 | return; | ||
| 7 | } | ||
| 8 | |||
| 9 | // run | ||
| 10 | // | ||
test/incremental/unwrap_error_union_simple_errors.1.zig deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | maybeErr() catch return; | ||
| 3 | unreachable; | ||
| 4 | } | ||
| 5 | |||
| 6 | fn maybeErr() !void { | ||
| 7 | return error.NoWay; | ||
| 8 | } | ||
| 9 | |||
| 10 | // run | ||
| 11 | // | ||
test/incremental/x86_64-linux/hello_world_with_updates.0.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | // error | ||
| 2 | // output_mode=Exe | ||
| 3 | // target=x86_64-linux | ||
| 4 | // | ||
| 5 | // :109:9: error: struct 'tmp.tmp' has no member named 'main' | ||
test/incremental/x86_64-linux/hello_world_with_updates.1.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | pub export fn _start() noreturn {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // | ||
| 5 | // :1:34: error: expected noreturn, found void | ||
test/incremental/x86_64-linux/hello_world_with_updates.2.zig created+32| ... | @@ -0,0 +1,32 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | print(); | ||
| 3 | |||
| 4 | exit(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | asm volatile ("syscall" | ||
| 9 | : | ||
| 10 | : [number] "{rax}" (1), | ||
| 11 | [arg1] "{rdi}" (1), | ||
| 12 | [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), | ||
| 13 | [arg3] "{rdx}" (14), | ||
| 14 | : "rcx", "r11", "memory" | ||
| 15 | ); | ||
| 16 | return; | ||
| 17 | } | ||
| 18 | |||
| 19 | fn exit() noreturn { | ||
| 20 | asm volatile ("syscall" | ||
| 21 | : | ||
| 22 | : [number] "{rax}" (231), | ||
| 23 | [arg1] "{rdi}" (0), | ||
| 24 | : "rcx", "r11", "memory" | ||
| 25 | ); | ||
| 26 | unreachable; | ||
| 27 | } | ||
| 28 | |||
| 29 | // run | ||
| 30 | // | ||
| 31 | // Hello, World! | ||
| 32 | // | ||
test/incremental/x86_64-linux/hello_world_with_updates.3.zig created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn print() void { | ||
| 6 | asm volatile ("syscall" | ||
| 7 | : | ||
| 8 | : [number] "{rax}" (1), | ||
| 9 | [arg1] "{rdi}" (1), | ||
| 10 | [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), | ||
| 11 | [arg3] "{rdx}" (14), | ||
| 12 | : "rcx", "r11", "memory" | ||
| 13 | ); | ||
| 14 | return; | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
| 19 | // Hello, World! | ||
| 20 | // | ||
test/incremental/x86_64-linux/hello_world_with_updates.4.zig created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn print() void { | ||
| 6 | asm volatile ("syscall" | ||
| 7 | : | ||
| 8 | : [number] "{rax}" (1), | ||
| 9 | [arg1] "{rdi}" (1), | ||
| 10 | [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), | ||
| 11 | [arg3] "{rdx}" (104), | ||
| 12 | : "rcx", "r11", "memory" | ||
| 13 | ); | ||
| 14 | return; | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
| 19 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 20 | // | ||
test/incremental/x86_64-linux/hello_world_with_updates.5.zig created+22| ... | @@ -0,0 +1,22 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | print(); | ||
| 4 | } | ||
| 5 | |||
| 6 | fn print() void { | ||
| 7 | asm volatile ("syscall" | ||
| 8 | : | ||
| 9 | : [number] "{rax}" (1), | ||
| 10 | [arg1] "{rdi}" (1), | ||
| 11 | [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), | ||
| 12 | [arg3] "{rdx}" (104), | ||
| 13 | : "rcx", "r11", "memory" | ||
| 14 | ); | ||
| 15 | return; | ||
| 16 | } | ||
| 17 | |||
| 18 | // run | ||
| 19 | // | ||
| 20 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 21 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 22 | // | ||
test/incremental/x86_64-linux/inline_assembly.0.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | const number = 1234; | ||
| 3 | const x = asm volatile ("syscall" | ||
| 4 | : [o] "{rax}" (-> number), | ||
| 5 | : [number] "{rax}" (231), | ||
| 6 | [arg1] "{rdi}" (60), | ||
| 7 | : "rcx", "r11", "memory" | ||
| 8 | ); | ||
| 9 | _ = x; | ||
| 10 | } | ||
| 11 | |||
| 12 | // error | ||
| 13 | // output_mode=Exe | ||
| 14 | // target=x86_64-linux | ||
| 15 | // | ||
| 16 | // :4:27: error: expected type, found comptime_int | ||
test/incremental/x86_64-linux/inline_assembly.1.zig created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | const S = struct { | ||
| 2 | comptime { | ||
| 3 | asm volatile ( | ||
| 4 | \\zig_moment: | ||
| 5 | \\syscall | ||
| 6 | ); | ||
| 7 | } | ||
| 8 | }; | ||
| 9 | pub fn main() void { | ||
| 10 | _ = S; | ||
| 11 | } | ||
| 12 | |||
| 13 | // error | ||
| 14 | // | ||
| 15 | // :3:13: error: volatile is meaningless on global assembly | ||
test/incremental/x86_64-linux/inline_assembly.2.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | var bruh: u32 = 1; | ||
| 3 | asm ("" | ||
| 4 | : | ||
| 5 | : [bruh] "{rax}" (4) | ||
| 6 | : "memory" | ||
| 7 | ); | ||
| 8 | } | ||
| 9 | |||
| 10 | // error | ||
| 11 | // | ||
| 12 | // :3:5: error: assembly expression with no output must be marked volatile | ||
test/incremental/x86_64-linux/inline_assembly.3.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | pub fn main() void {} | ||
| 2 | comptime { | ||
| 3 | asm ("" | ||
| 4 | : | ||
| 5 | : [bruh] "{rax}" (4) | ||
| 6 | : "memory" | ||
| 7 | ); | ||
| 8 | } | ||
| 9 | |||
| 10 | // error | ||
| 11 | // | ||
| 12 | // :3:5: error: global assembly cannot have inputs, outputs, or clobbers | ||
test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.0.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | asm volatile ("syscall" | ||
| 3 | : | ||
| 4 | : [number] "{rax}" (60), // exit | ||
| 5 | [arg1] "{rdi}" (0), | ||
| 6 | : "rcx", "r11", "memory" | ||
| 7 | ); | ||
| 8 | unreachable; | ||
| 9 | } | ||
| 10 | |||
| 11 | // run | ||
| 12 | // target=x86_64-linux | ||
| 13 | // | ||
test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.1.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | asm volatile ("syscall" | ||
| 3 | : | ||
| 4 | : [number] "{rax}" (231), // exit_group | ||
| 5 | [arg1] "{rdi}" (0), | ||
| 6 | : "rcx", "r11", "memory" | ||
| 7 | ); | ||
| 8 | unreachable; | ||
| 9 | } | ||
| 10 | |||
| 11 | // run | ||
| 12 | // | ||
test/incremental/x86_64-macos/hello_world_with_updates.0.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | // error | ||
| 2 | // output_mode=Exe | ||
| 3 | // target=x86_64-macos | ||
| 4 | // | ||
| 5 | // :109:9: error: struct 'tmp.tmp' has no member named 'main' | ||
test/incremental/x86_64-macos/hello_world_with_updates.1.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | pub export fn main() noreturn {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // | ||
| 5 | // :1:32: error: expected noreturn, found void | ||
test/incremental/x86_64-macos/hello_world_with_updates.2.zig created+19| ... | @@ -0,0 +1,19 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | extern "c" fn exit(usize) noreturn; | ||
| 3 | |||
| 4 | pub export fn main() noreturn { | ||
| 5 | print(); | ||
| 6 | |||
| 7 | exit(0); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // | ||
test/incremental/x86_64-macos/hello_world_with_updates.3.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 9 | const len = 14; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // Hello, World! | ||
| 16 | // | ||
test/incremental/x86_64-macos/hello_world_with_updates.4.zig created+22| ... | @@ -0,0 +1,22 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | print(); | ||
| 7 | print(); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // Hello, World! | ||
| 20 | // Hello, World! | ||
| 21 | // Hello, World! | ||
| 22 | // | ||
test/incremental/x86_64-macos/hello_world_with_updates.5.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 9 | const len = 104; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 16 | // | ||
test/incremental/x86_64-macos/hello_world_with_updates.6.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | } | ||
| 7 | |||
| 8 | fn print() void { | ||
| 9 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 10 | const len = 104; | ||
| 11 | _ = write(1, msg, len); | ||
| 12 | } | ||
| 13 | |||
| 14 | // run | ||
| 15 | // | ||
| 16 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 17 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 18 | // | ||