authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-13 18:24:17-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:15-07:00
log171977dc1c9d15a405b70bfa980c7d188410979e
tree4f72a7a1047d9196f5151fa8e9e64ed3e7ed994b
parent1dbb616e73404b789b5c85491eb905b193b9b4cb

test-cases: fix incorrectly linking libc when backend is llvm

Now link_libc=1 must be used to link with libc, instead of the test harness assuming that using the llvm backend means additionally linking with libc.

4 files changed, 8 insertions(+), 2 deletions(-)

test/cases/f32_passed_to_variadic_fn.zig+2-1
...@@ -9,7 +9,8 @@ pub fn main() void {...@@ -9,7 +9,8 @@ pub fn main() void {
9// run9// run
10// backend=llvm10// backend=llvm
11// target=x86_64-linux-gnu11// target=x86_64-linux-gnu
12// link_libc=1
12//13//
13// f64: 2.00000014// f64: 2.000000
14// f32: 10.00000015// f32: 10.000000
15//
\ No newline at end of file
16//
test/cases/fn_typeinfo_passed_to_comptime_fn.zig+1
...@@ -14,4 +14,5 @@ fn foo(comptime info: std.builtin.Type) !void {...@@ -14,4 +14,5 @@ fn foo(comptime info: std.builtin.Type) !void {
1414
15// run15// run
16// is_test=116// is_test=1
17// backend=llvm
17//18//
test/cases/llvm/hello_world.zig+1
...@@ -7,6 +7,7 @@ pub fn main() void {...@@ -7,6 +7,7 @@ pub fn main() void {
7// run7// run
8// backend=llvm8// backend=llvm
9// target=x86_64-linux,x86_64-macos9// target=x86_64-linux,x86_64-macos
10// link_libc=1
10//11//
11// hello world!12// hello world!
12//13//
test/src/Cases.zig+4-1
...@@ -382,6 +382,7 @@ fn addFromDirInner(...@@ -382,6 +382,7 @@ fn addFromDirInner(
382 const backends = try manifest.getConfigForKeyAlloc(ctx.arena, "backend", Backend);382 const backends = try manifest.getConfigForKeyAlloc(ctx.arena, "backend", Backend);
383 const targets = try manifest.getConfigForKeyAlloc(ctx.arena, "target", CrossTarget);383 const targets = try manifest.getConfigForKeyAlloc(ctx.arena, "target", CrossTarget);
384 const is_test = try manifest.getConfigForKeyAssertSingle("is_test", bool);384 const is_test = try manifest.getConfigForKeyAssertSingle("is_test", bool);
385 const link_libc = try manifest.getConfigForKeyAssertSingle("link_libc", bool);
385 const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode);386 const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode);
386387
387 var cases = std.ArrayList(usize).init(ctx.arena);388 var cases = std.ArrayList(usize).init(ctx.arena);
...@@ -397,7 +398,7 @@ fn addFromDirInner(...@@ -397,7 +398,7 @@ fn addFromDirInner(
397 .updates = std.ArrayList(Cases.Update).init(ctx.cases.allocator),398 .updates = std.ArrayList(Cases.Update).init(ctx.cases.allocator),
398 .is_test = is_test,399 .is_test = is_test,
399 .output_mode = output_mode,400 .output_mode = output_mode,
400 .link_libc = backend == .llvm,401 .link_libc = link_libc,
401 .deps = std.ArrayList(DepModule).init(ctx.cases.allocator),402 .deps = std.ArrayList(DepModule).init(ctx.cases.allocator),
402 });403 });
403 try cases.append(next);404 try cases.append(next);
...@@ -745,6 +746,8 @@ const TestManifestConfigDefaults = struct {...@@ -745,6 +746,8 @@ const TestManifestConfigDefaults = struct {
745 };746 };
746 } else if (std.mem.eql(u8, key, "is_test")) {747 } else if (std.mem.eql(u8, key, "is_test")) {
747 return "0";748 return "0";
749 } else if (std.mem.eql(u8, key, "link_libc")) {
750 return "0";
748 } else unreachable;751 } else unreachable;
749 }752 }
750};753};