authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2021-04-30 23:41:28+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2021-04-30 23:41:28+02:00
logb49d99b246bc18d94b6eed0c225464078b05f12a
treebe0f1e562889b21c49d7a1aed2229a90843bdffb
parentd3f55782b0a48a4472d7d535ac1215c8f5d43e31

Azure CI: Test std.* and the rest separately

On CI, we have been running into OOM issues when running the test suite on Windows for quite some time. Unfortunately, we are very close to having the same issues on Linux as well. Some additional comptime work immediately makes these builds fail as well. Add a new `test-toolchain` step, that tests everything except `std.*` and documentation. On CI, call `test-toolchain`, `test-std` and `docs` separately instead of the `test` big hammer that emcompasses all of them. Change the special case we made for Windows to the same code as other platforms. This is a stopgap measure that stage2 will eventually make useless. Until then, it gives us some headroom. Change `linux_script` by the way to only output the log of failing steps. This shrinks the Linux CI log from a bazilion lines down to something more humanely manageable.

4 files changed, 49 insertions(+), 37 deletions(-)

build.zig+25-21
...@@ -36,7 +36,7 @@ pub fn build(b: *Builder) !void {...@@ -36,7 +36,7 @@ pub fn build(b: *Builder) !void {
36 const docs_step = b.step("docs", "Build documentation");36 const docs_step = b.step("docs", "Build documentation");
37 docs_step.dependOn(&docgen_cmd.step);37 docs_step.dependOn(&docgen_cmd.step);
3838
39 const test_step = b.step("test", "Run all the tests");39 const toolchain_step = b.step("test-toolchain", "Run the tests for the toolchain");
4040
41 var test_stage2 = b.addTest("src/test.zig");41 var test_stage2 = b.addTest("src/test.zig");
42 test_stage2.setBuildMode(mode);42 test_stage2.setBuildMode(mode);
...@@ -90,7 +90,7 @@ pub fn build(b: *Builder) !void {...@@ -90,7 +90,7 @@ pub fn build(b: *Builder) !void {
90 exe.install();90 exe.install();
91 exe.setBuildMode(mode);91 exe.setBuildMode(mode);
92 exe.setTarget(target);92 exe.setTarget(target);
93 test_step.dependOn(&exe.step);93 toolchain_step.dependOn(&exe.step);
94 b.default_step.dependOn(&exe.step);94 b.default_step.dependOn(&exe.step);
9595
96 exe.addBuildOption(bool, "skip_non_native", skip_non_native);96 exe.addBuildOption(bool, "skip_non_native", skip_non_native);
...@@ -233,7 +233,7 @@ pub fn build(b: *Builder) !void {...@@ -233,7 +233,7 @@ pub fn build(b: *Builder) !void {
233 const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");233 const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");
234 test_stage2_step.dependOn(&test_stage2.step);234 test_stage2_step.dependOn(&test_stage2.step);
235 if (!skip_stage2_tests) {235 if (!skip_stage2_tests) {
236 test_step.dependOn(test_stage2_step);236 toolchain_step.dependOn(test_stage2_step);
237 }237 }
238238
239 var chosen_modes: [4]builtin.Mode = undefined;239 var chosen_modes: [4]builtin.Mode = undefined;
...@@ -257,33 +257,37 @@ pub fn build(b: *Builder) !void {...@@ -257,33 +257,37 @@ pub fn build(b: *Builder) !void {
257 const modes = chosen_modes[0..chosen_mode_index];257 const modes = chosen_modes[0..chosen_mode_index];
258258
259 // run stage1 `zig fmt` on this build.zig file just to make sure it works259 // run stage1 `zig fmt` on this build.zig file just to make sure it works
260 test_step.dependOn(&fmt_build_zig.step);260 toolchain_step.dependOn(&fmt_build_zig.step);
261 const fmt_step = b.step("test-fmt", "Run zig fmt against build.zig to make sure it works");261 const fmt_step = b.step("test-fmt", "Run zig fmt against build.zig to make sure it works");
262 fmt_step.dependOn(&fmt_build_zig.step);262 fmt_step.dependOn(&fmt_build_zig.step);
263263
264 // TODO for the moment, skip wasm32-wasi until bugs are sorted out.264 // TODO for the moment, skip wasm32-wasi until bugs are sorted out.
265 test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));265 toolchain_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));
266266
267 test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));267 toolchain_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));
268268 toolchain_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/c.zig", "minilibc", "Run the mini libc tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));
269 test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));269
270 test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/c.zig", "minilibc", "Run the mini libc tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir));270 toolchain_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
271271 toolchain_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));
272 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));272 toolchain_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
273 test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));273 toolchain_step.dependOn(tests.addCliTests(b, test_filter, modes));
274 test_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));274 toolchain_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
275 test_step.dependOn(tests.addCliTests(b, test_filter, modes));275 toolchain_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));
276 test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));276 toolchain_step.dependOn(tests.addTranslateCTests(b, test_filter));
277 test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));
278 test_step.dependOn(tests.addTranslateCTests(b, test_filter));
279 if (!skip_run_translated_c) {277 if (!skip_run_translated_c) {
280 test_step.dependOn(tests.addRunTranslatedCTests(b, test_filter, target));278 toolchain_step.dependOn(tests.addRunTranslatedCTests(b, test_filter, target));
281 }279 }
282 // tests for this feature are disabled until we have the self-hosted compiler available280 // tests for this feature are disabled until we have the self-hosted compiler available
283 // test_step.dependOn(tests.addGenHTests(b, test_filter));281 // toolchain_step.dependOn(tests.addGenHTests(b, test_filter));
284 if (!skip_compile_errors) {282 if (!skip_compile_errors) {
285 test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));283 toolchain_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));
286 }284 }
285
286 const std_step = tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir);
287
288 const test_step = b.step("test", "Run all the tests");
289 test_step.dependOn(toolchain_step);
290 test_step.dependOn(std_step);
287 test_step.dependOn(docs_step);291 test_step.dependOn(docs_step);
288}292}
289293
ci/azure/linux_script+11-1
...@@ -65,7 +65,17 @@ make $JOBS install...@@ -65,7 +65,17 @@ make $JOBS install
65cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"65cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"
66make $JOBS install66make $JOBS install
6767
68release/bin/zig build test -Denable-qemu -Denable-wasmtime68set +x
69LOG=$(mktemp)
70for step in test-toolchain test-std docs; do
71 echo "* Running step: [$step]"
72 if ! release/bin/zig build $step -Denable-qemu -Denable-wasmtime 2>"$LOG" >&2; then
73 cat "$LOG" >&2
74 exit 1
75 fi
76 echo " Done."
77done
78set -x
6979
70# Look for HTML errors.80# Look for HTML errors.
71tidy -qe ../zig-cache/langref.html81tidy -qe ../zig-cache/langref.html
ci/azure/macos_script+12-2
...@@ -18,7 +18,7 @@ tar xf "$CACHE_BASENAME.tar.xz"...@@ -18,7 +18,7 @@ tar xf "$CACHE_BASENAME.tar.xz"
1818
19ZIG="$PREFIX/bin/zig"19ZIG="$PREFIX/bin/zig"
20NATIVE_LIBC_TXT="$HOME/native_libc.txt"20NATIVE_LIBC_TXT="$HOME/native_libc.txt"
21$ZIG libc > "$NATIVE_LIBC_TXT"21$ZIG libc >"$NATIVE_LIBC_TXT"
22export ZIG_LIBC="$NATIVE_LIBC_TXT"22export ZIG_LIBC="$NATIVE_LIBC_TXT"
23export CC="$ZIG cc"23export CC="$ZIG cc"
24export CXX="$ZIG c++"24export CXX="$ZIG c++"
...@@ -55,7 +55,17 @@ make $JOBS install...@@ -55,7 +55,17 @@ make $JOBS install
55cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig" -DZIG_TARGET_MCPU="x86_64_v2"55cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig" -DZIG_TARGET_MCPU="x86_64_v2"
56make $JOBS install56make $JOBS install
5757
58release/bin/zig build test58set +x
59LOG=$(mktemp)
60for step in test-toolchain test-std docs; do
61 echo "* Running step: [$step]"
62 if ! release/bin/zig build $step -Denable-qemu -Denable-wasmtime 2>"$LOG" >&2; then
63 cat "$LOG" >&2
64 exit 1
65 fi
66 echo " Done."
67done
68set -x
5969
60if [ "${BUILD_REASON}" != "PullRequest" ]; then70if [ "${BUILD_REASON}" != "PullRequest" ]; then
61 mv ../LICENSE release/71 mv ../LICENSE release/
ci/azure/windows_msvc_script.bat+1-13
...@@ -26,20 +26,8 @@ cd %ZIGBUILDDIR%...@@ -26,20 +26,8 @@ cd %ZIGBUILDDIR%
26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
27msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b27msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
2828
29"%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b29"%ZIGINSTALLDIR%\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests || exit /b
30REM Disabled to prevent OOM
31REM "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
32"%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b
33"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b30"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
34"%ZIGINSTALLDIR%\bin\zig.exe" build test-compiler-rt -Dskip-non-native || exit /b
35"%ZIGINSTALLDIR%\bin\zig.exe" build test-compare-output -Dskip-non-native || exit /b
36"%ZIGINSTALLDIR%\bin\zig.exe" build test-standalone -Dskip-non-native || exit /b
37"%ZIGINSTALLDIR%\bin\zig.exe" build test-stack-traces -Dskip-non-native || exit /b
38"%ZIGINSTALLDIR%\bin\zig.exe" build test-cli -Dskip-non-native || exit /b
39"%ZIGINSTALLDIR%\bin\zig.exe" build test-asm-link -Dskip-non-native || exit /b
40"%ZIGINSTALLDIR%\bin\zig.exe" build test-runtime-safety -Dskip-non-native || exit /b
41"%ZIGINSTALLDIR%\bin\zig.exe" build test-translate-c -Dskip-non-native || exit /b
42"%ZIGINSTALLDIR%\bin\zig.exe" build test-run-translated-c -Dskip-non-native || exit /b
43"%ZIGINSTALLDIR%\bin\zig.exe" build docs || exit /b31"%ZIGINSTALLDIR%\bin\zig.exe" build docs || exit /b
4432
45set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"33set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"