aboutsummaryrefslogtreecommitdiff
path: root/lib/std/build/CheckObjectStep.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2022-07-25 06:33:01 +0200
committerGitHub <noreply@github.com>2022-07-25 06:33:01 +0200
commit7c13bdb1c9c7f61def9b58b1f24072a4eddc54c1 (patch)
treecf48ca1d4072ed9b6454d935fac42e4fd05abcbf /lib/std/build/CheckObjectStep.zig
parent546c75ca46eff73e5f038e2b894ff96c65cd8960 (diff)
parent72c0cebe5c5e6954ae9992d36f8164ae9433df9e (diff)
downloadzig-7c13bdb1c9c7f61def9b58b1f24072a4eddc54c1.tar.gz
zig-7c13bdb1c9c7f61def9b58b1f24072a4eddc54c1.zip
Merge pull request #12059 from Luukdegram/linker-tests-run-step
Implement EmulatableRunStep for linker tests
Diffstat (limited to 'lib/std/build/CheckObjectStep.zig')
-rw-r--r--lib/std/build/CheckObjectStep.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/std/build/CheckObjectStep.zig b/lib/std/build/CheckObjectStep.zig
index b807e1de45..0525bbf034 100644
--- a/lib/std/build/CheckObjectStep.zig
+++ b/lib/std/build/CheckObjectStep.zig
@@ -12,6 +12,7 @@ const CheckObjectStep = @This();
const Allocator = mem.Allocator;
const Builder = build.Builder;
const Step = build.Step;
+const EmulatableRunStep = build.EmulatableRunStep;
pub const base_id = .check_obj;
@@ -37,6 +38,16 @@ pub fn create(builder: *Builder, source: build.FileSource, obj_format: std.Targe
return self;
}
+/// Runs and (optionally) compares the output of a binary.
+/// Asserts `self` was generated from an executable step.
+pub fn runAndCompare(self: *CheckObjectStep) *EmulatableRunStep {
+ const dependencies_len = self.step.dependencies.items.len;
+ assert(dependencies_len > 0);
+ const exe_step = self.step.dependencies.items[dependencies_len - 1];
+ const exe = exe_step.cast(std.build.LibExeObjStep).?;
+ return EmulatableRunStep.create(self.builder, "EmulatableRun", exe);
+}
+
/// There two types of actions currently suported:
/// * `.match` - is the main building block of standard matchers with optional eat-all token `{*}`
/// and extractors by name such as `{n_value}`. Please note this action is very simplistic in nature