Commit 2875216f8e

Jakub Konka <kubkon@jakubkonka.com>
2022-04-28 11:42:14
test: fix x86_64-macos failures
This is just a temporary fix - I would like to unify all of x86_64 tests across linux and macos OSes.
1 parent 5a5648c
Changed files (78)
test
incremental
llvm
x86_64-linux
x86_64-macos
test/incremental/llvm/address_space_pointer_access_chaining_pointer_to_optional_array.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig
@@ -9,5 +9,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig
@@ -9,5 +9,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/any_typed_null_to_any_typed_optional.zig
@@ -6,6 +6,6 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // :3:21: error: expected *anyopaque, found ?usize
test/incremental/llvm/blocks.zig
@@ -18,5 +18,5 @@ pub fn main() void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/for_loop.zig
@@ -12,5 +12,5 @@ pub fn main() void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/hello_world.zig
@@ -6,7 +6,7 @@ pub fn main() void {
 
 // run
 // backend=llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // hello world!
 //
test/incremental/llvm/invalid_address_space_coercion.zig
@@ -8,6 +8,6 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // :2:12: error: expected *i32, found *addrspace(.gs) i32
test/incremental/llvm/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig
@@ -8,6 +8,6 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // :2:12: error: expected *i32, found *addrspace(.gs) i32
test/incremental/llvm/nested_blocks.zig
@@ -20,5 +20,5 @@ pub fn main() void {
 
 // run
 // backend=stage2, llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/optionals.zig
@@ -41,5 +41,5 @@ pub fn main() void {
 
 // run
 // backend=llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/pointer_keeps_address_space.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/pointer_keeps_address_space_when_taking_address_of_dereference.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig
@@ -8,5 +8,5 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/pointer_with_different_address_spaces.zig
@@ -8,6 +8,6 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // :2:12: error: expected *addrspace(.fs) i32, found *addrspace(.gs) i32
test/incremental/llvm/pointers_with_different_address_spaces.zig
@@ -8,6 +8,6 @@ pub fn main() void {
 // error
 // output_mode=Exe
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
 // :2:13: error: expected *i32, found *addrspace(.gs) i32
test/incremental/llvm/rem.zig
@@ -11,5 +11,5 @@ pub fn main() void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/shift_right_plus_left.0.zig
@@ -8,5 +8,5 @@ fn assert(a: u32, b: u32) void {
 
 // run
 // backend=llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/simple_addition_and_subtraction.zig
@@ -16,5 +16,5 @@ fn assert(ok: bool) void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/simple_if_statement.zig
@@ -12,5 +12,5 @@ pub fn main() void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/llvm/while_loops.zig
@@ -14,5 +14,5 @@ pub fn main() void {
 
 // run
 // backend=stage2,llvm
-// target=x86_64-linux
+// target=x86_64-linux,x86_64-macos
 //
test/incremental/assert_function.0.zig โ†’ test/incremental/x86_64-linux/assert_function.0.zig
@@ -11,5 +11,5 @@ pub fn assert(ok: bool) void {
 }
 
 // run
-// target=x86_64-linux,x86_64-macos
+// target=x86_64-linux
 //
test/incremental/assert_function.1.zig โ†’ test/incremental/x86_64-linux/assert_function.1.zig
File renamed without changes
test/incremental/assert_function.10.zig โ†’ test/incremental/x86_64-linux/assert_function.10.zig
File renamed without changes
test/incremental/assert_function.11.zig โ†’ test/incremental/x86_64-linux/assert_function.11.zig
File renamed without changes
test/incremental/assert_function.12.zig โ†’ test/incremental/x86_64-linux/assert_function.12.zig
File renamed without changes
test/incremental/assert_function.13.zig โ†’ test/incremental/x86_64-linux/assert_function.13.zig
File renamed without changes
test/incremental/assert_function.14.zig โ†’ test/incremental/x86_64-linux/assert_function.14.zig
File renamed without changes
test/incremental/assert_function.15.zig โ†’ test/incremental/x86_64-linux/assert_function.15.zig
File renamed without changes
test/incremental/assert_function.16.zig โ†’ test/incremental/x86_64-linux/assert_function.16.zig
File renamed without changes
test/incremental/assert_function.17.zig โ†’ test/incremental/x86_64-linux/assert_function.17.zig
File renamed without changes
test/incremental/assert_function.18.zig โ†’ test/incremental/x86_64-linux/assert_function.18.zig
File renamed without changes
test/incremental/assert_function.2.zig โ†’ test/incremental/x86_64-linux/assert_function.2.zig
File renamed without changes
test/incremental/assert_function.3.zig โ†’ test/incremental/x86_64-linux/assert_function.3.zig
File renamed without changes
test/incremental/assert_function.4.zig โ†’ test/incremental/x86_64-linux/assert_function.4.zig
File renamed without changes
test/incremental/assert_function.5.zig โ†’ test/incremental/x86_64-linux/assert_function.5.zig
File renamed without changes
test/incremental/assert_function.6.zig โ†’ test/incremental/x86_64-linux/assert_function.6.zig
File renamed without changes
test/incremental/x86_64-linux/assert_function.7.zig
@@ -0,0 +1,28 @@
+pub fn main() void {
+    var i: u32 = 0;
+    while (i < 4) : (i += 1) print();
+    assert(i == 4);
+}
+
+fn print() void {
+    asm volatile ("syscall"
+        :
+        : [number] "{rax}" (1),
+          [arg1] "{rdi}" (1),
+          [arg2] "{rsi}" (@ptrToInt("hello\n")),
+          [arg3] "{rdx}" (6),
+        : "rcx", "r11", "memory"
+    );
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
+// hello
+// hello
+// hello
+// hello
+//
test/incremental/x86_64-linux/assert_function.8.zig
@@ -0,0 +1,24 @@
+pub fn main() void {
+    var i: u32 = 0;
+    inline while (i < 4) : (i += 1) print();
+    assert(i == 4);
+}
+
+fn print() void {
+    asm volatile ("syscall"
+        :
+        : [number] "{rax}" (1),
+          [arg1] "{rdi}" (1),
+          [arg2] "{rsi}" (@ptrToInt("hello\n")),
+          [arg3] "{rdx}" (6),
+        : "rcx", "r11", "memory"
+    );
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// error
+//
+// :5:21: error: unable to resolve comptime value
test/incremental/assert_function.9.zig โ†’ test/incremental/x86_64-linux/assert_function.9.zig
File renamed without changes
test/incremental/comptime_var.0.zig โ†’ test/incremental/x86_64-linux/comptime_var.0.zig
@@ -6,7 +6,7 @@ pub fn main() void {
 
 // error
 // output_mode=Exe
-// target=x86_64-linux,x86_64-macos
+// target=x86_64-linux
 //
 // :4:21: error: store to comptime variable depends on runtime condition
 // :4:11: note: runtime condition here
test/incremental/comptime_var.1.zig โ†’ test/incremental/x86_64-linux/comptime_var.1.zig
File renamed without changes
test/incremental/x86_64-linux/comptime_var.2.zig
@@ -0,0 +1,22 @@
+pub fn main() void {
+    comptime var len: u32 = 5;
+    print(len);
+    len += 9;
+    print(len);
+}
+
+fn print(len: usize) void {
+    asm volatile ("syscall"
+        :
+        : [number] "{rax}" (1),
+          [arg1] "{rdi}" (1),
+          [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")),
+          [arg3] "{rdx}" (len),
+        : "rcx", "r11", "memory"
+    );
+}
+
+// run
+//
+// HelloHello, World!
+//
test/incremental/comptime_var.3.zig โ†’ test/incremental/x86_64-linux/comptime_var.3.zig
File renamed without changes
test/incremental/comptime_var.4.zig โ†’ test/incremental/x86_64-linux/comptime_var.4.zig
File renamed without changes
test/incremental/comptime_var.5.zig โ†’ test/incremental/x86_64-linux/comptime_var.5.zig
File renamed without changes
test/incremental/x86_64-linux/comptime_var.6.zig
@@ -0,0 +1,20 @@
+pub fn main() void {
+    comptime var i: u64 = 2;
+    inline while (i < 6) : (i += 1) {
+        print(i);
+    }
+}
+fn print(len: usize) void {
+    asm volatile ("syscall"
+        :
+        : [number] "{rax}" (1),
+          [arg1] "{rdi}" (1),
+          [arg2] "{rsi}" (@ptrToInt("Hello")),
+          [arg3] "{rdx}" (len),
+        : "rcx", "r11", "memory"
+    );
+}
+
+// run
+//
+// HeHelHellHello
test/incremental/x86_64-macos/assert_function.0.zig
@@ -0,0 +1,15 @@
+pub fn main() void {
+    add(3, 4);
+}
+
+fn add(a: u32, b: u32) void {
+    assert(a + b == 7);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+// target=x86_64-macos
+//
test/incremental/x86_64-macos/assert_function.1.zig
@@ -0,0 +1,17 @@
+pub fn main() void {
+    add(3, 4);
+}
+
+fn add(a: u32, b: u32) void {
+    const c = a + b; // 7
+    const d = a + c; // 10
+    const e = d + b; // 14
+    assert(e == 14);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.10.zig
@@ -0,0 +1,27 @@
+pub fn main() void {
+    assert(add(3, 4) == 116);
+}
+
+fn add(a: u32, b: u32) u32 {
+    const x: u32 = blk: {
+        const c = a + b; // 7
+        const d = a + c; // 10
+        const e = d + b; // 14
+        const f = d + e; // 24
+        const g = e + f; // 38
+        const h = f + g; // 62
+        const i = g + h; // 100
+        const j = i + d; // 110
+        break :blk j;
+    };
+    const y = x + a; // 113
+    const z = y + a; // 116
+    return z;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.11.zig
@@ -0,0 +1,66 @@
+pub fn main() void {
+    assert(add(3, 4) == 1221);
+    assert(mul(3, 4) == 21609);
+}
+
+fn add(a: u32, b: u32) u32 {
+    const x: u32 = blk: {
+        const c = a + b; // 7
+        const d = a + c; // 10
+        const e = d + b; // 14
+        const f = d + e; // 24
+        const g = e + f; // 38
+        const h = f + g; // 62
+        const i = g + h; // 100
+        const j = i + d; // 110
+        const k = i + j; // 210
+        const l = j + k; // 320
+        const m = l + c; // 327
+        const n = m + d; // 337
+        const o = n + e; // 351
+        const p = o + f; // 375
+        const q = p + g; // 413
+        const r = q + h; // 475
+        const s = r + i; // 575
+        const t = s + j; // 685
+        const u = t + k; // 895
+        const v = u + l; // 1215
+        break :blk v;
+    };
+    const y = x + a; // 1218
+    const z = y + a; // 1221
+    return z;
+}
+
+fn mul(a: u32, b: u32) u32 {
+    const x: u32 = blk: {
+        const c = a * a * a * a; // 81
+        const d = a * a * a * b; // 108
+        const e = a * a * b * a; // 108
+        const f = a * a * b * b; // 144
+        const g = a * b * a * a; // 108
+        const h = a * b * a * b; // 144
+        const i = a * b * b * a; // 144
+        const j = a * b * b * b; // 192
+        const k = b * a * a * a; // 108
+        const l = b * a * a * b; // 144
+        const m = b * a * b * a; // 144
+        const n = b * a * b * b; // 192
+        const o = b * b * a * a; // 144
+        const p = b * b * a * b; // 192
+        const q = b * b * b * a; // 192
+        const r = b * b * b * b; // 256
+        const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401
+        break :blk s;
+    };
+    const y = x * a; // 7203
+    const z = y * a; // 21609
+    return z;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.12.zig
@@ -0,0 +1,47 @@
+pub fn main() void {
+    assert(add(3, 4) == 791);
+    assert(add(4, 3) == 79);
+}
+
+fn add(a: u32, b: u32) u32 {
+    const x: u32 = if (a < b) blk: {
+        const c = a + b; // 7
+        const d = a + c; // 10
+        const e = d + b; // 14
+        const f = d + e; // 24
+        const g = e + f; // 38
+        const h = f + g; // 62
+        const i = g + h; // 100
+        const j = i + d; // 110
+        const k = i + j; // 210
+        const l = k + c; // 217
+        const m = l + d; // 227
+        const n = m + e; // 241
+        const o = n + f; // 265
+        const p = o + g; // 303
+        const q = p + h; // 365
+        const r = q + i; // 465
+        const s = r + j; // 575
+        const t = s + k; // 785
+        break :blk t;
+    } else blk: {
+        const t = b + b + a; // 10
+        const c = a + t; // 14
+        const d = c + t; // 24
+        const e = d + t; // 34
+        const f = e + t; // 44
+        const g = f + t; // 54
+        const h = c + g; // 68
+        break :blk h + b; // 71
+    };
+    const y = x + a; // 788, 75
+    const z = y + a; // 791, 79
+    return z;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.13.zig
@@ -0,0 +1,19 @@
+pub fn main() void {
+    const ignore =
+        \\ cool thx
+        \\
+    ;
+    _ = ignore;
+    add('ใ', '\x03');
+}
+
+fn add(a: u32, b: u32) void {
+    assert(a + b == 12356);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.14.zig
@@ -0,0 +1,17 @@
+pub fn main() void {
+    add(aa, bb);
+}
+
+const aa = 'ใ';
+const bb = '\x03';
+
+fn add(a: u32, b: u32) void {
+    assert(a + b == 12356);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.15.zig
@@ -0,0 +1,10 @@
+pub fn main() void {
+    assert("hello"[0] == 'h');
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.16.zig
@@ -0,0 +1,11 @@
+const hello = "hello".*;
+pub fn main() void {
+    assert(hello[1] == 'e');
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.17.zig
@@ -0,0 +1,11 @@
+pub fn main() void {
+    var i: u64 = 0xFFEEDDCCBBAA9988;
+    assert(i == 0xFFEEDDCCBBAA9988);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/assert_function.7.zig โ†’ test/incremental/x86_64-macos/assert_function.18.zig
@@ -3,9 +3,7 @@ const builtin = @import("builtin");
 extern "c" fn write(usize, usize, usize) usize;
 
 pub fn main() void {
-    var i: u32 = 0;
-    while (i < 4) : (i += 1) print();
-    assert(i == 4);
+    for ("hello") |_| print();
 }
 
 fn print() void {
@@ -27,14 +25,11 @@ fn print() void {
     }
 }
 
-pub fn assert(ok: bool) void {
-    if (!ok) unreachable; // assertion failure
-}
-
 // run
 //
 // hello
 // hello
 // hello
 // hello
+// hello
 //
test/incremental/x86_64-macos/assert_function.2.zig
@@ -0,0 +1,21 @@
+pub fn main() void {
+    add(3, 4);
+}
+
+fn add(a: u32, b: u32) void {
+    const c = a + b; // 7
+    const d = a + c; // 10
+    const e = d + b; // 14
+    const f = d + e; // 24
+    const g = e + f; // 38
+    const h = f + g; // 62
+    const i = g + h; // 100
+    assert(i == 100);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.3.zig
@@ -0,0 +1,22 @@
+pub fn main() void {
+    add(3, 4);
+}
+
+fn add(a: u32, b: u32) void {
+    const c = a + b; // 7
+    const d = a + c; // 10
+    const e = d + b; // 14
+    const f = d + e; // 24
+    const g = e + f; // 38
+    const h = f + g; // 62
+    const i = g + h; // 100
+    const j = i + d; // 110
+    assert(j == 110);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.4.zig
@@ -0,0 +1,15 @@
+pub fn main() void {
+    assert(add(3, 4) == 7);
+    assert(add(20, 10) == 30);
+}
+
+fn add(a: u32, b: u32) u32 {
+    return a + b;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.5.zig
@@ -0,0 +1,19 @@
+pub fn main() void {
+    assert(add(3, 4) == 7);
+    assert(add(20, 10) == 30);
+}
+
+fn add(a: u32, b: u32) u32 {
+    var x: u32 = undefined;
+    x = 0;
+    x += a;
+    x += b;
+    return x;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.6.zig
@@ -0,0 +1,9 @@
+pub fn main() void {
+    const a: u32 = 2;
+    const b: ?u32 = a;
+    const c = b.?;
+    if (c != 2) unreachable;
+}
+
+// run
+//
test/incremental/x86_64-macos/assert_function.7.zig
@@ -0,0 +1,23 @@
+extern "c" fn write(usize, usize, usize) usize;
+
+pub fn main() void {
+    var i: u32 = 0;
+    while (i < 4) : (i += 1) print();
+    assert(i == 4);
+}
+
+fn print() void {
+    _ = write(1, @ptrToInt("hello\n"), 6);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
+// hello
+// hello
+// hello
+// hello
+//
test/incremental/x86_64-macos/assert_function.8.zig
@@ -0,0 +1,19 @@
+extern "c" fn write(usize, usize, usize) usize;
+
+pub fn main() void {
+    var i: u32 = 0;
+    inline while (i < 4) : (i += 1) print();
+    assert(i == 4);
+}
+
+fn print() void {
+    _ = write(1, @ptrToInt("hello\n"), 6);
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// error
+//
+// :5:21: error: unable to resolve comptime value
test/incremental/x86_64-macos/assert_function.9.zig
@@ -0,0 +1,22 @@
+pub fn main() void {
+    assert(add(3, 4) == 20);
+}
+
+fn add(a: u32, b: u32) u32 {
+    const x: u32 = blk: {
+        const c = a + b; // 7
+        const d = a + c; // 10
+        const e = d + b; // 14
+        break :blk e;
+    };
+    const y = x + a; // 17
+    const z = y + a; // 20
+    return z;
+}
+
+pub fn assert(ok: bool) void {
+    if (!ok) unreachable; // assertion failure
+}
+
+// run
+//
test/incremental/x86_64-macos/comptime_var.0.zig
@@ -0,0 +1,12 @@
+pub fn main() void {
+    var a: u32 = 0;
+    comptime var b: u32 = 0;
+    if (a == 0) b = 3;
+}
+
+// error
+// output_mode=Exe
+// target=x86_64-macos
+//
+// :4:21: error: store to comptime variable depends on runtime condition
+// :4:11: note: runtime condition here
test/incremental/x86_64-macos/comptime_var.1.zig
@@ -0,0 +1,13 @@
+pub fn main() void {
+    var a: u32 = 0;
+    comptime var b: u32 = 0;
+    switch (a) {
+        0 => {},
+        else => b = 3,
+    }
+}
+
+// error
+//
+// :6:21: error: store to comptime variable depends on runtime condition
+// :4:13: note: runtime condition here
test/incremental/x86_64-macos/comptime_var.2.zig
@@ -0,0 +1,17 @@
+extern "c" fn write(usize, usize, usize) usize;
+
+pub fn main() void {
+    comptime var len: u32 = 5;
+    print(len);
+    len += 9;
+    print(len);
+}
+
+fn print(len: usize) void {
+    _ = write(1, @ptrToInt("Hello, World!\n"), len);
+}
+
+// run
+//
+// HelloHello, World!
+//
test/incremental/x86_64-macos/comptime_var.3.zig
@@ -0,0 +1,10 @@
+comptime {
+    var x: i32 = 1;
+    x += 1;
+    if (x != 1) unreachable;
+}
+pub fn main() void {}
+
+// error
+//
+// :4:17: error: unable to resolve comptime value
test/incremental/x86_64-macos/comptime_var.4.zig
@@ -0,0 +1,9 @@
+pub fn main() void {
+    comptime var i: u64 = 0;
+    while (i < 5) : (i += 1) {}
+}
+
+// error
+//
+// :3:24: error: cannot store to comptime variable in non-inline loop
+// :3:5: note: non-inline loop here
test/incremental/x86_64-macos/comptime_var.5.zig
@@ -0,0 +1,15 @@
+pub fn main() void {
+    var a: u32 = 0;
+    if (a == 0) {
+        comptime var b: u32 = 0;
+        b = 1;
+    }
+}
+comptime {
+    var x: i32 = 1;
+    x += 1;
+    if (x != 2) unreachable;
+}
+
+// run
+//
test/incremental/x86_64-macos/comptime_var.6.zig
@@ -0,0 +1,15 @@
+extern "c" fn write(usize, usize, usize) usize;
+
+pub fn main() void {
+    comptime var i: u64 = 2;
+    inline while (i < 6) : (i += 1) {
+        print(i);
+    }
+}
+fn print(len: usize) void {
+    _ = write(1, @ptrToInt("Hello"), len);
+}
+
+// run
+//
+// HeHelHellHello
test/incremental/assert_function.8.zig
@@ -1,36 +0,0 @@
-const builtin = @import("builtin");
-
-extern "c" fn write(usize, usize, usize) usize;
-
-pub fn main() void {
-    var i: u32 = 0;
-    inline while (i < 4) : (i += 1) print();
-    assert(i == 4);
-}
-
-fn print() void {
-    switch (builtin.os.tag) {
-        .linux => {
-            asm volatile ("syscall"
-                :
-                : [number] "{rax}" (1),
-                  [arg1] "{rdi}" (1),
-                  [arg2] "{rsi}" (@ptrToInt("hello\n")),
-                  [arg3] "{rdx}" (6),
-                : "rcx", "r11", "memory"
-            );
-        },
-        .macos => {
-            _ = write(1, @ptrToInt("hello\n"), 6);
-        },
-        else => unreachable,
-    }
-}
-
-pub fn assert(ok: bool) void {
-    if (!ok) unreachable; // assertion failure
-}
-
-// error
-//
-// :7:21: error: unable to resolve comptime value
test/incremental/comptime_var.2.zig
@@ -1,34 +0,0 @@
-const builtin = @import("builtin");
-
-extern "c" fn write(usize, usize, usize) usize;
-
-pub fn main() void {
-    comptime var len: u32 = 5;
-    print(len);
-    len += 9;
-    print(len);
-}
-
-fn print(len: usize) void {
-    switch (builtin.os.tag) {
-        .linux => {
-            asm volatile ("syscall"
-                :
-                : [number] "{rax}" (1),
-                  [arg1] "{rdi}" (1),
-                  [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")),
-                  [arg3] "{rdx}" (len),
-                : "rcx", "r11", "memory"
-            );
-        },
-        .macos => {
-            _ = write(1, @ptrToInt("Hello, World!\n"), len);
-        },
-        else => unreachable,
-    }
-}
-
-// run
-//
-// HelloHello, World!
-//
test/incremental/comptime_var.6.zig
@@ -1,32 +0,0 @@
-const builtin = @import("builtin");
-
-extern "c" fn write(usize, usize, usize) usize;
-
-pub fn main() void {
-    comptime var i: u64 = 2;
-    inline while (i < 6) : (i += 1) {
-        print(i);
-    }
-}
-fn print(len: usize) void {
-    switch (builtin.os.tag) {
-        .linux => {
-            asm volatile ("syscall"
-                :
-                : [number] "{rax}" (1),
-                  [arg1] "{rdi}" (1),
-                  [arg2] "{rsi}" (@ptrToInt("Hello")),
-                  [arg3] "{rdx}" (len),
-                : "rcx", "r11", "memory"
-            );
-        },
-        .macos => {
-            _ = write(1, @ptrToInt("Hello"), len);
-        },
-        else => unreachable,
-    }
-}
-
-// run
-//
-// HeHelHellHello