authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-11 14:09:05-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-11 14:09:05-04:00
log5954c94d2079c9b378ae14bb4c9c24aed719beec
treed774648d89561ff234a0a6e499d06b55fbb5b3fa
parent3f30897fdcdb6c5579bc5609dda9746f67551870

build system: add -Dskip-release option to test faster


2 files changed, 14 insertions(+), 24 deletions(-)

build.zig+12-5
......@@ -59,6 +59,7 @@ pub fn build(b: *Builder) !void {
5959
6060 b.default_step.dependOn(&exe.step);
6161
62 const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
6263 const skip_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false;
6364 if (!skip_self_hosted) {
6465 test_step.dependOn(&exe.step);
......@@ -71,19 +72,24 @@ pub fn build(b: *Builder) !void {
7172 installCHeaders(b, ctx.c_header_files);
7273
7374 const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
74 const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") orelse false;
7575
7676 const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");
7777 test_stage2_step.dependOn(&test_stage2.step);
7878 test_step.dependOn(test_stage2_step);
7979
80 test_step.dependOn(docs_step);
80 const all_modes = []builtin.Mode{
81 builtin.Mode.Debug,
82 builtin.Mode.ReleaseSafe,
83 builtin.Mode.ReleaseFast,
84 builtin.Mode.ReleaseSmall,
85 };
86 const modes = if (skip_release) []builtin.Mode{builtin.Mode.Debug} else all_modes;
8187
82 test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", with_lldb));
88 test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", modes));
8389
84 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", with_lldb));
90 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", modes));
8591
86 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", with_lldb));
92 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", modes));
8793
8894 test_step.dependOn(tests.addCompareOutputTests(b, test_filter));
8995 test_step.dependOn(tests.addBuildExampleTests(b, test_filter));
......@@ -92,6 +98,7 @@ pub fn build(b: *Builder) !void {
9298 test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter));
9399 test_step.dependOn(tests.addTranslateCTests(b, test_filter));
94100 test_step.dependOn(tests.addGenHTests(b, test_filter));
101 test_step.dependOn(docs_step);
95102}
96103
97104fn dependOnLib(lib_exe_obj: var, dep: *const LibraryDep) void {
test/tests.zig+2-19
......@@ -138,16 +138,11 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
138138 return cases.step;
139139}
140140
141pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []const u8, name: []const u8, desc: []const u8, with_lldb: bool) *build.Step {
141pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []const u8, name: []const u8, desc: []const u8, modes: []const Mode) *build.Step {
142142 const step = b.step(b.fmt("test-{}", name), desc);
143143 for (test_targets) |test_target| {
144144 const is_native = (test_target.os == builtin.os and test_target.arch == builtin.arch);
145 for ([]Mode{
146 Mode.Debug,
147 Mode.ReleaseSafe,
148 Mode.ReleaseFast,
149 Mode.ReleaseSmall,
150 }) |mode| {
145 for (modes) |mode| {
151146 for ([]bool{
152147 false,
153148 true,
......@@ -166,18 +161,6 @@ pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []cons
166161 if (link_libc) {
167162 these_tests.linkSystemLibrary("c");
168163 }
169 if (with_lldb) {
170 these_tests.setExecCmd([]?[]const u8{
171 "lldb",
172 null,
173 "-o",
174 "run",
175 "-o",
176 "bt",
177 "-o",
178 "exit",
179 });
180 }
181164 step.dependOn(&these_tests.step);
182165 }
183166 }