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:
Andrew Kelley 2023-03-07 00:44:10 -07:00
parent e122cd6312
commit 4efeeaac88
5 changed files with 0 additions and 52 deletions

View File

@ -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 {

View File

@ -1,4 +0,0 @@
#include "a.h"
int32_t add(int32_t a, int32_t b) {
return a + b;
}

View File

@ -1,2 +0,0 @@
#include <stdint.h>
int32_t add(int32_t a, int32_t b);

View File

@ -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);
}

View File

@ -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);
}