aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authordweiller <4678790+dweiller@users.noreplay.github.com>2022-10-25 16:52:29 +1100
committerdweiller <4678790+dweiller@users.noreplay.github.com>2022-11-02 12:54:35 +1100
commit55c91fc42d048a18c724bdaffe3709bef8aa143e (patch)
tree36adf282f6f3509e97a6d348ceb96a712a240608 /src/Compilation.zig
parentebf9ffd342a30c7c79657f5dbfc83fde0647e630 (diff)
downloadzig-55c91fc42d048a18c724bdaffe3709bef8aa143e.tar.gz
zig-55c91fc42d048a18c724bdaffe3709bef8aa143e.zip
stage2: add test_runner_path for user provided test runner
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 958aac5e1b..e8e15b75ad 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -994,6 +994,7 @@ pub const InitOptions = struct {
reference_trace: ?u32 = null,
test_filter: ?[]const u8 = null,
test_name_prefix: ?[]const u8 = null,
+ test_runner_path: ?[]const u8 = null,
subsystem: ?std.Target.SubSystem = null,
/// WASI-only. Type of WASI execution model ("command" or "reactor").
wasi_exec_model: ?std.builtin.WasiExecModel = null,
@@ -1578,12 +1579,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
errdefer std_pkg.destroy(gpa);
const root_pkg = if (options.is_test) root_pkg: {
- const test_pkg = try Package.createWithDir(
- gpa,
- options.zig_lib_directory,
- null,
- "test_runner.zig",
- );
+ const test_pkg = if (options.test_runner_path) |test_runner|
+ try Package.create(gpa, null, test_runner)
+ else
+ try Package.createWithDir(
+ gpa,
+ options.zig_lib_directory,
+ null,
+ "test_runner.zig",
+ );
errdefer test_pkg.destroy(gpa);
break :root_pkg test_pkg;