mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
link-tests: CheckFileStep to do grep test on the binary
This commit is contained in:
parent
38edef35bf
commit
6e56a8df20
@ -7,10 +7,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void {
|
||||
.build_modes = false, // we only guarantee zerofill for undefined in Debug
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/dylib/build.zig", .{
|
||||
.build_modes = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/common_symbols/build.zig", .{
|
||||
.build_modes = true,
|
||||
});
|
||||
@ -32,6 +28,10 @@ pub fn addCases(cases: *tests.StandaloneContext) void {
|
||||
});
|
||||
|
||||
if (builtin.os.tag == .macos) {
|
||||
cases.addBuildFile("test/link/dylib/build.zig", .{
|
||||
.build_modes = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/frameworks/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_macos_sdk = true,
|
||||
|
@ -24,6 +24,13 @@ pub fn build(b: *Builder) void {
|
||||
run.cwd = b.pathFromRoot(".");
|
||||
run.expectStdOutEqual("Hello world");
|
||||
|
||||
const exp_dylib = std.macho.createLoadDylibCommand(b.allocator, "@rpath/liba.dylib", 2, 0x10000, 0x10000) catch unreachable;
|
||||
var buf = std.ArrayList(u8).init(b.allocator);
|
||||
defer buf.deinit();
|
||||
exp_dylib.write(buf.writer()) catch unreachable;
|
||||
const check_file = std.build.CheckFileStep.create(b, exe.getOutputSource(), &[_][]const u8{buf.items});
|
||||
|
||||
test_step.dependOn(b.getInstallStep());
|
||||
test_step.dependOn(&run.step);
|
||||
test_step.dependOn(&check_file.step);
|
||||
}
|
||||
|
@ -995,7 +995,8 @@ pub const StandaloneContext = struct {
|
||||
}
|
||||
|
||||
if (features.cross_targets and !self.target.isNative()) {
|
||||
const target_arg = fmt.allocPrint(b.allocator, "-Dtarget={s}", .{self.target.zigTriple(b.allocator) catch unreachable}) catch unreachable;
|
||||
const target_triple = self.target.zigTriple(b.allocator) catch unreachable;
|
||||
const target_arg = fmt.allocPrint(b.allocator, "-Dtarget={s}", .{target_triple}) catch unreachable;
|
||||
zig_args.append(target_arg) catch unreachable;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user