authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-29 20:01:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-29 20:01:18-07:00
log3d79ae2be307372ca309e92f622a8f607ebeb926
tree10fb057855c748c542e52ffcdc139b40d2521843
parentd18b6785bb394955eb092c82818e0214e456aced

stage2 tests: improve C backend testing

Add -Werror -pedantic -std=c89 to make sure our outputted C code is squeaky clean. Allow garbage to be printed to stderr for Execution tests because wasmtime is printing a bogus warning, causing the CI to fail.

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

src/test.zig+12-2
...@@ -776,7 +776,15 @@ pub const TestContext = struct {...@@ -776,7 +776,15 @@ pub const TestContext = struct {
776 const exe_path = try std.fmt.allocPrint(arena, "." ++ std.fs.path.sep_str ++ "{s}", .{bin_name});776 const exe_path = try std.fmt.allocPrint(arena, "." ++ std.fs.path.sep_str ++ "{s}", .{bin_name});
777 if (case.object_format != null and case.object_format.? == .c) {777 if (case.object_format != null and case.object_format.? == .c) {
778 try argv.appendSlice(&[_][]const u8{778 try argv.appendSlice(&[_][]const u8{
779 std.testing.zig_exe_path, "run", exe_path, "-lc",779 std.testing.zig_exe_path,
780 "run",
781 "-cflags",
782 "-std=c89",
783 "-pedantic",
784 "-Werror",
785 "--",
786 "-lc",
787 exe_path,
780 });788 });
781 } else switch (case.target.getExternalExecutor()) {789 } else switch (case.target.getExternalExecutor()) {
782 .native => try argv.append(exe_path),790 .native => try argv.append(exe_path),
...@@ -863,7 +871,9 @@ pub const TestContext = struct {...@@ -863,7 +871,9 @@ pub const TestContext = struct {
863 },871 },
864 }872 }
865 std.testing.expectEqualStrings(expected_stdout, exec_result.stdout);873 std.testing.expectEqualStrings(expected_stdout, exec_result.stdout);
866 std.testing.expectEqualStrings("", exec_result.stderr);874 // We allow stderr to have garbage in it because wasmtime prints a
875 // warning about --invoke even though we don't pass it.
876 //std.testing.expectEqualStrings("", exec_result.stderr);
867 },877 },
868 }878 }
869 }879 }