authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-13 16:47:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-20 12:27:03-07:00
log1ec50613bf2c492839fe798aeaaae789344eedf4
treebdae5a4c6b1c5939f0fc1332e9cc8ad13d7b089d
parentde62bd06472e5603fd2afb6f50d688d54f4098b4

CI: increase stage3 test coverage

* Use a debug build of stage3 instead of a debug build of stage2 for our self-hosted compiler test coverage. * Move coverage from stage1 to stage3 for: - building self-hosted without LLVM - building self-hosted for 32-bit arm - test-compiler-rt - test-behavior - test-std - test-compare-output - test-asm-link - test-fmt

3 files changed, 35 insertions(+), 41 deletions(-)

ci/zinc/linux_test.sh+30-38
......@@ -2,7 +2,7 @@
22
33. ./ci/zinc/linux_base.sh
44
5ZIG="$DEPS_LOCAL/bin/zig"
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
66TARGET="${ARCH}-linux-musl"
77MCPU="baseline"
88
......@@ -10,10 +10,10 @@ MCPU="baseline"
1010# This will affect the cmake command below.
1111git config core.abbrev 9
1212
13echo "BUILD debug zig with zig:$($ZIG version)"
13echo "building debug zig with zig version $($OLD_ZIG version)"
1414
15export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
15export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
1717
1818mkdir _debug
1919cd _debug
......@@ -33,52 +33,44 @@ unset CXX
3333
3434ninja install
3535
36ZIG="$DEBUG_STAGING/bin/zig"
36STAGE1_ZIG="$DEBUG_STAGING/bin/zig"
3737
3838# Here we rebuild zig but this time using the Zig binary we just now produced to
3939# build zig1.o rather than relying on the one built with stage0. See
4040# https://github.com/ziglang/zig/issues/6830 for more details.
41cmake .. -DZIG_EXECUTABLE="$ZIG"
41cmake .. -DZIG_EXECUTABLE="$STAGE1_ZIG"
4242ninja install
4343
4444cd $WORKSPACE
4545
46# Look for non-conforming code formatting.
47# Formatting errors can be fixed by running `zig fmt` on the files printed here.
48$ZIG fmt --check . --exclude test/cases/
46echo "Looking for non-conforming code formatting..."
47echo "Formatting errors can be fixed by running 'zig fmt' on the files printed here."
48$STAGE1_ZIG fmt --check . --exclude test/cases/
4949
50# Build stage2 standalone so that we can test stage2 against stage2 compiler-rt.
51$ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
52
53# Ensure that stage2 can build itself.
50$STAGE1_ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
5451stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
55stage2/bin/zig build # test building self-hosted without LLVM
56stage2/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm
57
58# Here we use stage2 instead of stage3 because of two bugs remaining:
59# * https://github.com/ziglang/zig/issues/11367 (and corresponding workaround in compiler source)
60# * https://github.com/ziglang/zig/pull/11492#issuecomment-1112871321
61stage2/bin/zig build test-behavior -fqemu -fwasmtime
62stage2/bin/zig test lib/std/std.zig --zig-lib-dir lib
63
64$ZIG build test-behavior -fqemu -fwasmtime -Domit-stage2
65$ZIG build test-compiler-rt -fqemu -fwasmtime
66$ZIG build test-std -fqemu -fwasmtime
67$ZIG build test-universal-libc -fqemu -fwasmtime
68$ZIG build test-compare-output -fqemu -fwasmtime
69$ZIG build test-standalone -fqemu -fwasmtime
70$ZIG build test-stack-traces -fqemu -fwasmtime
71$ZIG build test-cli -fqemu -fwasmtime
72$ZIG build test-asm-link -fqemu -fwasmtime
73$ZIG build test-translate-c -fqemu -fwasmtime
74$ZIG build test-run-translated-c -fqemu -fwasmtime
75$ZIG build docs -fqemu -fwasmtime
76$ZIG build test-fmt -fqemu -fwasmtime
77$ZIG build test-cases -fqemu -fwasmtime
52stage3/bin/zig build # test building self-hosted without LLVM
53stage3/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm
54
55stage3/bin/zig build test-compiler-rt -fqemu -fwasmtime -Denable-llvm
56stage3/bin/zig build test-behavior -fqemu -fwasmtime -Denable-llvm
57stage3/bin/zig build test-std -fqemu -fwasmtime -Denable-llvm
58stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Denable-llvm
59stage3/bin/zig build test-asm-link -fqemu -fwasmtime -Denable-llvm
60stage3/bin/zig build test-fmt -fqemu -fwasmtime -Denable-llvm
61
62$STAGE1_ZIG build test-universal-libc -fqemu -fwasmtime
63$STAGE1_ZIG build test-standalone -fqemu -fwasmtime
64$STAGE1_ZIG build test-stack-traces -fqemu -fwasmtime
65$STAGE1_ZIG build test-cli -fqemu -fwasmtime
66$STAGE1_ZIG build test-translate-c -fqemu -fwasmtime
67$STAGE1_ZIG build test-run-translated-c -fqemu -fwasmtime
68$STAGE1_ZIG build docs -fqemu -fwasmtime
69$STAGE1_ZIG build test-cases -fqemu -fwasmtime
7870
7971# Produce the experimental std lib documentation.
8072mkdir -p "$RELEASE_STAGING/docs/std"
81$ZIG test lib/std/std.zig \
73$STAGE1_ZIG test lib/std/std.zig \
8274 --zig-lib-dir lib \
8375 -femit-docs=$RELEASE_STAGING/docs/std \
8476 -fno-emit-bin
......@@ -87,7 +79,7 @@ $ZIG test lib/std/std.zig \
8779tidy --drop-empty-elements no -qe zig-cache/langref.html
8880
8981# Build release zig.
90$ZIG build \
82$STAGE1_ZIG build \
9183 --prefix "$RELEASE_STAGING" \
9284 --search-prefix "$DEPS_LOCAL" \
9385 -Dstatic-llvm \
test/cli.zig+1-1
......@@ -38,7 +38,7 @@ pub fn main() !void {
3838 testMissingOutputPath,
3939 testZigFmt,
4040 };
41 for (test_fns) |testFn| {
41 inline for (test_fns) |testFn| {
4242 try fs.cwd().deleteTree(dir_path);
4343 try fs.cwd().makeDir(dir_path);
4444 try testFn(zig_exe, dir_path);
test/compare_output.zig+4-2
......@@ -494,8 +494,10 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
494494 \\
495495 \\pub fn main() !void {
496496 \\ var allocator_buf: [10]u8 = undefined;
497 \\ var fixedBufferAllocator = std.mem.validationWrap(std.heap.FixedBufferAllocator.init(&allocator_buf));
498 \\ const allocator = std.heap.loggingAllocator(fixedBufferAllocator.allocator()).allocator();
497 \\ var fba = std.heap.FixedBufferAllocator.init(&allocator_buf);
498 \\ var fba_wrapped = std.mem.validationWrap(fba);
499 \\ var logging_allocator = std.heap.loggingAllocator(fba_wrapped.allocator());
500 \\ const allocator = logging_allocator.allocator();
499501 \\
500502 \\ var a = try allocator.alloc(u8, 10);
501503 \\ a = allocator.shrink(a, 5);