authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-08 16:59:38-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-19 16:45:15-07:00
log06c42a0c68b5e3ce54135738704cc7c6c5b92565
tree70d814109caa3efeea96b089915a90d9db62c6f5
parent507aae4a1a3db498ece2a3a89d74e9e24d952923

CI: test both stage3-debug and stage3-release on x86-linux


4 files changed, 170 insertions(+), 94 deletions(-)

ci/zinc/drone.yml+9-3
......@@ -9,14 +9,20 @@ workspace:
99 path: /workspace
1010
1111steps:
12- name: test
12- name: test_stage3_debug
1313 image: ci/debian-amd64:11.1-6
1414 commands:
15 - ./ci/zinc/linux_test.sh
15 - ./ci/zinc/linux_test_stage3_debug.sh
16
17- name: test_stage3_release
18 image: ci/debian-amd64:11.1-6
19 commands:
20 - ./ci/zinc/linux_test_stage3_release.sh
1621
1722- name: package
1823 depends_on:
19 - test
24 - test_stage3_debug
25 - test_stage3_release
2026 when:
2127 branch:
2228 - master
ci/zinc/linux_test.sh deleted-91
......@@ -1,91 +0,0 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"
8
9# Make the `zig version` number consistent.
10# This will affect the cmake command below.
11git config core.abbrev 9
12
13echo "building debug zig with zig version $($OLD_ZIG version)"
14
15export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
17
18mkdir _debug
19cd _debug
20cmake .. \
21 -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \
22 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
23 -DCMAKE_BUILD_TYPE=Debug \
24 -DZIG_TARGET_TRIPLE="$TARGET" \
25 -DZIG_TARGET_MCPU="$MCPU" \
26 -DZIG_STATIC=ON \
27 -GNinja
28
29# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
30# so that installation and testing do not get affected by them.
31unset CC
32unset CXX
33
34ninja install
35
36# Here we rebuild zig but this time using the Zig binary we just now produced to
37# build zig1.o rather than relying on the one built with stage0. See
38# https://github.com/ziglang/zig/issues/6830 for more details.
39cmake .. -DZIG_EXECUTABLE="$DEBUG_STAGING/bin/zig"
40ninja install
41
42cd $WORKSPACE
43
44"$DEBUG_STAGING/bin/zig" build -p stage3 -Denable-stage1 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
45
46# simultaneously test building self-hosted without LLVM and with 32-bit arm
47stage3/bin/zig build -Dtarget=arm-linux-musleabihf
48
49echo "Looking for non-conforming code formatting..."
50echo "Formatting errors can be fixed by running 'zig fmt' on the files printed here."
51stage3/bin/zig fmt --check . --exclude test/cases/
52
53stage3/bin/zig build test-compiler-rt -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
54stage3/bin/zig build test-behavior -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
55stage3/bin/zig build test-std -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
56stage3/bin/zig build test-universal-libc -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
57stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
58stage3/bin/zig build test-asm-link -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
59stage3/bin/zig build test-fmt -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
60stage3/bin/zig build test-translate-c -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
61stage3/bin/zig build test-run-translated-c -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
62stage3/bin/zig build test-standalone -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
63stage3/bin/zig build test-cli -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
64stage3/bin/zig build test-cases -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
65stage3/bin/zig build test-link -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
66stage3/bin/zig build docs -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
67
68stage3/bin/zig build test-stack-traces -fqemu -fwasmtime -fstage1
69
70# Produce the experimental std lib documentation.
71mkdir -p "$RELEASE_STAGING/docs/std"
72stage3/bin/zig test lib/std/std.zig \
73 --zig-lib-dir lib \
74 -femit-docs=$RELEASE_STAGING/docs/std \
75 -fno-emit-bin
76
77# Look for HTML errors.
78tidy --drop-empty-elements no -qe zig-cache/langref.html
79
80# Build release zig.
81stage3/bin/zig build \
82 --prefix "$RELEASE_STAGING" \
83 --search-prefix "$DEPS_LOCAL" \
84 -Dstatic-llvm \
85 -Drelease \
86 -Dstrip \
87 -Dtarget="$TARGET" \
88 -Denable-stage1
89
90# Explicit exit helps show last command duration.
91exit
ci/zinc/linux_test_stage3_debug.sh created+70
......@@ -0,0 +1,70 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"
8
9# Make the `zig version` number consistent.
10# This will affect the cmake command below.
11git config core.abbrev 9
12
13echo "building stage3-debug with zig version $($OLD_ZIG version)"
14
15export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
17
18mkdir build-debug
19cd build-debug
20cmake .. \
21 -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \
22 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
23 -DCMAKE_BUILD_TYPE=Debug \
24 -DZIG_TARGET_TRIPLE="$TARGET" \
25 -DZIG_TARGET_MCPU="$MCPU" \
26 -DZIG_STATIC=ON \
27 -GNinja
28
29# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
30# so that installation and testing do not get affected by them.
31unset CC
32unset CXX
33
34ninja install
35
36# Here we rebuild zig but this time using the Zig binary we just now produced to
37# build zig1.o rather than relying on the one built with stage0. See
38# https://github.com/ziglang/zig/issues/6830 for more details.
39cmake .. -DZIG_EXECUTABLE="$DEBUG_STAGING/bin/zig"
40ninja install
41
42cd $WORKSPACE
43
44"$DEBUG_STAGING/bin/zig" build -p stage3 -Denable-stage1 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
45
46# simultaneously test building self-hosted without LLVM and with 32-bit arm
47stage3/bin/zig build -Dtarget=arm-linux-musleabihf
48
49echo "Looking for non-conforming code formatting..."
50echo "Formatting errors can be fixed by running 'zig fmt' on the files printed here."
51stage3/bin/zig fmt --check . --exclude test/cases/
52
53stage3/bin/zig build test-compiler-rt -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
54stage3/bin/zig build test-behavior -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
55stage3/bin/zig build test-std -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
56stage3/bin/zig build test-universal-libc -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
57stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
58stage3/bin/zig build test-asm-link -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
59stage3/bin/zig build test-fmt -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
60stage3/bin/zig build test-translate-c -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
61stage3/bin/zig build test-run-translated-c -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
62stage3/bin/zig build test-standalone -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
63stage3/bin/zig build test-cli -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
64stage3/bin/zig build test-cases -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
65stage3/bin/zig build test-link -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
66stage3/bin/zig build test-stack-traces -fqemu -fwasmtime -fstage1
67stage3/bin/zig build docs -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
68
69# Explicit exit helps show last command duration.
70exit
ci/zinc/linux_test_stage3_release.sh created+91
......@@ -0,0 +1,91 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"
8
9# Make the `zig version` number consistent.
10# This will affect the cmake command below.
11git config core.abbrev 9
12
13echo "building stage3-release with zig version $($OLD_ZIG version)"
14
15export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
16export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
17
18mkdir build-release
19cd build-release
20STAGE2_PREFIX="$(pwd)/stage2"
21cmake .. \
22 -DCMAKE_INSTALL_PREFIX="$STAGE2_PREFIX" \
23 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
24 -DCMAKE_BUILD_TYPE=Release \
25 -DZIG_TARGET_TRIPLE="$TARGET" \
26 -DZIG_TARGET_MCPU="$MCPU" \
27 -DZIG_STATIC=ON \
28 -GNinja
29
30# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
31# so that installation and testing do not get affected by them.
32unset CC
33unset CXX
34
35ninja install
36
37# Here we rebuild zig but this time using the Zig binary we just now produced to
38# build zig1.o rather than relying on the one built with stage0. See
39# https://github.com/ziglang/zig/issues/6830 for more details.
40cmake .. -DZIG_EXECUTABLE="$STAGE2_PREFIX/bin/zig"
41ninja install
42
43# This is the binary we will distribute. We intentionally test this one in this
44# script. If any test failures occur, hopefully they also occur in the debug
45# version of this script for easier troubleshooting. This prevents distribution
46# of a Zig binary that passes tests in debug mode but has a miscompilation in
47# release mode.
48"$STAGE2_PREFIX/bin/zig" build \
49 --prefix "$RELEASE_STAGING" \
50 --search-prefix "$DEPS_LOCAL" \
51 -Dstatic-llvm \
52 -Drelease \
53 -Dstrip \
54 -Dtarget="$TARGET" \
55 -Denable-stage1
56
57cd $WORKSPACE
58
59ZIG="$RELEASE_STAGING/bin/zig"
60
61$ZIG build \
62 test-compiler-rt \
63 test-behavior \
64 test-std \
65 test-universal-libc \
66 test-compare-output \
67 test-asm-link \
68 test-translate-c \
69 test-run-translated-c \
70 test-standalone \
71 test-cli \
72 test-cases \
73 test-link \
74 -fqemu \
75 -fwasmtime \
76 -Dstatic-llvm \
77 -Dtarget=native-native-musl \
78 --search-prefix "$DEPS_LOCAL"
79
80# Produce the experimental std lib documentation.
81mkdir -p "$RELEASE_STAGING/docs/std"
82$ZIG test lib/std/std.zig \
83 --zig-lib-dir lib \
84 -femit-docs=$RELEASE_STAGING/docs/std \
85 -fno-emit-bin
86
87# Look for HTML errors.
88tidy --drop-empty-elements no -qe zig-cache/langref.html
89
90# Explicit exit helps show last command duration.
91exit