zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 3d79ae2be307372ca309e92f622a8f607ebeb926 (tree)
parent d18b6785bb394955eb092c82818e0214e456aced
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue, 29 Dec 2020 20:01:18 -0700

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.

Diffstat:
Msrc/test.zig | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

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