| author | |
| committer | |
| log | 65b95b0af42b3da0aaa86c9448e32e8aca388a17 |
| tree | b23b76af4f22bf95692d10c858be9f4d41b4fb9f |
| parent | c4c3818c396dc57e1422356f3bb865d99c0c27e8 |
40 files changed, 331 insertions(+), 63 deletions(-)
test/behavior/addrspace_and_linksection.zig+4| ... | ... | @@ -12,6 +12,8 @@ const var_linksection = linksections.?[1]; |
| 12 | 12 | const fn_linksection = linksections.?[2]; |
| 13 | 13 | |
| 14 | 14 | test "addrspace on container-level const" { |
| 15 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 16 | ||
| 15 | 17 | const S = struct { |
| 16 | 18 | const a: u32 addrspace(.generic) = 123; |
| 17 | 19 | fn check(ptr: anytype) !void { |
| ... | ... | @@ -47,6 +49,8 @@ test "addrspace and linksection on container-level const" { |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | test "addrspace on container-level var" { |
| 52 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 53 | ||
| 50 | 54 | const S = struct { |
| 51 | 55 | var a: u32 addrspace(.generic) = 123; |
| 52 | 56 | fn check(ptr: anytype) !void { |
test/behavior/align.zig+1| ... | ... | @@ -467,6 +467,7 @@ var default_aligned_global = DefaultAligned{ |
| 467 | 467 | }; |
| 468 | 468 | |
| 469 | 469 | test "read 128-bit field from default aligned struct in global memory" { |
| 470 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 470 | 471 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 471 | 472 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 472 | 473 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/array.zig+1-1| ... | ... | @@ -582,6 +582,7 @@ test "array with comptime-only element type" { |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | test "tuple to array handles sentinel" { |
| 585 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 585 | 586 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 586 | 587 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 587 | 588 | |
| ... | ... | @@ -936,7 +937,6 @@ test "accessing multidimensional global array at comptime" { |
| 936 | 937 | |
| 937 | 938 | test "union that needs padding bytes inside an array" { |
| 938 | 939 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 939 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 940 | 940 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 941 | 941 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 942 | 942 |
test/behavior/basic.zig+6| ... | ... | @@ -60,6 +60,7 @@ const g1: i32 = 1233 + 1; |
| 60 | 60 | var g2: i32 = 0; |
| 61 | 61 | |
| 62 | 62 | test "global variables" { |
| 63 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 63 | 64 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 64 | 65 | |
| 65 | 66 | try expect(g2 == 0); |
| ... | ... | @@ -683,6 +684,7 @@ var gdt = [_]GDTEntry{ |
| 683 | 684 | var global_ptr = &gdt[0]; |
| 684 | 685 | |
| 685 | 686 | test "global constant is loaded with a runtime-known index" { |
| 687 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 686 | 688 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 687 | 689 | |
| 688 | 690 | const S = struct { |
| ... | ... | @@ -999,6 +1001,8 @@ test "generic function uses return type of other generic function" { |
| 999 | 1001 | } |
| 1000 | 1002 | |
| 1001 | 1003 | test "const alloc with comptime-known initializer is made comptime-known" { |
| 1004 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1005 | ||
| 1002 | 1006 | const S = struct { |
| 1003 | 1007 | a: bool, |
| 1004 | 1008 | b: [2]u8, |
| ... | ... | @@ -1079,6 +1083,8 @@ test "inline call of function with a switch inside the return statement" { |
| 1079 | 1083 | } |
| 1080 | 1084 | |
| 1081 | 1085 | test "pointer to zero sized global is mutable" { |
| 1086 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1087 | ||
| 1082 | 1088 | const S = struct { |
| 1083 | 1089 | const Thing = struct {}; |
| 1084 | 1090 |
test/behavior/bitcast.zig-1| ... | ... | @@ -110,7 +110,6 @@ test "@bitCast packed structs at runtime and comptime" { |
| 110 | 110 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 111 | 111 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 112 | 112 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 113 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 114 | 113 | |
| 115 | 114 | const Full = packed struct { |
| 116 | 115 | number: u16, |
test/behavior/call.zig+2| ... | ... | @@ -538,6 +538,8 @@ test "call function pointer in comptime field" { |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | test "generic function pointer can be called" { |
| 541 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 542 | ||
| 541 | 543 | const S = struct { |
| 542 | 544 | var ok = false; |
| 543 | 545 | fn foo(x: anytype) void { |
test/behavior/comptime_memory.zig+2| ... | ... | @@ -431,6 +431,8 @@ test "type pun @ptrFromInt" { |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | test "type pun null pointer-like optional" { |
| 434 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 435 | ||
| 434 | 436 | const p: ?*u8 = null; |
| 435 | 437 | // note that expectEqual hides the bug |
| 436 | 438 | try testing.expect(@as(*const ?*i8, @ptrCast(&p)).* == null); |
test/behavior/decl_literals.zig-1| ... | ... | @@ -35,7 +35,6 @@ test "decl literal with pointer" { |
| 35 | 35 | test "call decl literal with optional" { |
| 36 | 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 37 | 37 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 38 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 39 | 38 | |
| 40 | 39 | const S = struct { |
| 41 | 40 | x: u32, |
test/behavior/defer.zig+1| ... | ... | @@ -89,6 +89,7 @@ fn runSomeErrorDefers(x: bool) !bool { |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | test "mixing normal and error defers" { |
| 92 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 92 | 93 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 93 | 94 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 94 | 95 |
test/behavior/enum.zig-1| ... | ... | @@ -930,7 +930,6 @@ test "constant enum initialization with differing sizes" { |
| 930 | 930 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 931 | 931 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 932 | 932 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 933 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 934 | 933 | try test3_1(test3_foo); |
| 935 | 934 | try test3_2(test3_bar); |
| 936 | 935 | } |
test/behavior/error.zig+3-1| ... | ... | @@ -524,7 +524,6 @@ test "function pointer with return type that is error union with payload which i |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | test "return result loc as peer result loc in inferred error set function" { |
| 527 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 528 | 527 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 529 | 528 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 530 | 529 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -783,6 +782,7 @@ const NoReturn = struct { |
| 783 | 782 | }; |
| 784 | 783 | |
| 785 | 784 | test "error union of noreturn used with if" { |
| 785 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 786 | 786 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 787 | 787 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 788 | 788 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -796,6 +796,7 @@ test "error union of noreturn used with if" { |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | test "error union of noreturn used with try" { |
| 799 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 799 | 800 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 800 | 801 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 801 | 802 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -806,6 +807,7 @@ test "error union of noreturn used with try" { |
| 806 | 807 | } |
| 807 | 808 | |
| 808 | 809 | test "error union of noreturn used with catch" { |
| 810 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 809 | 811 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 810 | 812 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 811 | 813 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
test/behavior/eval.zig+13| ... | ... | @@ -5,6 +5,8 @@ const expect = std.testing.expect; |
| 5 | 5 | const expectEqual = std.testing.expectEqual; |
| 6 | 6 | |
| 7 | 7 | test "compile time recursion" { |
| 8 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 9 | ||
| 8 | 10 | try expect(some_data.len == 21); |
| 9 | 11 | } |
| 10 | 12 | var some_data: [@as(usize, @intCast(fibonacci(7)))]u8 = undefined; |
| ... | ... | @@ -388,6 +390,7 @@ test "return 0 from function that has u0 return type" { |
| 388 | 390 | } |
| 389 | 391 | |
| 390 | 392 | test "statically initialized struct" { |
| 393 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 391 | 394 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 392 | 395 | |
| 393 | 396 | st_init_str_foo.x += 1; |
| ... | ... | @@ -927,6 +930,7 @@ test "closure capture type of runtime-known var" { |
| 927 | 930 | } |
| 928 | 931 | |
| 929 | 932 | test "comptime break passing through runtime condition converted to runtime break" { |
| 933 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 930 | 934 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 931 | 935 | |
| 932 | 936 | const S = struct { |
| ... | ... | @@ -959,6 +963,7 @@ test "comptime break passing through runtime condition converted to runtime brea |
| 959 | 963 | } |
| 960 | 964 | |
| 961 | 965 | test "comptime break to outer loop passing through runtime condition converted to runtime break" { |
| 966 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 962 | 967 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 963 | 968 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 964 | 969 | |
| ... | ... | @@ -1158,6 +1163,8 @@ test "repeated value is correctly expanded" { |
| 1158 | 1163 | } |
| 1159 | 1164 | |
| 1160 | 1165 | test "value in if block is comptime-known" { |
| 1166 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1167 | ||
| 1161 | 1168 | const first = blk: { |
| 1162 | 1169 | const s = if (false) "a" else "b"; |
| 1163 | 1170 | break :blk "foo" ++ s; |
| ... | ... | @@ -1266,6 +1273,8 @@ test "continue in inline for inside a comptime switch" { |
| 1266 | 1273 | } |
| 1267 | 1274 | |
| 1268 | 1275 | test "length of global array is determinable at comptime" { |
| 1276 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1277 | ||
| 1269 | 1278 | const S = struct { |
| 1270 | 1279 | var bytes: [1024]u8 = undefined; |
| 1271 | 1280 | |
| ... | ... | @@ -1313,6 +1322,7 @@ test "continue nested inline for loop in named block expr" { |
| 1313 | 1322 | } |
| 1314 | 1323 | |
| 1315 | 1324 | test "x and false is comptime-known false" { |
| 1325 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1316 | 1326 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1317 | 1327 | |
| 1318 | 1328 | const T = struct { |
| ... | ... | @@ -1340,6 +1350,7 @@ test "x and false is comptime-known false" { |
| 1340 | 1350 | } |
| 1341 | 1351 | |
| 1342 | 1352 | test "x or true is comptime-known true" { |
| 1353 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1343 | 1354 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1344 | 1355 | |
| 1345 | 1356 | const T = struct { |
| ... | ... | @@ -1401,6 +1412,8 @@ test "comptime function turns function value to function pointer" { |
| 1401 | 1412 | } |
| 1402 | 1413 | |
| 1403 | 1414 | test "container level const and var have unique addresses" { |
| 1415 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1416 | ||
| 1404 | 1417 | const S = struct { |
| 1405 | 1418 | x: i32, |
| 1406 | 1419 | y: i32, |
test/behavior/export_builtin.zig+2| ... | ... | @@ -4,6 +4,7 @@ const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | 5 | test "exporting enum value" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 7 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 7 | 8 | |
| 8 | 9 | const S = struct { |
| 9 | 10 | const E = enum(c_int) { one, two }; |
| ... | ... | @@ -29,6 +30,7 @@ test "exporting with internal linkage" { |
| 29 | 30 | |
| 30 | 31 | test "exporting using namespace access" { |
| 31 | 32 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 33 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 32 | 34 | |
| 33 | 35 | const S = struct { |
| 34 | 36 | const Inner = struct { |
test/behavior/floatop.zig-7| ... | ... | @@ -464,7 +464,6 @@ test "@sqrt with vectors" { |
| 464 | 464 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 465 | 465 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 466 | 466 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 467 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 468 | 467 | |
| 469 | 468 | try testSqrtWithVectors(); |
| 470 | 469 | try comptime testSqrtWithVectors(); |
| ... | ... | @@ -532,7 +531,6 @@ test "@sin with vectors" { |
| 532 | 531 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 533 | 532 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 534 | 533 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 535 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 536 | 534 | |
| 537 | 535 | try testSinWithVectors(); |
| 538 | 536 | try comptime testSinWithVectors(); |
| ... | ... | @@ -600,7 +598,6 @@ test "@cos with vectors" { |
| 600 | 598 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 601 | 599 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 602 | 600 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 603 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 604 | 601 | |
| 605 | 602 | try testCosWithVectors(); |
| 606 | 603 | try comptime testCosWithVectors(); |
| ... | ... | @@ -668,7 +665,6 @@ test "@tan with vectors" { |
| 668 | 665 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 669 | 666 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 670 | 667 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 671 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 672 | 668 | |
| 673 | 669 | try testTanWithVectors(); |
| 674 | 670 | try comptime testTanWithVectors(); |
| ... | ... | @@ -740,7 +736,6 @@ test "@exp with vectors" { |
| 740 | 736 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 741 | 737 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 742 | 738 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 743 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 744 | 739 | |
| 745 | 740 | try testExpWithVectors(); |
| 746 | 741 | try comptime testExpWithVectors(); |
| ... | ... | @@ -807,7 +802,6 @@ test "@exp2 with @vectors" { |
| 807 | 802 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 808 | 803 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 809 | 804 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 810 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 811 | 805 | |
| 812 | 806 | try testExp2WithVectors(); |
| 813 | 807 | try comptime testExp2WithVectors(); |
| ... | ... | @@ -939,7 +933,6 @@ test "@log2 with vectors" { |
| 939 | 933 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 940 | 934 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 941 | 935 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 942 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 943 | 936 | // https://github.com/ziglang/zig/issues/13681 |
| 944 | 937 | if (builtin.zig_backend == .stage2_llvm and |
| 945 | 938 | builtin.cpu.arch == .aarch64 and |
test/behavior/generics.zig+1| ... | ... | @@ -516,6 +516,7 @@ test "comptime callconv(.c) function ptr uses comptime type argument" { |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | test "call generic function with from function called by the generic function" { |
| 519 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 519 | 520 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 520 | 521 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 521 | 522 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/globals.zig+2-4| ... | ... | @@ -4,6 +4,7 @@ const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | 5 | var pos = [2]f32{ 0.0, 0.0 }; |
| 6 | 6 | test "store to global array" { |
| 7 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 7 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 8 | 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 9 | 10 | |
| ... | ... | @@ -14,6 +15,7 @@ test "store to global array" { |
| 14 | 15 | |
| 15 | 16 | var vpos = @Vector(2, f32){ 0.0, 0.0 }; |
| 16 | 17 | test "store to global vector" { |
| 18 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 17 | 19 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 18 | 20 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 19 | 21 | |
| ... | ... | @@ -66,8 +68,6 @@ test "global loads can affect liveness" { |
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | test "global const can be self-referential" { |
| 69 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 70 | ||
| 71 | 71 | const S = struct { |
| 72 | 72 | self: *const @This(), |
| 73 | 73 | x: u32, |
| ... | ... | @@ -112,8 +112,6 @@ test "global var can be self-referential" { |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | test "global const can be indirectly self-referential" { |
| 115 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 116 | ||
| 117 | 115 | const S = struct { |
| 118 | 116 | other: *const @This(), |
| 119 | 117 | x: u32, |
test/behavior/if.zig+1| ... | ... | @@ -44,6 +44,7 @@ var global_with_val: anyerror!u32 = 0; |
| 44 | 44 | var global_with_err: anyerror!u32 = error.SomeError; |
| 45 | 45 | |
| 46 | 46 | test "unwrap mutable global var" { |
| 47 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 47 | 48 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 48 | 49 | |
| 49 | 50 | if (global_with_val) |v| { |
test/behavior/inline_switch.zig-2| ... | ... | @@ -4,7 +4,6 @@ const builtin = @import("builtin"); |
| 4 | 4 | |
| 5 | 5 | test "inline scalar prongs" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 7 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 8 | 7 | |
| 9 | 8 | var x: usize = 0; |
| 10 | 9 | switch (x) { |
| ... | ... | @@ -19,7 +18,6 @@ test "inline scalar prongs" { |
| 19 | 18 | |
| 20 | 19 | test "inline prong ranges" { |
| 21 | 20 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 22 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 23 | 21 | |
| 24 | 22 | var x: usize = 0; |
| 25 | 23 | _ = &x; |
test/behavior/ir_block_deps.zig-1| ... | ... | @@ -19,7 +19,6 @@ fn getErrInt() anyerror!i32 { |
| 19 | 19 | |
| 20 | 20 | test "ir block deps" { |
| 21 | 21 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 22 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 23 | 22 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 24 | 23 | |
| 25 | 24 | try expect((foo(1) catch unreachable) == 0); |
test/behavior/math.zig+1| ... | ... | @@ -2570,6 +2570,7 @@ test "partially-runtime integer vector division would be illegal if vector eleme |
| 2570 | 2570 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2571 | 2571 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2572 | 2572 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 2573 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2573 | 2574 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 2574 | 2575 | |
| 2575 | 2576 | var lhs: @Vector(2, i8) = .{ -128, 5 }; |
test/behavior/null.zig+1| ... | ... | @@ -183,6 +183,7 @@ const SillyStruct = struct { |
| 183 | 183 | const here_is_a_null_literal = SillyStruct{ .context = null }; |
| 184 | 184 | |
| 185 | 185 | test "unwrap optional which is field of global var" { |
| 186 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 186 | 187 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 187 | 188 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 188 | 189 |
test/behavior/optional.zig+2-4| ... | ... | @@ -319,7 +319,6 @@ test "assigning to an unwrapped optional field in an inline loop" { |
| 319 | 319 | test "coerce an anon struct literal to optional struct" { |
| 320 | 320 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 321 | 321 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 322 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 323 | 322 | |
| 324 | 323 | const S = struct { |
| 325 | 324 | const Struct = struct { |
| ... | ... | @@ -388,7 +387,6 @@ test "0-bit child type coerced to optional" { |
| 388 | 387 | test "array of optional unaligned types" { |
| 389 | 388 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 390 | 389 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 391 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 392 | 390 | |
| 393 | 391 | const Enum = enum { one, two, three }; |
| 394 | 392 | |
| ... | ... | @@ -477,6 +475,7 @@ const NoReturn = struct { |
| 477 | 475 | }; |
| 478 | 476 | |
| 479 | 477 | test "optional of noreturn used with if" { |
| 478 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 480 | 479 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 481 | 480 | |
| 482 | 481 | NoReturn.a = 64; |
| ... | ... | @@ -488,6 +487,7 @@ test "optional of noreturn used with if" { |
| 488 | 487 | } |
| 489 | 488 | |
| 490 | 489 | test "optional of noreturn used with orelse" { |
| 490 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 491 | 491 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 492 | 492 | |
| 493 | 493 | NoReturn.a = 64; |
| ... | ... | @@ -652,8 +652,6 @@ test "result location initialization of optional with OPV payload" { |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | test "global comptime only optional" { |
| 655 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 656 | ||
| 657 | 655 | const S = struct { |
| 658 | 656 | const @"null": ?*type = null; |
| 659 | 657 | const @"void": ?*const type = &void; |
test/behavior/packed-struct.zig-9| ... | ... | @@ -794,7 +794,6 @@ test "nested packed struct at non-zero offset 2" { |
| 794 | 794 | test "runtime init of unnamed packed struct type" { |
| 795 | 795 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 796 | 796 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 797 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 798 | 797 | |
| 799 | 798 | var z: u8 = 123; |
| 800 | 799 | _ = &z; |
| ... | ... | @@ -889,7 +888,6 @@ test "store undefined to packed result location" { |
| 889 | 888 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 890 | 889 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 891 | 890 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 892 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 893 | 891 | |
| 894 | 892 | var x: u4 = 0; |
| 895 | 893 | _ = &x; |
| ... | ... | @@ -910,7 +908,6 @@ test "bitcast back and forth" { |
| 910 | 908 | // Originally reported at https://github.com/ziglang/zig/issues/14200 |
| 911 | 909 | test "field access of packed struct smaller than its abi size inside struct initialized with rls" { |
| 912 | 910 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 913 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 914 | 911 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 915 | 912 | |
| 916 | 913 | const S = struct { |
| ... | ... | @@ -1006,7 +1003,6 @@ test "packed struct acts as a namespace" { |
| 1006 | 1003 | test "assignment to non-byte-aligned field in packed struct" { |
| 1007 | 1004 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1008 | 1005 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1009 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1010 | 1006 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 1011 | 1007 | |
| 1012 | 1008 | const Frame = packed struct { |
| ... | ... | @@ -1046,7 +1042,6 @@ test "load flag from packed struct in union" { |
| 1046 | 1042 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1047 | 1043 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1048 | 1044 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1049 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1050 | 1045 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1051 | 1046 | |
| 1052 | 1047 | const A = packed struct { |
| ... | ... | @@ -1168,7 +1163,6 @@ test "packed struct equality" { |
| 1168 | 1163 | |
| 1169 | 1164 | test "packed struct equality ignores padding bits" { |
| 1170 | 1165 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1171 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1172 | 1166 | |
| 1173 | 1167 | const S = packed struct { b: bool }; |
| 1174 | 1168 | var s: S = undefined; |
| ... | ... | @@ -1178,7 +1172,6 @@ test "packed struct equality ignores padding bits" { |
| 1178 | 1172 | } |
| 1179 | 1173 | |
| 1180 | 1174 | test "packed struct with signed field" { |
| 1181 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1182 | 1175 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1183 | 1176 | |
| 1184 | 1177 | var s: packed struct { |
| ... | ... | @@ -1193,7 +1186,6 @@ test "packed struct with signed field" { |
| 1193 | 1186 | test "assign packed struct initialized with RLS to packed struct literal field" { |
| 1194 | 1187 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1195 | 1188 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1196 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1197 | 1189 | |
| 1198 | 1190 | const Inner = packed struct { x: u17 }; |
| 1199 | 1191 | const Outer = packed struct { inner: Inner, x: u15 }; |
| ... | ... | @@ -1209,7 +1201,6 @@ test "assign packed struct initialized with RLS to packed struct literal field" |
| 1209 | 1201 | |
| 1210 | 1202 | test "packed struct store of comparison result" { |
| 1211 | 1203 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1212 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1213 | 1204 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 1214 | 1205 | |
| 1215 | 1206 | const S1 = packed struct { |
test/behavior/pointers.zig+2| ... | ... | @@ -642,6 +642,8 @@ test "result type preserved through multiple references" { |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | test "result type found through optional pointer" { |
| 645 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 646 | ||
| 645 | 647 | const ptr1: ?*const u32 = &@intCast(123); |
| 646 | 648 | const ptr2: ?[]const u8 = &.{ @intCast(123), @truncate(0xABCD) }; |
| 647 | 649 | try expect(ptr1.?.* == 123); |
test/behavior/shuffle.zig-1| ... | ... | @@ -176,7 +176,6 @@ test "@shuffle u0" { |
| 176 | 176 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 177 | 177 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 178 | 178 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 179 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 180 | 179 | |
| 181 | 180 | const S = struct { |
| 182 | 181 | fn doTheTest() !void { |
test/behavior/sizeof_and_typeof.zig+1| ... | ... | @@ -134,6 +134,7 @@ test "@TypeOf() has no runtime side effects" { |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | test "branching logic inside @TypeOf" { |
| 137 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 137 | 138 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 138 | 139 | |
| 139 | 140 | const S = struct { |
test/behavior/slice.zig+1-2| ... | ... | @@ -254,8 +254,6 @@ test "slicing pointer by length" { |
| 254 | 254 | const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500]; |
| 255 | 255 | const y = x[0x100..]; |
| 256 | 256 | test "compile time slice of pointer to hard coded address" { |
| 257 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 258 | ||
| 259 | 257 | try expect(@intFromPtr(x) == 0x1000); |
| 260 | 258 | try expect(x.len == 0x500); |
| 261 | 259 | |
| ... | ... | @@ -858,6 +856,7 @@ test "slice len modification at comptime" { |
| 858 | 856 | } |
| 859 | 857 | |
| 860 | 858 | test "slice field ptr const" { |
| 859 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 861 | 860 | const const_slice: []const u8 = "string"; |
| 862 | 861 | |
| 863 | 862 | const const_ptr_const_slice = &const_slice; |
test/behavior/splat.zig+1| ... | ... | @@ -92,6 +92,7 @@ test "splat with an error union or optional result type" { |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | test "read/write through global variable array of struct fields initialized via splat" { |
| 95 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 95 | 96 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 96 | 97 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 97 | 98 |
test/behavior/struct.zig+5-2| ... | ... | @@ -443,6 +443,7 @@ test "packed struct 24bits" { |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | test "runtime struct initialization of bitfield" { |
| 446 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 446 | 447 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 447 | 448 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 448 | 449 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -714,6 +715,7 @@ test "packed struct with u0 field access" { |
| 714 | 715 | } |
| 715 | 716 | |
| 716 | 717 | test "access to global struct fields" { |
| 718 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 717 | 719 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 718 | 720 | |
| 719 | 721 | g_foo.bar.value = 42; |
| ... | ... | @@ -943,7 +945,6 @@ test "tuple element initialized with fn call" { |
| 943 | 945 | } |
| 944 | 946 | |
| 945 | 947 | test "struct with union field" { |
| 946 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 947 | 948 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 948 | 949 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 949 | 950 | |
| ... | ... | @@ -1081,7 +1082,6 @@ test "anon init through error unions and optionals" { |
| 1081 | 1082 | test "anon init through optional" { |
| 1082 | 1083 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1083 | 1084 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1084 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1085 | 1085 | |
| 1086 | 1086 | const S = struct { |
| 1087 | 1087 | a: u32, |
| ... | ... | @@ -1760,6 +1760,8 @@ test "circular dependency through pointer field of a struct" { |
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | 1762 | test "field calls do not force struct field init resolution" { |
| 1763 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1764 | ||
| 1763 | 1765 | const S = struct { |
| 1764 | 1766 | x: u32 = blk: { |
| 1765 | 1767 | _ = @TypeOf(make().dummyFn()); // runtime field call - S not fully resolved - dummyFn call should not force field init resolution |
| ... | ... | @@ -1985,6 +1987,7 @@ test "assignment of field with padding" { |
| 1985 | 1987 | } |
| 1986 | 1988 | |
| 1987 | 1989 | test "initiate global variable with runtime value" { |
| 1990 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1988 | 1991 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1989 | 1992 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1990 | 1993 |
test/behavior/switch.zig+1-10| ... | ... | @@ -252,6 +252,7 @@ fn poll() void { |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | test "switch on global mutable var isn't constant-folded" { |
| 255 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 255 | 256 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 256 | 257 | |
| 257 | 258 | while (state < 2) { |
| ... | ... | @@ -270,7 +271,6 @@ test "switch prong with variable" { |
| 270 | 271 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 271 | 272 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 272 | 273 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 273 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 274 | 274 | |
| 275 | 275 | try switchProngWithVarFn(SwitchProngWithVarEnum{ .One = 13 }); |
| 276 | 276 | try switchProngWithVarFn(SwitchProngWithVarEnum{ .Two = 13.0 }); |
| ... | ... | @@ -294,7 +294,6 @@ fn switchProngWithVarFn(a: SwitchProngWithVarEnum) !void { |
| 294 | 294 | test "switch on enum using pointer capture" { |
| 295 | 295 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 296 | 296 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 297 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 298 | 297 | |
| 299 | 298 | try testSwitchEnumPtrCapture(); |
| 300 | 299 | try comptime testSwitchEnumPtrCapture(); |
| ... | ... | @@ -570,7 +569,6 @@ test "switch with null and T peer types and inferred result location type" { |
| 570 | 569 | test "switch prongs with cases with identical payload types" { |
| 571 | 570 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 572 | 571 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 573 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 574 | 572 | |
| 575 | 573 | const Union = union(enum) { |
| 576 | 574 | A: usize, |
| ... | ... | @@ -726,7 +724,6 @@ test "switch on error set with single else" { |
| 726 | 724 | test "switch capture copies its payload" { |
| 727 | 725 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 728 | 726 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 729 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 730 | 727 | |
| 731 | 728 | const S = struct { |
| 732 | 729 | fn doTheTest() !void { |
| ... | ... | @@ -788,7 +785,6 @@ test "enum value without tag name used as switch item" { |
| 788 | 785 | } |
| 789 | 786 | |
| 790 | 787 | test "switch item sizeof" { |
| 791 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 792 | 788 | const S = struct { |
| 793 | 789 | fn doTheTest() !void { |
| 794 | 790 | var a: usize = 0; |
| ... | ... | @@ -817,8 +813,6 @@ test "comptime inline switch" { |
| 817 | 813 | } |
| 818 | 814 | |
| 819 | 815 | test "switch capture peer type resolution" { |
| 820 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 821 | ||
| 822 | 816 | const U = union(enum) { |
| 823 | 817 | a: u32, |
| 824 | 818 | b: u64, |
| ... | ... | @@ -835,7 +829,6 @@ test "switch capture peer type resolution" { |
| 835 | 829 | |
| 836 | 830 | test "switch capture peer type resolution for in-memory coercible payloads" { |
| 837 | 831 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 838 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 839 | 832 | |
| 840 | 833 | const T1 = c_int; |
| 841 | 834 | const t1_info = @typeInfo(T1).int; |
| ... | ... | @@ -1166,8 +1159,6 @@ test "switch with uninstantiable union fields" { |
| 1166 | 1159 | } |
| 1167 | 1160 | |
| 1168 | 1161 | test "switch with tag capture" { |
| 1169 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1170 | ||
| 1171 | 1162 | const U = union(enum) { |
| 1172 | 1163 | a, |
| 1173 | 1164 | b: i32, |
test/behavior/switch_loop.zig-2| ... | ... | @@ -96,7 +96,6 @@ test "switch loop on tagged union" { |
| 96 | 96 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 97 | 97 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 98 | 98 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 99 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 100 | 99 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 101 | 100 | |
| 102 | 101 | const S = struct { |
| ... | ... | @@ -291,7 +290,6 @@ test "switch loop with discarded tag capture" { |
| 291 | 290 | } |
| 292 | 291 | |
| 293 | 292 | test "switch loop with single catch-all prong" { |
| 294 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 295 | 293 | const S = struct { |
| 296 | 294 | const E = enum { a, b, c }; |
| 297 | 295 | const U = union(E) { a: u32, b: u16, c: u8 }; |
test/behavior/switch_prong_implicit_cast.zig-1| ... | ... | @@ -18,7 +18,6 @@ test "switch prong implicit cast" { |
| 18 | 18 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 19 | 19 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 20 | 20 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 21 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 22 | 21 | |
| 23 | 22 | const result = switch (foo(2) catch unreachable) { |
| 24 | 23 | FormValue.One => false, |
test/behavior/threadlocal.zig-1| ... | ... | @@ -6,7 +6,6 @@ test "thread local variable" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 10 | 9 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 11 | 10 | |
| 12 | 11 | const S = struct { |
test/behavior/tuple.zig+2| ... | ... | @@ -548,6 +548,8 @@ test "OPV tuple fields aren't comptime" { |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | test "array of tuples that end with a zero-bit field followed by padding" { |
| 551 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 552 | ||
| 551 | 553 | const S = struct { |
| 552 | 554 | var foo: [2]struct { u32, u8, void } = .{ .{ 1, 2, {} }, .{ 3, 4, {} } }; |
| 553 | 555 | }; |
test/behavior/type.zig+2| ... | ... | @@ -406,6 +406,8 @@ test "matching captures causes opaque equivalence" { |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | test "reify enum where fields refers to part of array" { |
| 409 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 410 | ||
| 409 | 411 | const field_names: [3][]const u8 = .{ "foo", "bar", undefined }; |
| 410 | 412 | const field_values: [3]u8 = .{ undefined, 0, 1 }; |
| 411 | 413 | const E = @Enum(u8, .exhaustive, field_names[0..2], field_values[1..3]); |
test/behavior/union.zig+3-11| ... | ... | @@ -442,6 +442,7 @@ const Foo1 = union(enum) { |
| 442 | 442 | var glbl: Foo1 = undefined; |
| 443 | 443 | |
| 444 | 444 | test "global union with single field is correctly initialized" { |
| 445 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 445 | 446 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 446 | 447 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 447 | 448 | |
| ... | ... | @@ -551,7 +552,6 @@ const Baz = enum { A, B, C, D }; |
| 551 | 552 | |
| 552 | 553 | test "tagged union type" { |
| 553 | 554 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 554 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 555 | 555 | |
| 556 | 556 | const foo1 = TaggedFoo{ .One = 13 }; |
| 557 | 557 | const foo2 = TaggedFoo{ |
| ... | ... | @@ -576,7 +576,6 @@ test "tagged union as return value" { |
| 576 | 576 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 577 | 577 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 578 | 578 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 579 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 580 | 579 | |
| 581 | 580 | switch (returnAnInt(13)) { |
| 582 | 581 | TaggedFoo.One => |value| try expect(value == 13), |
| ... | ... | @@ -619,7 +618,6 @@ test "union(enum(u32)) with specified and unspecified tag values" { |
| 619 | 618 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 620 | 619 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 621 | 620 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 622 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 623 | 621 | |
| 624 | 622 | comptime assert(Tag(Tag(MultipleChoice2)) == u32); |
| 625 | 623 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); |
| ... | ... | @@ -709,7 +707,6 @@ test "union with only 1 field casted to its enum type which has enum value speci |
| 709 | 707 | test "@intFromEnum works on unions" { |
| 710 | 708 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 711 | 709 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 712 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 713 | 710 | |
| 714 | 711 | const Bar = union(enum) { |
| 715 | 712 | A: bool, |
| ... | ... | @@ -793,7 +790,6 @@ test "@unionInit stored to a const" { |
| 793 | 790 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 794 | 791 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 795 | 792 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 796 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 797 | 793 | |
| 798 | 794 | const S = struct { |
| 799 | 795 | const U = union(enum) { |
| ... | ... | @@ -823,7 +819,6 @@ test "@unionInit stored to a const" { |
| 823 | 819 | test "@unionInit can modify a union type" { |
| 824 | 820 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 825 | 821 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 826 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 827 | 822 | |
| 828 | 823 | const UnionInitEnum = union(enum) { |
| 829 | 824 | Boolean: bool, |
| ... | ... | @@ -846,7 +841,6 @@ test "@unionInit can modify a union type" { |
| 846 | 841 | test "@unionInit can modify a pointer value" { |
| 847 | 842 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 848 | 843 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 849 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 850 | 844 | |
| 851 | 845 | const UnionInitEnum = union(enum) { |
| 852 | 846 | Boolean: bool, |
| ... | ... | @@ -954,7 +948,6 @@ test "function call result coerces from tagged union to the tag" { |
| 954 | 948 | test "switching on non exhaustive union" { |
| 955 | 949 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 956 | 950 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 957 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 958 | 951 | |
| 959 | 952 | const S = struct { |
| 960 | 953 | const E = enum(u8) { |
| ... | ... | @@ -1256,7 +1249,6 @@ test "@unionInit uses tag value instead of field index" { |
| 1256 | 1249 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1257 | 1250 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1258 | 1251 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1259 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1260 | 1252 | const E = enum(u8) { |
| 1261 | 1253 | b = 255, |
| 1262 | 1254 | a = 3, |
| ... | ... | @@ -1414,6 +1406,8 @@ test "reinterpreting enum value inside packed union" { |
| 1414 | 1406 | } |
| 1415 | 1407 | |
| 1416 | 1408 | test "access the tag of a global tagged union" { |
| 1409 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1410 | ||
| 1417 | 1411 | const U = union(enum) { |
| 1418 | 1412 | a, |
| 1419 | 1413 | b: u8, |
| ... | ... | @@ -2005,7 +1999,6 @@ test "circular dependency through pointer field of a union" { |
| 2005 | 1999 | |
| 2006 | 2000 | test "pass nested union with rls" { |
| 2007 | 2001 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 2008 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2009 | 2002 | |
| 2010 | 2003 | const Union = union(enum) { |
| 2011 | 2004 | a: u32, |
| ... | ... | @@ -2052,7 +2045,6 @@ test "runtime union init, most-aligned field != largest" { |
| 2052 | 2045 | test "copied union field doesn't alias source" { |
| 2053 | 2046 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2054 | 2047 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2055 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2056 | 2048 | |
| 2057 | 2049 | const U = union(enum) { |
| 2058 | 2050 | array: [10]u32, |
test/behavior/vector.zig-1| ... | ... | @@ -378,7 +378,6 @@ test "array of non-abi-sized integer to vector of same type" { |
| 378 | 378 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 379 | 379 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 380 | 380 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 381 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 382 | 381 | |
| 383 | 382 | const S = struct { |
| 384 | 383 | fn doTheTest() !void { |
test/behavior/while.zig+5| ... | ... | @@ -122,6 +122,8 @@ test "while copies its payload" { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | test "continue and break" { |
| 125 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 126 | ||
| 125 | 127 | try runContinueAndBreakTest(); |
| 126 | 128 | try expect(continue_and_break_counter == 8); |
| 127 | 129 | } |
| ... | ... | @@ -140,6 +142,7 @@ fn runContinueAndBreakTest() !void { |
| 140 | 142 | } |
| 141 | 143 | |
| 142 | 144 | test "while with optional as condition" { |
| 145 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 143 | 146 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 144 | 147 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 145 | 148 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -153,6 +156,7 @@ test "while with optional as condition" { |
| 153 | 156 | } |
| 154 | 157 | |
| 155 | 158 | test "while with optional as condition with else" { |
| 159 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 156 | 160 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 157 | 161 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 158 | 162 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -171,6 +175,7 @@ test "while with optional as condition with else" { |
| 171 | 175 | } |
| 172 | 176 | |
| 173 | 177 | test "while with error union condition" { |
| 178 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 174 | 179 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 175 | 180 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 176 | 181 |
test/standalone/build.zig+1| ... | ... | @@ -44,6 +44,7 @@ pub fn build(b: *std.Build) void { |
| 44 | 44 | "../../tools/generate_linux_syscalls.zig", |
| 45 | 45 | "../../tools/process_headers.zig", |
| 46 | 46 | "../../tools/migrate_langref.zig", |
| 47 | "../../tools/unskip_spirv_tests.zig", | |
| 47 | 48 | "../../tools/update-linux-headers.zig", |
| 48 | 49 | "../../tools/update_clang_options.zig", |
| 49 | 50 | "../../tools/update_cpu_features.zig", |
tools/unskip_spirv_tests.zig created+264| ... | ... | @@ -0,0 +1,264 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Io = std.Io; | |
| 3 | const Allocator = std.mem.Allocator; | |
| 4 | const Ast = std.zig.Ast; | |
| 5 | ||
| 6 | const usage = | |
| 7 | \\Usage: unskip_spirv_tests <zig> <test_runner> <test_cmd> [test/behavior/*.zig ...] | |
| 8 | \\ | |
| 9 | \\For example: | |
| 10 | \\zig run tools/unskip_spirv_tests.zig -- zig-out/bin/zig \ | |
| 11 | \\ ../zig-spirv-test-executor/src/test_runner.zig \ | |
| 12 | \\ ../zig-spirv-test-executor/zig-out/bin/zig-spirv-test-executor [files...] | |
| 13 | \\ | |
| 14 | \\Runs every behavior test that is skipped on stage2_spirv in isolation and | |
| 15 | \\removes the skip if the test passes. | |
| 16 | \\ | |
| 17 | ; | |
| 18 | ||
| 19 | const Test = struct { | |
| 20 | body: Ast.Node.Index, | |
| 21 | name: []const u8, | |
| 22 | skip: ?Ast.Node.Index, | |
| 23 | }; | |
| 24 | ||
| 25 | pub fn main(init: std.process.Init) !void { | |
| 26 | const io = init.io; | |
| 27 | const arena = init.arena.allocator(); | |
| 28 | ||
| 29 | var args = try init.minimal.args.iterateAllocator(arena); | |
| 30 | _ = args.skip(); | |
| 31 | const zig = args.next() orelse std.process.fatal(usage, .{}); | |
| 32 | const test_runner = args.next() orelse std.process.fatal(usage, .{}); | |
| 33 | const test_cmd = args.next() orelse std.process.fatal(usage, .{}); | |
| 34 | ||
| 35 | var files: std.ArrayList([]const u8) = .empty; | |
| 36 | while (args.next()) |path| try files.append(arena, path); | |
| 37 | ||
| 38 | if (files.items.len == 0) { | |
| 39 | var dir = try Io.Dir.openDir(.cwd(), io, "test/behavior", .{ .iterate = true }); | |
| 40 | defer dir.close(io); | |
| 41 | ||
| 42 | var it = dir.iterate(); | |
| 43 | while (try it.next(io)) |entry| { | |
| 44 | if (entry.kind != .file or !std.mem.endsWith(u8, entry.name, ".zig")) continue; | |
| 45 | const path = try std.fs.path.join(arena, &.{ "test/behavior", entry.name }); | |
| 46 | const source = try Io.Dir.readFileAlloc(.cwd(), io, path, arena, .unlimited); | |
| 47 | if (std.mem.find(u8, source, "stage2_spirv") != null) { | |
| 48 | try files.append(arena, path); | |
| 49 | } | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | var stdout_buffer: [4096]u8 = undefined; | |
| 54 | var stdout_writer = Io.File.stdout().writer(io, &stdout_buffer); | |
| 55 | const stdout = &stdout_writer.interface; | |
| 56 | ||
| 57 | const progress = std.Progress.start(io, .{ .estimated_total_items = files.items.len }); | |
| 58 | const cache_dir = init.environ_map.get("ZIG_LOCAL_CACHE_DIR") orelse ".zig-cache"; | |
| 59 | const variant_dir = try std.fs.path.join(arena, &.{ cache_dir, "unskip" }); | |
| 60 | try Io.Dir.createDirPath(.cwd(), io, variant_dir); | |
| 61 | ||
| 62 | var failures: std.array_hash_map.String(std.ArrayList([]const u8)) = .empty; | |
| 63 | var total_removed: usize = 0; | |
| 64 | var files_changed: usize = 0; | |
| 65 | for (files.items) |path| { | |
| 66 | const basename = std.fs.path.basename(path); | |
| 67 | const source = try Io.Dir.readFileAlloc(.cwd(), io, path, arena, .unlimited); | |
| 68 | const ast = try Ast.parse(arena, try arena.dupeSentinel(u8, source, 0), .{}); | |
| 69 | if (ast.errors.len != 0) std.process.fatal("{s}: parse error", .{path}); | |
| 70 | ||
| 71 | var tests: std.ArrayList(Test) = .empty; | |
| 72 | var skips: usize = 0; | |
| 73 | for (ast.rootDecls()) |decl| { | |
| 74 | if (ast.nodeTag(decl) != .test_decl) continue; | |
| 75 | const name_token, const body = ast.nodeData(decl).opt_token_and_node; | |
| 76 | const token = name_token.unwrap() orelse continue; | |
| 77 | const name = if (ast.tokenTag(token) == .string_literal) | |
| 78 | try std.zig.string_literal.parseAlloc(arena, ast.tokenSlice(token)) | |
| 79 | else | |
| 80 | ast.tokenSlice(token); | |
| 81 | ||
| 82 | var buffer: [2]Ast.Node.Index = undefined; | |
| 83 | const skip: ?Ast.Node.Index = for (ast.blockStatements(&buffer, body) orelse &.{}) |statement| { | |
| 84 | const if_full = ast.fullIf(statement) orelse continue; | |
| 85 | if (ast.nodeTag(if_full.ast.cond_expr) != .equal_equal) continue; | |
| 86 | _, const rhs = ast.nodeData(if_full.ast.cond_expr).node_and_node; | |
| 87 | if (!std.mem.eql(u8, ast.getNodeSource(rhs), ".stage2_spirv")) continue; | |
| 88 | if (ast.nodeTag(if_full.ast.then_expr) != .@"return") continue; | |
| 89 | const value = ast.nodeData(if_full.ast.then_expr).opt_node.unwrap() orelse continue; | |
| 90 | if (!std.mem.eql(u8, ast.getNodeSource(value), "error.SkipZigTest")) continue; | |
| 91 | break statement; | |
| 92 | } else null; | |
| 93 | skips += @intFromBool(skip != null); | |
| 94 | ||
| 95 | try tests.append(arena, .{ .body = body, .name = name, .skip = skip }); | |
| 96 | } | |
| 97 | ||
| 98 | if (skips == 0) { | |
| 99 | progress.completeOne(); | |
| 100 | continue; | |
| 101 | } | |
| 102 | ||
| 103 | const file_node = progress.start(basename, skips); | |
| 104 | defer file_node.end(); | |
| 105 | const variant_path = try std.fs.path.join(arena, &.{ variant_dir, basename }); | |
| 106 | ||
| 107 | var removed: Ast.Render.Fixups = .{}; | |
| 108 | for (tests.items) |candidate| { | |
| 109 | const skip = candidate.skip orelse continue; | |
| 110 | const test_node = file_node.start(candidate.name, 0); | |
| 111 | defer test_node.end(); | |
| 112 | ||
| 113 | var fixups: Ast.Render.Fixups = .{}; | |
| 114 | try fixups.omit_nodes.put(arena, skip, {}); | |
| 115 | for (tests.items) |other| { | |
| 116 | if (other.body == candidate.body) continue; | |
| 117 | try fixups.replace_nodes_with_string.put(arena, other.body, "{ return error.SkipZigTest; }"); | |
| 118 | } | |
| 119 | ||
| 120 | var variant: Io.Writer.Allocating = .init(arena); | |
| 121 | try ast.render(arena, &variant.writer, fixups); | |
| 122 | try Io.Dir.writeFile(.cwd(), io, .{ .sub_path = variant_path, .data = variant.written() }); | |
| 123 | ||
| 124 | const signature: []const u8 = signature: { | |
| 125 | const result = std.process.run(arena, io, .{ | |
| 126 | .argv = &.{ | |
| 127 | zig, "test", variant_path, | |
| 128 | "--test-runner", test_runner, "-target", | |
| 129 | "spirv64-vulkan", "-mcpu", "vulkan_v1_2+variable_pointers+int64", | |
| 130 | "-fno-llvm", "--zig-lib-dir", "lib", | |
| 131 | "--test-cmd", test_cmd, "--test-cmd-bin", | |
| 132 | }, | |
| 133 | .timeout = .{ .duration = .{ .raw = .fromSeconds(120), .clock = .awake } }, | |
| 134 | .progress_node = test_node, | |
| 135 | }) catch |err| switch (err) { | |
| 136 | error.Timeout => break :signature "timeout", | |
| 137 | else => |e| return e, | |
| 138 | }; | |
| 139 | ||
| 140 | if (result.term.success()) { | |
| 141 | try removed.omit_nodes.put(arena, skip, {}); | |
| 142 | std.debug.print("{s}: removed skip for {s}\n", .{ basename, candidate.name }); | |
| 143 | continue; | |
| 144 | } | |
| 145 | ||
| 146 | const output = try std.mem.concat(arena, u8, &.{ result.stdout, result.stderr }); | |
| 147 | var lines = std.mem.splitScalar(u8, output, '\n'); | |
| 148 | while (lines.next()) |line| { | |
| 149 | const rest = std.mem.cutPrefix(u8, line, "error: line ") orelse continue; | |
| 150 | const colon = std.mem.findScalar(u8, rest, ':') orelse continue; | |
| 151 | if (!allDigits(rest[0..colon])) continue; | |
| 152 | break :signature try normalize(arena, "spirv-val: ", rest[colon + 1 ..]); | |
| 153 | } | |
| 154 | lines.reset(); | |
| 155 | ||
| 156 | while (lines.next()) |line| { | |
| 157 | const rest = std.mem.cutPrefix(u8, line, "thread ") orelse continue; | |
| 158 | const panic = std.mem.find(u8, rest, " panic: ") orelse continue; | |
| 159 | if (std.mem.findScalar(u8, rest[0..panic], ' ') != null) continue; | |
| 160 | break :signature try normalize(arena, "panic: ", rest[panic + " panic: ".len ..]); | |
| 161 | } | |
| 162 | lines.reset(); | |
| 163 | ||
| 164 | while (lines.next()) |line| { | |
| 165 | const marker = std.mem.find(u8, line, ": error: ") orelse continue; | |
| 166 | const location = line[0..marker]; | |
| 167 | const line_colon = std.mem.findScalarLast(u8, location, ':') orelse continue; | |
| 168 | const file_colon = std.mem.findScalarLast(u8, location[0..line_colon], ':') orelse continue; | |
| 169 | if (std.mem.findScalar(u8, location[0..file_colon], ' ') != null) continue; | |
| 170 | if (!allDigits(location[file_colon + 1 .. line_colon])) continue; | |
| 171 | if (!allDigits(location[line_colon + 1 ..])) continue; | |
| 172 | const message = line[marker + ": error: ".len ..]; | |
| 173 | break :signature try normalize(arena, "compile error: ", message); | |
| 174 | } | |
| 175 | lines.reset(); | |
| 176 | ||
| 177 | while (lines.next()) |line| { | |
| 178 | const rest = std.mem.cutPrefix(u8, line, "error: ") orelse continue; | |
| 179 | break :signature try normalize(arena, "error: ", rest); | |
| 180 | } | |
| 181 | ||
| 182 | if (std.mem.trim(u8, output, &std.ascii.whitespace).len > 0) { | |
| 183 | break :signature "unknown failure (no error: line found)"; | |
| 184 | } | |
| 185 | break :signature "no output"; | |
| 186 | }; | |
| 187 | ||
| 188 | const gop = try failures.getOrPut(arena, signature); | |
| 189 | if (!gop.found_existing) gop.value_ptr.* = .empty; | |
| 190 | const failed_test = try std.fmt.allocPrint(arena, "{s} :: {s}", .{ basename, candidate.name }); | |
| 191 | try gop.value_ptr.append(arena, failed_test); | |
| 192 | } | |
| 193 | ||
| 194 | std.debug.print("{s}: {d}/{d} skips removed\n", .{ basename, removed.omit_nodes.count(), skips }); | |
| 195 | Io.Dir.deleteFile(.cwd(), io, variant_path) catch {}; | |
| 196 | if (removed.omit_nodes.count() == 0) continue; | |
| 197 | ||
| 198 | var final: Io.Writer.Allocating = .init(arena); | |
| 199 | try ast.render(arena, &final.writer, removed); | |
| 200 | const rendered = try Ast.parse(arena, try arena.dupeSentinel(u8, final.written(), 0), .{}); | |
| 201 | const formatted = try rendered.renderAlloc(arena); | |
| 202 | try Io.Dir.writeFile(.cwd(), io, .{ .sub_path = path, .data = formatted }); | |
| 203 | total_removed += removed.omit_nodes.count(); | |
| 204 | files_changed += 1; | |
| 205 | } | |
| 206 | ||
| 207 | progress.end(); | |
| 208 | ||
| 209 | try stdout.print("\nDone: removed {d} spirv skips across {d} files\n", .{ total_removed, files_changed }); | |
| 210 | if (failures.count() > 0) { | |
| 211 | var total_failures: usize = 0; | |
| 212 | for (failures.values()) |failed_tests| total_failures += failed_tests.items.len; | |
| 213 | try stdout.print("\nMost common blockers ({d} failing attempts, {d} unique signatures):\n", .{ | |
| 214 | total_failures, | |
| 215 | failures.count(), | |
| 216 | }); | |
| 217 | ||
| 218 | const Ctx = struct { | |
| 219 | failed_tests: []const std.ArrayList([]const u8), | |
| 220 | ||
| 221 | pub fn lessThan(ctx: @This(), a: usize, b: usize) bool { | |
| 222 | return ctx.failed_tests[a].items.len > ctx.failed_tests[b].items.len; | |
| 223 | } | |
| 224 | }; | |
| 225 | failures.sort(Ctx{ .failed_tests = failures.values() }); | |
| 226 | ||
| 227 | for (failures.keys()[0..@min(failures.count(), 30)], failures.values()) |signature, failed_tests| { | |
| 228 | const count = failed_tests.items.len; | |
| 229 | const percent = @as(f64, @floatFromInt(count)) * 100 / @as(f64, @floatFromInt(total_failures)); | |
| 230 | try stdout.print("{d:4} ({d:5.1}%) {s}\n", .{ count, percent, signature }); | |
| 231 | for (failed_tests.items) |failed_test| try stdout.print(" {s}\n", .{failed_test}); | |
| 232 | } | |
| 233 | } | |
| 234 | try stdout.flush(); | |
| 235 | } | |
| 236 | ||
| 237 | fn allDigits(text: []const u8) bool { | |
| 238 | if (text.len == 0) return false; | |
| 239 | for (text) |c| if (!std.ascii.isDigit(c)) return false; | |
| 240 | return true; | |
| 241 | } | |
| 242 | ||
| 243 | fn normalize(arena: Allocator, prefix: []const u8, message: []const u8) ![]u8 { | |
| 244 | const source = try arena.dupeSentinel(u8, std.mem.trim(u8, message, &std.ascii.whitespace), 0); | |
| 245 | var out: std.ArrayList(u8) = .empty; | |
| 246 | try out.appendSlice(arena, prefix); | |
| 247 | var tokenizer: std.zig.Tokenizer = .init(source); | |
| 248 | var end: usize = 0; | |
| 249 | while (true) { | |
| 250 | const token = tokenizer.next(); | |
| 251 | if (token.tag == .eof) break; | |
| 252 | try out.appendSlice(arena, source[end..token.loc.start]); | |
| 253 | end = token.loc.end; | |
| 254 | const text = source[token.loc.start..token.loc.end]; | |
| 255 | try out.appendSlice(arena, switch (token.tag) { | |
| 256 | .number_literal => "<n>", | |
| 257 | .char_literal, .string_literal => "<str>", | |
| 258 | .identifier => if (token.loc.start > 0 and source[token.loc.start - 1] == '%') "<id>" else text, | |
| 259 | else => text, | |
| 260 | }); | |
| 261 | } | |
| 262 | try out.appendSlice(arena, source[end..]); | |
| 263 | return out.items[0..@min(out.items.len, prefix.len + 200)]; | |
| 264 | } |