Skip to content

Commit 662dd72

Browse files
committed
Remove CheckObjectStep.runAndCompare
Closes #14969
1 parent c16d4ab commit 662dd72

File tree

11 files changed

+21
-37
lines changed

11 files changed

+21
-37
lines changed

lib/std/Build/Step/CheckObject.zig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,6 @@ pub fn create(
4242
return self;
4343
}
4444

45-
/// Runs and (optionally) compares the output of a binary.
46-
/// Asserts `self` was generated from an executable step.
47-
/// TODO this doesn't actually compare, and there's no apparent reason for it
48-
/// to depend on the check object step. I don't see why this function should exist,
49-
/// the caller could just add the run step directly.
50-
pub fn runAndCompare(self: *CheckObject) *std.Build.Step.Run {
51-
const dependencies_len = self.step.dependencies.items.len;
52-
assert(dependencies_len > 0);
53-
const exe_step = self.step.dependencies.items[dependencies_len - 1];
54-
const exe = exe_step.cast(std.Build.Step.Compile).?;
55-
const run = self.step.owner.addRunArtifact(exe);
56-
run.skip_foreign_checks = true;
57-
run.step.dependOn(&self.step);
58-
return run;
59-
}
60-
6145
const SearchPhrase = struct {
6246
string: []const u8,
6347
file_source: ?std.Build.FileSource = null,

test/link/macho/dead_strip/build.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ pub fn build(b: *std.Build) void {
1717
check.checkInSymtab();
1818
check.checkNext("{*} (__TEXT,__text) external _iAmUnused");
1919

20-
const run_cmd = check.runAndCompare();
21-
run_cmd.expectStdOutEqual("Hello!\n");
22-
test_step.dependOn(&run_cmd.step);
20+
const run = b.addRunArtifact(exe);
21+
run.expectStdOutEqual("Hello!\n");
22+
test_step.dependOn(&run.step);
2323
}
2424

2525
{
@@ -31,9 +31,9 @@ pub fn build(b: *std.Build) void {
3131
check.checkInSymtab();
3232
check.checkNotPresent("{*} (__TEXT,__text) external _iAmUnused");
3333

34-
const run_cmd = check.runAndCompare();
35-
run_cmd.expectStdOutEqual("Hello!\n");
36-
test_step.dependOn(&run_cmd.step);
34+
const run = b.addRunArtifact(exe);
35+
run.expectStdOutEqual("Hello!\n");
36+
test_step.dependOn(&run.step);
3737
}
3838
}
3939

test/link/macho/dylib/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
5454
check_exe.checkStart("cmd RPATH");
5555
check_exe.checkNextFileSource("path", dylib.getOutputDirectorySource());
5656

57-
const run = check_exe.runAndCompare();
57+
const run = b.addRunArtifact(exe);
5858
run.expectStdOutEqual("Hello world");
5959
test_step.dependOn(&run.step);
6060
}

test/link/macho/entry/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3535

3636
check_exe.checkComputeCompare("vmaddr entryoff +", .{ .op = .eq, .value = .{ .variable = "n_value" } });
3737

38-
const run = check_exe.runAndCompare();
38+
const run = b.addRunArtifact(exe);
3939
run.expectStdOutEqual("42");
4040
test_step.dependOn(&run.step);
4141
}

test/link/macho/entry_in_dylib/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
4848
.value = .{ .variable = "stubs_vmaddr" }, // The entrypoint should be a synthetic stub
4949
});
5050

51-
const run = check_exe.runAndCompare();
51+
const run = b.addRunArtifact(exe);
5252
run.expectStdOutEqual("Hello!\n");
5353
test_step.dependOn(&run.step);
5454
}

test/link/macho/needed_library/build.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
4242
check.checkStart("cmd LOAD_DYLIB");
4343
check.checkNext("name @rpath/liba.dylib");
4444

45-
const run_cmd = check.runAndCompare();
46-
run_cmd.expectStdOutEqual("");
47-
test_step.dependOn(&run_cmd.step);
45+
const run = b.addRunArtifact(exe);
46+
run.expectStdOutEqual("");
47+
test_step.dependOn(&run.step);
4848
}

test/link/macho/search_strategy/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2424
check.checkStart("cmd LOAD_DYLIB");
2525
check.checkNext("name @rpath/libsearch_dylibs_first.dylib");
2626

27-
const run = check.runAndCompare();
27+
const run = b.addRunArtifact(exe);
2828
run.expectStdOutEqual("Hello world");
2929
test_step.dependOn(&run.step);
3030
}

test/link/macho/stack_size/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2828
check_exe.checkStart("cmd MAIN");
2929
check_exe.checkNext("stacksize 100000000");
3030

31-
const run = check_exe.runAndCompare();
31+
const run = b.addRunArtifact(exe);
3232
run.expectStdOutEqual("");
3333
test_step.dependOn(&run.step);
3434
}

test/link/macho/strict_validation/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
122122
else => unreachable,
123123
}
124124

125-
const run = check_exe.runAndCompare();
125+
const run = b.addRunArtifact(exe);
126126
run.expectStdOutEqual("Hello!\n");
127127
test_step.dependOn(&run.step);
128128
}

test/link/macho/unwind_info/build.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ fn testUnwindInfo(
4747
check.checkInSymtab();
4848
check.checkNext("{*} (__TEXT,__text) external ___gxx_personality_v0");
4949

50-
const run_cmd = check.runAndCompare();
51-
run_cmd.expectStdOutEqual(
50+
const run = b.addRunArtifact(exe);
51+
run.expectStdOutEqual(
5252
\\Constructed: a
5353
\\Constructed: b
5454
\\About to destroy: b
@@ -57,7 +57,7 @@ fn testUnwindInfo(
5757
\\
5858
);
5959

60-
test_step.dependOn(&run_cmd.step);
60+
test_step.dependOn(&run.step);
6161
}
6262

6363
fn createScenario(

0 commit comments

Comments
 (0)