authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-07 00:44:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:14-07:00
log4efeeaac881c5583321e8b385e90f004e99bc3d1
tree8b2abe47efb8fa7d68d44764f366543030b1118a
parente122cd6312606068eb14987ed4d7527341484d26

delete link test "static_lib_as_system_lib"

I disagree with this behavior and will be reverting the changes corresponding to this test case. Also this test case unnecessarily uses a .c file when a .zig file would be preferred, and has a problematic dependency on the install step, preventing this test case from playing nicely with the cache.

5 files changed, 0 insertions(+), 52 deletions(-)

test/link.zig-4
...@@ -20,10 +20,6 @@ pub const cases = [_]Case{...@@ -20,10 +20,6 @@ pub const cases = [_]Case{
20 .build_root = "test/link/interdependent_static_c_libs",20 .build_root = "test/link/interdependent_static_c_libs",
21 .import = @import("link/interdependent_static_c_libs/build.zig"),21 .import = @import("link/interdependent_static_c_libs/build.zig"),
22 },22 },
23 //.{
24 // .build_root = "test/link/static_lib_as_system_lib",
25 // .import = @import("link/static_lib_as_system_lib/build.zig"),
26 //},
27};23};
2824
29//pub fn addCases(cases: *Standalone) void {25//pub fn addCases(cases: *Standalone) void {
test/link/static_lib_as_system_lib/a.c deleted-4
...@@ -1,4 +0,0 @@
1#include "a.h"
2int32_t add(int32_t a, int32_t b) {
3 return a + b;
4}
test/link/static_lib_as_system_lib/a.h deleted-2
...@@ -1,2 +0,0 @@
1#include <stdint.h>
2int32_t add(int32_t a, int32_t b);
test/link/static_lib_as_system_lib/build.zig deleted-34
...@@ -1,34 +0,0 @@
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;
6
7 add(b, test_step, .Debug);
8 add(b, test_step, .ReleaseFast);
9 add(b, test_step, .ReleaseSmall);
10 add(b, test_step, .ReleaseSafe);
11}
12
13fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
14 const lib_a = b.addStaticLibrary(.{
15 .name = "a",
16 .optimize = optimize,
17 .target = .{},
18 });
19 lib_a.addCSourceFile("a.c", &[_][]const u8{});
20 lib_a.addIncludePath(".");
21 lib_a.install();
22
23 const test_exe = b.addTest(.{
24 .root_source_file = .{ .path = "main.zig" },
25 .optimize = optimize,
26 .target = .{},
27 });
28 test_exe.linkSystemLibrary("a"); // force linking liba.a as -la
29 test_exe.addSystemIncludePath(".");
30 const search_path = std.fs.path.join(b.allocator, &[_][]const u8{ b.install_path, "lib" }) catch @panic("OOM");
31 test_exe.addLibraryPath(search_path);
32
33 test_step.dependOn(&test_exe.step);
34}
test/link/static_lib_as_system_lib/main.zig deleted-8
...@@ -1,8 +0,0 @@
1const std = @import("std");
2const expect = std.testing.expect;
3const c = @cImport(@cInclude("a.h"));
4
5test "import C add" {
6 const result = c.add(2, 1);
7 try expect(result == 3);
8}