authorgravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-12-06 15:57:19-06:00
committergravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-12-06 15:57:19-06:00
log592499404527b49e9d09a8fa358a8d702e61f614
tree8adc92ad08bded7ab08fd224a4c6d9ff405511fa
parent3771e7766767f1011bbee7b77fcc52360018fbf1

Fix run() for test_exe steps


1 files changed, 6 insertions(+), 2 deletions(-)

lib/std/build.zig+6-2
...@@ -1775,7 +1775,7 @@ pub const LibExeObjStep = struct {...@@ -1775,7 +1775,7 @@ pub const LibExeObjStep = struct {
1775 /// Creates a `RunStep` with an executable built with `addExecutable`.1775 /// Creates a `RunStep` with an executable built with `addExecutable`.
1776 /// Add command line arguments with `addArg`.1776 /// Add command line arguments with `addArg`.
1777 pub fn run(exe: *LibExeObjStep) *RunStep {1777 pub fn run(exe: *LibExeObjStep) *RunStep {
1778 assert(exe.kind == .exe);1778 assert(exe.kind == .exe or exe.kind == .test_exe);
17791779
1780 // It doesn't have to be native. We catch that if you actually try to run it.1780 // It doesn't have to be native. We catch that if you actually try to run it.
1781 // Consider that this is declarative; the run step may not be run unless a user1781 // Consider that this is declarative; the run step may not be run unless a user
...@@ -1783,6 +1783,10 @@ pub const LibExeObjStep = struct {...@@ -1783,6 +1783,10 @@ pub const LibExeObjStep = struct {
1783 const run_step = RunStep.create(exe.builder, exe.builder.fmt("run {s}", .{exe.step.name}));1783 const run_step = RunStep.create(exe.builder, exe.builder.fmt("run {s}", .{exe.step.name}));
1784 run_step.addArtifactArg(exe);1784 run_step.addArtifactArg(exe);
17851785
1786 if (exe.kind == .test_exe) {
1787 run_step.addArg(exe.builder.zig_exe);
1788 }
1789
1786 if (exe.vcpkg_bin_path) |path| {1790 if (exe.vcpkg_bin_path) |path| {
1787 run_step.addPathDir(path);1791 run_step.addPathDir(path);
1788 }1792 }
...@@ -2065,7 +2069,7 @@ pub const LibExeObjStep = struct {...@@ -2065,7 +2069,7 @@ pub const LibExeObjStep = struct {
2065 /// Returns the generated header file.2069 /// Returns the generated header file.
2066 /// This function can only be called for libraries or object files which have `emit_h` set.2070 /// This function can only be called for libraries or object files which have `emit_h` set.
2067 pub fn getOutputHSource(self: *LibExeObjStep) FileSource {2071 pub fn getOutputHSource(self: *LibExeObjStep) FileSource {
2068 assert(self.kind != .exe);2072 assert(self.kind != .exe and self.kind != .test_exe and self.kind != .@"test");
2069 assert(self.emit_h);2073 assert(self.emit_h);
2070 return FileSource{ .generated = &self.output_h_path_source };2074 return FileSource{ .generated = &self.output_h_path_source };
2071 }2075 }