Commit 8caa206417
Changed files (6)
src/test.zig
@@ -1808,6 +1808,11 @@ pub const TestContext = struct {
// We wouldn't be able to run the compiled C code.
return; // Pass test.
}
+ // Use an absolute path here so that the unique directory name
+ // for this Case makes it into the cache hash, avoiding cache
+ // collisions from multiple threads doing `zig run` at the same
+ // time on the same test_case.c input filename.
+ const abs_exe_path = try tmp.dir.realpathAlloc(arena, bin_name);
try argv.appendSlice(&[_][]const u8{
std.testing.zig_exe_path,
"run",
@@ -1818,7 +1823,7 @@ pub const TestContext = struct {
"-Wno-incompatible-library-redeclaration", // https://github.com/ziglang/zig/issues/875
"--",
"-lc",
- exe_path,
+ abs_exe_path,
});
} else switch (host.getExternalExecutor(target_info, .{ .link_libc = case.link_libc })) {
.native => try argv.append(exe_path),
test/cases/compile_errors/stage2/comptime_unreachable.zig
@@ -3,5 +3,7 @@ pub export fn entry() void {
}
// error
+// target=native
+// backend=stage2
//
// :2:14: error: reached unreachable code
test/cases/compile_errors/dereference_anyopaque.zig
@@ -41,6 +41,7 @@ pub export fn entry() void {
}
// error
+// target=native
// backend=llvm
//
// :11:22: error: comparison of 'void' with null
test/cases/compile_errors/invalid_array_elem_ty.zig
@@ -6,6 +6,7 @@ pub export fn entry() void {
}
// error
-// backend=stage2,llvm
+// target=native
+// backend=stage2
//
// :4:1: error: expected type, found fn() type
test/cases/compile_errors/invalid_store_to_comptime_field.zig
@@ -14,7 +14,8 @@ pub export fn entry1() void {
s.a = T{ .a = 2, .b = 2 };
}
// error
-// backend=stage2,llvm
+// target=native
+// backend=stage2
//
// :6:19: error: value stored in comptime field does not match the default value of the field
// :14:19: error: value stored in comptime field does not match the default value of the field
test/cases/compile_errors/runtime_indexing_comptime_array.zig
@@ -21,7 +21,8 @@ pub export fn entry3() void {
_ = &test_fns[i];
}
// error
-// backend=stage2,llvm
+// target=native
+// backend=stage2
//
// :6:5: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known
// :6:5: note: use '*const fn() void' for a function pointer type