authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-18 10:28:14+02:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-18 10:28:14+02:00
logb7be082bd9aaba4cbf7c7c7449e481f9caa1dc24
treed49fad9537afcf6da8da00fce4d496df04f193ae
parent843529d23415efcf3fe894c48b3d08c0925edc08

-Dskip-release now also skips build example tests


2 files changed, 5 insertions(+), 8 deletions(-)

build.zig+1-1
...@@ -92,7 +92,7 @@ pub fn build(b: *Builder) !void {...@@ -92,7 +92,7 @@ pub fn build(b: *Builder) !void {
92 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", modes));92 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", modes));
9393
94 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));94 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
95 test_step.dependOn(tests.addBuildExampleTests(b, test_filter));95 test_step.dependOn(tests.addBuildExampleTests(b, test_filter, modes));
96 test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));96 test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));
97 test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));97 test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
98 test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));98 test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));
test/tests.zig+4-7
...@@ -89,12 +89,13 @@ pub fn addCompileErrorTests(b: *build.Builder, test_filter: ?[]const u8, modes:...@@ -89,12 +89,13 @@ pub fn addCompileErrorTests(b: *build.Builder, test_filter: ?[]const u8, modes:
89 return cases.step;89 return cases.step;
90}90}
9191
92pub fn addBuildExampleTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {92pub fn addBuildExampleTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step {
93 const cases = b.allocator.create(BuildExamplesContext{93 const cases = b.allocator.create(BuildExamplesContext{
94 .b = b,94 .b = b,
95 .step = b.step("test-build-examples", "Build the examples"),95 .step = b.step("test-build-examples", "Build the examples"),
96 .test_index = 0,96 .test_index = 0,
97 .test_filter = test_filter,97 .test_filter = test_filter,
98 .modes = modes,
98 }) catch unreachable;99 }) catch unreachable;
99100
100 build_examples.addCases(cases);101 build_examples.addCases(cases);
...@@ -697,6 +698,7 @@ pub const BuildExamplesContext = struct {...@@ -697,6 +698,7 @@ pub const BuildExamplesContext = struct {
697 step: *build.Step,698 step: *build.Step,
698 test_index: usize,699 test_index: usize,
699 test_filter: ?[]const u8,700 test_filter: ?[]const u8,
701 modes: []const Mode,
700702
701 pub fn addC(self: *BuildExamplesContext, root_src: []const u8) void {703 pub fn addC(self: *BuildExamplesContext, root_src: []const u8) void {
702 self.addAllArgs(root_src, true);704 self.addAllArgs(root_src, true);
...@@ -739,12 +741,7 @@ pub const BuildExamplesContext = struct {...@@ -739,12 +741,7 @@ pub const BuildExamplesContext = struct {
739 pub fn addAllArgs(self: *BuildExamplesContext, root_src: []const u8, link_libc: bool) void {741 pub fn addAllArgs(self: *BuildExamplesContext, root_src: []const u8, link_libc: bool) void {
740 const b = self.b;742 const b = self.b;
741743
742 for ([]Mode{744 for (self.modes) |mode| {
743 Mode.Debug,
744 Mode.ReleaseSafe,
745 Mode.ReleaseFast,
746 Mode.ReleaseSmall,
747 }) |mode| {
748 const annotated_case_name = fmt.allocPrint(self.b.allocator, "build {} ({})", root_src, @tagName(mode)) catch unreachable;745 const annotated_case_name = fmt.allocPrint(self.b.allocator, "build {} ({})", root_src, @tagName(mode)) catch unreachable;
749 if (self.test_filter) |filter| {746 if (self.test_filter) |filter| {
750 if (mem.indexOf(u8, annotated_case_name, filter) == null) continue;747 if (mem.indexOf(u8, annotated_case_name, filter) == null) continue;