authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-10-19 08:36:14+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-10-19 08:36:14+02:00
log7d6596e979df799782b77ce3fed722b792509388
tree3f930a1e6f13c9d3dd6fea4ff096b1a8eda7d3c9
parent1952dd6437a73e3de211b649924a55fcb6e030be
parentc0fe135ff3ec09c71103f382cdca60506b557e57
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #13218 from Luukdegram/fix-emulatable-step

std: CheckObject - correctly depend on its own step when creating an EmulatableRunStep

8 files changed, 3 insertions(+), 11 deletions(-)

lib/std/build/CheckObjectStep.zig+3-1
...@@ -45,7 +45,9 @@ pub fn runAndCompare(self: *CheckObjectStep) *EmulatableRunStep {...@@ -45,7 +45,9 @@ pub fn runAndCompare(self: *CheckObjectStep) *EmulatableRunStep {
45 assert(dependencies_len > 0);45 assert(dependencies_len > 0);
46 const exe_step = self.step.dependencies.items[dependencies_len - 1];46 const exe_step = self.step.dependencies.items[dependencies_len - 1];
47 const exe = exe_step.cast(std.build.LibExeObjStep).?;47 const exe = exe_step.cast(std.build.LibExeObjStep).?;
48 return EmulatableRunStep.create(self.builder, "EmulatableRun", exe);48 const emulatable_step = EmulatableRunStep.create(self.builder, "EmulatableRun", exe);
49 emulatable_step.step.dependOn(&self.step);
50 return emulatable_step;
49}51}
5052
51/// There two types of actions currently suported:53/// There two types of actions currently suported:
test/link/macho/dead_strip/build.zig-2
...@@ -16,7 +16,6 @@ pub fn build(b: *Builder) void {...@@ -16,7 +16,6 @@ pub fn build(b: *Builder) void {
16 const check = exe.checkObject(.macho);16 const check = exe.checkObject(.macho);
17 check.checkInSymtab();17 check.checkInSymtab();
18 check.checkNext("{*} (__TEXT,__text) external _iAmUnused");18 check.checkNext("{*} (__TEXT,__text) external _iAmUnused");
19 test_step.dependOn(&check.step);
2019
21 const run_cmd = check.runAndCompare();20 const run_cmd = check.runAndCompare();
22 run_cmd.expectStdOutEqual("Hello!\n");21 run_cmd.expectStdOutEqual("Hello!\n");
...@@ -31,7 +30,6 @@ pub fn build(b: *Builder) void {...@@ -31,7 +30,6 @@ pub fn build(b: *Builder) void {
31 const check = exe.checkObject(.macho);30 const check = exe.checkObject(.macho);
32 check.checkInSymtab();31 check.checkInSymtab();
33 check.checkNotPresent("{*} (__TEXT,__text) external _iAmUnused");32 check.checkNotPresent("{*} (__TEXT,__text) external _iAmUnused");
34 test_step.dependOn(&check.step);
3533
36 const run_cmd = check.runAndCompare();34 const run_cmd = check.runAndCompare();
37 run_cmd.expectStdOutEqual("Hello!\n");35 run_cmd.expectStdOutEqual("Hello!\n");
test/link/macho/dylib/build.zig-2
...@@ -40,8 +40,6 @@ pub fn build(b: *Builder) void {...@@ -40,8 +40,6 @@ pub fn build(b: *Builder) void {
40 check_exe.checkNext("current version 10000");40 check_exe.checkNext("current version 10000");
41 check_exe.checkNext("compatibility version 10000");41 check_exe.checkNext("compatibility version 10000");
4242
43 test_step.dependOn(&check_exe.step);
44
45 check_exe.checkStart("cmd RPATH");43 check_exe.checkStart("cmd RPATH");
46 check_exe.checkNext(std.fmt.allocPrint(b.allocator, "path {s}", .{b.pathFromRoot("zig-out/lib")}) catch unreachable);44 check_exe.checkNext(std.fmt.allocPrint(b.allocator, "path {s}", .{b.pathFromRoot("zig-out/lib")}) catch unreachable);
4745
test/link/macho/entry/build.zig-1
...@@ -26,7 +26,6 @@ pub fn build(b: *Builder) void {...@@ -26,7 +26,6 @@ pub fn build(b: *Builder) void {
26 check_exe.checkNext("{n_value} (__TEXT,__text) external _non_main");26 check_exe.checkNext("{n_value} (__TEXT,__text) external _non_main");
2727
28 check_exe.checkComputeCompare("vmaddr entryoff +", .{ .op = .eq, .value = .{ .variable = "n_value" } });28 check_exe.checkComputeCompare("vmaddr entryoff +", .{ .op = .eq, .value = .{ .variable = "n_value" } });
29 test_step.dependOn(&check_exe.step);
3029
31 const run = check_exe.runAndCompare();30 const run = check_exe.runAndCompare();
32 run.expectStdOutEqual("42");31 run.expectStdOutEqual("42");
test/link/macho/needed_library/build.zig-1
...@@ -31,7 +31,6 @@ pub fn build(b: *Builder) void {...@@ -31,7 +31,6 @@ pub fn build(b: *Builder) void {
31 const check = exe.checkObject(.macho);31 const check = exe.checkObject(.macho);
32 check.checkStart("cmd LOAD_DYLIB");32 check.checkStart("cmd LOAD_DYLIB");
33 check.checkNext("name @rpath/liba.dylib");33 check.checkNext("name @rpath/liba.dylib");
34 test_step.dependOn(&check.step);
3534
36 const run_cmd = check.runAndCompare();35 const run_cmd = check.runAndCompare();
37 test_step.dependOn(&run_cmd.step);36 test_step.dependOn(&run_cmd.step);
test/link/macho/search_strategy/build.zig-1
...@@ -17,7 +17,6 @@ pub fn build(b: *Builder) void {...@@ -17,7 +17,6 @@ pub fn build(b: *Builder) void {
17 const check = exe.checkObject(.macho);17 const check = exe.checkObject(.macho);
18 check.checkStart("cmd LOAD_DYLIB");18 check.checkStart("cmd LOAD_DYLIB");
19 check.checkNext("name @rpath/liba.dylib");19 check.checkNext("name @rpath/liba.dylib");
20 test_step.dependOn(&check.step);
2120
22 const run = check.runAndCompare();21 const run = check.runAndCompare();
23 run.cwd = b.pathFromRoot(".");22 run.cwd = b.pathFromRoot(".");
test/link/macho/stack_size/build.zig-1
...@@ -18,7 +18,6 @@ pub fn build(b: *Builder) void {...@@ -18,7 +18,6 @@ pub fn build(b: *Builder) void {
18 const check_exe = exe.checkObject(.macho);18 const check_exe = exe.checkObject(.macho);
19 check_exe.checkStart("cmd MAIN");19 check_exe.checkStart("cmd MAIN");
20 check_exe.checkNext("stacksize 100000000");20 check_exe.checkNext("stacksize 100000000");
21 test_step.dependOn(&check_exe.step);
2221
23 const run = check_exe.runAndCompare();22 const run = check_exe.runAndCompare();
24 test_step.dependOn(&run.step);23 test_step.dependOn(&run.step);
test/link/macho/weak_library/build.zig-2
...@@ -33,8 +33,6 @@ pub fn build(b: *Builder) void {...@@ -33,8 +33,6 @@ pub fn build(b: *Builder) void {
33 check.checkNext("(undefined) weak external _a (from liba)");33 check.checkNext("(undefined) weak external _a (from liba)");
34 check.checkNext("(undefined) weak external _asStr (from liba)");34 check.checkNext("(undefined) weak external _asStr (from liba)");
3535
36 test_step.dependOn(&check.step);
37
38 const run_cmd = check.runAndCompare();36 const run_cmd = check.runAndCompare();
39 run_cmd.expectStdOutEqual("42 42");37 run_cmd.expectStdOutEqual("42 42");
40 test_step.dependOn(&run_cmd.step);38 test_step.dependOn(&run_cmd.step);