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.
This commit is contained in:
Andrew Kelley 2020-12-29 20:01:18 -07:00
parent d18b6785bb
commit 3d79ae2be3

View File

@ -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);
},
}
}