mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
test-cases: fix race with zig run on C backend tests
Also avoid redundantly doing compile-error checks on multiple targets for test cases where that is not helpful.
This commit is contained in:
parent
22690efcc2
commit
8caa206417
@ -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),
|
||||
|
||||
@ -41,6 +41,7 @@ pub export fn entry() void {
|
||||
}
|
||||
|
||||
// error
|
||||
// target=native
|
||||
// backend=llvm
|
||||
//
|
||||
// :11:22: error: comparison of 'void' with null
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -3,5 +3,7 @@ pub export fn entry() void {
|
||||
}
|
||||
|
||||
// error
|
||||
// target=native
|
||||
// backend=stage2
|
||||
//
|
||||
// :2:14: error: reached unreachable code
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user