Commit 5954c94d20
test/tests.zig
@@ -138,16 +138,11 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
return cases.step;
}
-pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []const u8, name: []const u8, desc: []const u8, with_lldb: bool) *build.Step {
+pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []const u8, name: []const u8, desc: []const u8, modes: []const Mode) *build.Step {
const step = b.step(b.fmt("test-{}", name), desc);
for (test_targets) |test_target| {
const is_native = (test_target.os == builtin.os and test_target.arch == builtin.arch);
- for ([]Mode{
- Mode.Debug,
- Mode.ReleaseSafe,
- Mode.ReleaseFast,
- Mode.ReleaseSmall,
- }) |mode| {
+ for (modes) |mode| {
for ([]bool{
false,
true,
@@ -166,18 +161,6 @@ pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []cons
if (link_libc) {
these_tests.linkSystemLibrary("c");
}
- if (with_lldb) {
- these_tests.setExecCmd([]?[]const u8{
- "lldb",
- null,
- "-o",
- "run",
- "-o",
- "bt",
- "-o",
- "exit",
- });
- }
step.dependOn(&these_tests.step);
}
}
build.zig
@@ -59,6 +59,7 @@ pub fn build(b: *Builder) !void {
b.default_step.dependOn(&exe.step);
+ const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
const skip_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false;
if (!skip_self_hosted) {
test_step.dependOn(&exe.step);
@@ -71,19 +72,24 @@ pub fn build(b: *Builder) !void {
installCHeaders(b, ctx.c_header_files);
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
- const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") orelse false;
const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");
test_stage2_step.dependOn(&test_stage2.step);
test_step.dependOn(test_stage2_step);
- test_step.dependOn(docs_step);
+ const all_modes = []builtin.Mode{
+ builtin.Mode.Debug,
+ builtin.Mode.ReleaseSafe,
+ builtin.Mode.ReleaseFast,
+ builtin.Mode.ReleaseSmall,
+ };
+ const modes = if (skip_release) []builtin.Mode{builtin.Mode.Debug} else all_modes;
- test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", with_lldb));
+ test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", modes));
- test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", with_lldb));
+ test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", modes));
- test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", with_lldb));
+ test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", modes));
test_step.dependOn(tests.addCompareOutputTests(b, test_filter));
test_step.dependOn(tests.addBuildExampleTests(b, test_filter));
@@ -92,6 +98,7 @@ pub fn build(b: *Builder) !void {
test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter));
test_step.dependOn(tests.addTranslateCTests(b, test_filter));
test_step.dependOn(tests.addGenHTests(b, test_filter));
+ test_step.dependOn(docs_step);
}
fn dependOnLib(lib_exe_obj: var, dep: *const LibraryDep) void {