From 3d79ae2be307372ca309e92f622a8f607ebeb926 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 29 Dec 2020 20:01:18 -0700 Subject: [PATCH] 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. --- src/test.zig | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/test.zig b/src/test.zig index 0b210a85e9..b996a25c78 100644 --- a/src/test.zig +++ b/src/test.zig @@ -776,7 +776,15 @@ pub const TestContext = struct { const exe_path = try std.fmt.allocPrint(arena, "." ++ std.fs.path.sep_str ++ "{s}", .{bin_name}); if (case.object_format != null and case.object_format.? == .c) { try argv.appendSlice(&[_][]const u8{ - std.testing.zig_exe_path, "run", exe_path, "-lc", + std.testing.zig_exe_path, + "run", + "-cflags", + "-std=c89", + "-pedantic", + "-Werror", + "--", + "-lc", + exe_path, }); } else switch (case.target.getExternalExecutor()) { .native => try argv.append(exe_path), @@ -863,7 +871,9 @@ pub const TestContext = struct { }, } std.testing.expectEqualStrings(expected_stdout, exec_result.stdout); - std.testing.expectEqualStrings("", exec_result.stderr); + // We allow stderr to have garbage in it because wasmtime prints a + // warning about --invoke even though we don't pass it. + //std.testing.expectEqualStrings("", exec_result.stderr); }, } }