mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
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.
This commit is contained in:
parent
e122cd6312
commit
4efeeaac88
@ -20,10 +20,6 @@ pub const cases = [_]Case{
|
||||
.build_root = "test/link/interdependent_static_c_libs",
|
||||
.import = @import("link/interdependent_static_c_libs/build.zig"),
|
||||
},
|
||||
//.{
|
||||
// .build_root = "test/link/static_lib_as_system_lib",
|
||||
// .import = @import("link/static_lib_as_system_lib/build.zig"),
|
||||
//},
|
||||
};
|
||||
|
||||
//pub fn addCases(cases: *Standalone) void {
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
#include "a.h"
|
||||
int32_t add(int32_t a, int32_t b) {
|
||||
return a + b;
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
#include <stdint.h>
|
||||
int32_t add(int32_t a, int32_t b);
|
||||
@ -1,34 +0,0 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const test_step = b.step("test", "Test it");
|
||||
b.default_step = test_step;
|
||||
|
||||
add(b, test_step, .Debug);
|
||||
add(b, test_step, .ReleaseFast);
|
||||
add(b, test_step, .ReleaseSmall);
|
||||
add(b, test_step, .ReleaseSafe);
|
||||
}
|
||||
|
||||
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
|
||||
const lib_a = b.addStaticLibrary(.{
|
||||
.name = "a",
|
||||
.optimize = optimize,
|
||||
.target = .{},
|
||||
});
|
||||
lib_a.addCSourceFile("a.c", &[_][]const u8{});
|
||||
lib_a.addIncludePath(".");
|
||||
lib_a.install();
|
||||
|
||||
const test_exe = b.addTest(.{
|
||||
.root_source_file = .{ .path = "main.zig" },
|
||||
.optimize = optimize,
|
||||
.target = .{},
|
||||
});
|
||||
test_exe.linkSystemLibrary("a"); // force linking liba.a as -la
|
||||
test_exe.addSystemIncludePath(".");
|
||||
const search_path = std.fs.path.join(b.allocator, &[_][]const u8{ b.install_path, "lib" }) catch @panic("OOM");
|
||||
test_exe.addLibraryPath(search_path);
|
||||
|
||||
test_step.dependOn(&test_exe.step);
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
const c = @cImport(@cInclude("a.h"));
|
||||
|
||||
test "import C add" {
|
||||
const result = c.add(2, 1);
|
||||
try expect(result == 3);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user