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 @@...@@ -2,7 +2,7 @@
22
3. ./ci/zinc/linux_base.sh3. ./ci/zinc/linux_base.sh
44
5ZIG="$DEPS_LOCAL/bin/zig"5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"7MCPU="baseline"
88
...@@ -10,10 +10,10 @@ MCPU="baseline"...@@ -10,10 +10,10 @@ MCPU="baseline"
10# This will affect the cmake command below.10# This will affect the cmake command below.
11git config core.abbrev 911git 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"15export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"16export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
1717
18mkdir _debug18mkdir _debug
19cd _debug19cd _debug
...@@ -33,52 +33,44 @@ unset CXX...@@ -33,52 +33,44 @@ unset CXX
3333
34ninja install34ninja install
3535
36ZIG="$DEBUG_STAGING/bin/zig"36STAGE1_ZIG="$DEBUG_STAGING/bin/zig"
3737
38# Here we rebuild zig but this time using the Zig binary we just now produced to38# Here we rebuild zig but this time using the Zig binary we just now produced to
39# build zig1.o rather than relying on the one built with stage0. See39# build zig1.o rather than relying on the one built with stage0. See
40# https://github.com/ziglang/zig/issues/6830 for more details.40# https://github.com/ziglang/zig/issues/6830 for more details.
41cmake .. -DZIG_EXECUTABLE="$ZIG"41cmake .. -DZIG_EXECUTABLE="$STAGE1_ZIG"
42ninja install42ninja install
4343
44cd $WORKSPACE44cd $WORKSPACE
4545
46# Look for non-conforming code formatting.46echo "Looking for non-conforming code formatting..."
47# Formatting errors can be fixed by running `zig fmt` on the files printed here.47echo "Formatting errors can be fixed by running 'zig fmt' on the files printed here."
48$ZIG fmt --check . --exclude test/cases/48$STAGE1_ZIG fmt --check . --exclude test/cases/
4949
50# Build stage2 standalone so that we can test stage2 against stage2 compiler-rt.50$STAGE1_ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
51$ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
52
53# Ensure that stage2 can build itself.
54stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"51stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
55stage2/bin/zig build # test building self-hosted without LLVM52stage3/bin/zig build # test building self-hosted without LLVM
56stage2/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm53stage3/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm
5754
58# Here we use stage2 instead of stage3 because of two bugs remaining:55stage3/bin/zig build test-compiler-rt -fqemu -fwasmtime -Denable-llvm
59# * https://github.com/ziglang/zig/issues/11367 (and corresponding workaround in compiler source)56stage3/bin/zig build test-behavior -fqemu -fwasmtime -Denable-llvm
60# * https://github.com/ziglang/zig/pull/11492#issuecomment-111287132157stage3/bin/zig build test-std -fqemu -fwasmtime -Denable-llvm
61stage2/bin/zig build test-behavior -fqemu -fwasmtime58stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Denable-llvm
62stage2/bin/zig test lib/std/std.zig --zig-lib-dir lib59stage3/bin/zig build test-asm-link -fqemu -fwasmtime -Denable-llvm
6360stage3/bin/zig build test-fmt -fqemu -fwasmtime -Denable-llvm
64$ZIG build test-behavior -fqemu -fwasmtime -Domit-stage261
65$ZIG build test-compiler-rt -fqemu -fwasmtime62$STAGE1_ZIG build test-universal-libc -fqemu -fwasmtime
66$ZIG build test-std -fqemu -fwasmtime63$STAGE1_ZIG build test-standalone -fqemu -fwasmtime
67$ZIG build test-universal-libc -fqemu -fwasmtime64$STAGE1_ZIG build test-stack-traces -fqemu -fwasmtime
68$ZIG build test-compare-output -fqemu -fwasmtime65$STAGE1_ZIG build test-cli -fqemu -fwasmtime
69$ZIG build test-standalone -fqemu -fwasmtime66$STAGE1_ZIG build test-translate-c -fqemu -fwasmtime
70$ZIG build test-stack-traces -fqemu -fwasmtime67$STAGE1_ZIG build test-run-translated-c -fqemu -fwasmtime
71$ZIG build test-cli -fqemu -fwasmtime68$STAGE1_ZIG build docs -fqemu -fwasmtime
72$ZIG build test-asm-link -fqemu -fwasmtime69$STAGE1_ZIG build test-cases -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
7870
79# Produce the experimental std lib documentation.71# Produce the experimental std lib documentation.
80mkdir -p "$RELEASE_STAGING/docs/std"72mkdir -p "$RELEASE_STAGING/docs/std"
81$ZIG test lib/std/std.zig \73$STAGE1_ZIG test lib/std/std.zig \
82 --zig-lib-dir lib \74 --zig-lib-dir lib \
83 -femit-docs=$RELEASE_STAGING/docs/std \75 -femit-docs=$RELEASE_STAGING/docs/std \
84 -fno-emit-bin76 -fno-emit-bin
...@@ -87,7 +79,7 @@ $ZIG test lib/std/std.zig \...@@ -87,7 +79,7 @@ $ZIG test lib/std/std.zig \
87tidy --drop-empty-elements no -qe zig-cache/langref.html79tidy --drop-empty-elements no -qe zig-cache/langref.html
8880
89# Build release zig.81# Build release zig.
90$ZIG build \82$STAGE1_ZIG build \
91 --prefix "$RELEASE_STAGING" \83 --prefix "$RELEASE_STAGING" \
92 --search-prefix "$DEPS_LOCAL" \84 --search-prefix "$DEPS_LOCAL" \
93 -Dstatic-llvm \85 -Dstatic-llvm \
test/cli.zig+1-1
...@@ -38,7 +38,7 @@ pub fn main() !void {...@@ -38,7 +38,7 @@ pub fn main() !void {
38 testMissingOutputPath,38 testMissingOutputPath,
39 testZigFmt,39 testZigFmt,
40 };40 };
41 for (test_fns) |testFn| {41 inline for (test_fns) |testFn| {
42 try fs.cwd().deleteTree(dir_path);42 try fs.cwd().deleteTree(dir_path);
43 try fs.cwd().makeDir(dir_path);43 try fs.cwd().makeDir(dir_path);
44 try testFn(zig_exe, dir_path);44 try testFn(zig_exe, dir_path);
test/compare_output.zig+4-2
...@@ -494,8 +494,10 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -494,8 +494,10 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
494 \\494 \\
495 \\pub fn main() !void {495 \\pub fn main() !void {
496 \\ var allocator_buf: [10]u8 = undefined;496 \\ var allocator_buf: [10]u8 = undefined;
497 \\ var fixedBufferAllocator = std.mem.validationWrap(std.heap.FixedBufferAllocator.init(&allocator_buf));497 \\ var fba = std.heap.FixedBufferAllocator.init(&allocator_buf);
498 \\ const allocator = std.heap.loggingAllocator(fixedBufferAllocator.allocator()).allocator();498 \\ var fba_wrapped = std.mem.validationWrap(fba);
499 \\ var logging_allocator = std.heap.loggingAllocator(fba_wrapped.allocator());
500 \\ const allocator = logging_allocator.allocator();
499 \\501 \\
500 \\ var a = try allocator.alloc(u8, 10);502 \\ var a = try allocator.alloc(u8, 10);
501 \\ a = allocator.shrink(a, 5);503 \\ a = allocator.shrink(a, 5);