authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-06 12:50:14-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-06 23:42:15-07:00
log125a9aa82b55f8d1e2b6d08d61e697e6dfacbba6
treecc29fb1d515689824f5d7bb9d2834715523590af
parent37f763560b020ae0ef5ed076afc1872a57266b45

restore debug llvm CI coverage

and reduce redundant coverage in slow runs to save time

6 files changed, 138 insertions(+), 40 deletions(-)

.github/workflows/ci.yaml+8
......@@ -20,6 +20,14 @@ jobs:
2020 uses: actions/checkout@v4
2121 - name: Build and Test
2222 run: sh ci/x86_64-linux-debug.sh
23 x86_64-linux-debug-llvm:
24 timeout-minutes: 540
25 runs-on: [self-hosted, Linux, x86_64]
26 steps:
27 - name: Checkout
28 uses: actions/checkout@v4
29 - name: Build and Test
30 run: sh ci/x86_64-linux-debug-llvm.sh
2331 x86_64-linux-release:
2432 timeout-minutes: 540
2533 runs-on: [self-hosted, Linux, x86_64]
build.zig+35-1
......@@ -92,6 +92,11 @@ pub fn build(b: *std.Build) !void {
9292 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
9393 const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;
9494 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
95 const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;
96 const skip_netbsd = b.option(bool, "skip-netbsd", "Main test suite skips targets with netbsd OS") orelse false;
97 const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;
98 const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false;
99 const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false;
95100
96101 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
97102
......@@ -435,6 +440,11 @@ pub fn build(b: *std.Build) !void {
435440 .include_paths = &.{},
436441 .skip_single_threaded = skip_single_threaded,
437442 .skip_non_native = skip_non_native,
443 .skip_freebsd = skip_freebsd,
444 .skip_netbsd = skip_netbsd,
445 .skip_windows = skip_windows,
446 .skip_macos = skip_macos,
447 .skip_linux = skip_linux,
438448 .skip_libc = skip_libc,
439449 .use_llvm = use_llvm,
440450 // 2923515904 was observed on an x86_64-linux-gnu host.
......@@ -452,6 +462,11 @@ pub fn build(b: *std.Build) !void {
452462 .include_paths = &.{"test/c_import"},
453463 .skip_single_threaded = true,
454464 .skip_non_native = skip_non_native,
465 .skip_freebsd = skip_freebsd,
466 .skip_netbsd = skip_netbsd,
467 .skip_windows = skip_windows,
468 .skip_macos = skip_macos,
469 .skip_linux = skip_linux,
455470 .skip_libc = skip_libc,
456471 .use_llvm = use_llvm,
457472 }));
......@@ -467,6 +482,11 @@ pub fn build(b: *std.Build) !void {
467482 .include_paths = &.{},
468483 .skip_single_threaded = true,
469484 .skip_non_native = skip_non_native,
485 .skip_freebsd = skip_freebsd,
486 .skip_netbsd = skip_netbsd,
487 .skip_windows = skip_windows,
488 .skip_macos = skip_macos,
489 .skip_linux = skip_linux,
470490 .skip_libc = true,
471491 .use_llvm = use_llvm,
472492 .no_builtin = true,
......@@ -483,6 +503,11 @@ pub fn build(b: *std.Build) !void {
483503 .include_paths = &.{},
484504 .skip_single_threaded = true,
485505 .skip_non_native = skip_non_native,
506 .skip_freebsd = skip_freebsd,
507 .skip_netbsd = skip_netbsd,
508 .skip_windows = skip_windows,
509 .skip_macos = skip_macos,
510 .skip_linux = skip_linux,
486511 .skip_libc = true,
487512 .use_llvm = use_llvm,
488513 .no_builtin = true,
......@@ -499,6 +524,11 @@ pub fn build(b: *std.Build) !void {
499524 .include_paths = &.{},
500525 .skip_single_threaded = skip_single_threaded,
501526 .skip_non_native = skip_non_native,
527 .skip_freebsd = skip_freebsd,
528 .skip_netbsd = skip_netbsd,
529 .skip_windows = skip_windows,
530 .skip_macos = skip_macos,
531 .skip_linux = skip_linux,
502532 .skip_libc = skip_libc,
503533 .use_llvm = use_llvm,
504534 // I observed a value of 5605064704 on the M2 CI.
......@@ -536,6 +566,11 @@ pub fn build(b: *std.Build) !void {
536566 test_step.dependOn(tests.addCAbiTests(b, .{
537567 .test_target_filters = test_target_filters,
538568 .skip_non_native = skip_non_native,
569 .skip_freebsd = skip_freebsd,
570 .skip_netbsd = skip_netbsd,
571 .skip_windows = skip_windows,
572 .skip_macos = skip_macos,
573 .skip_linux = skip_linux,
539574 .skip_release = skip_release,
540575 }));
541576 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
......@@ -549,7 +584,6 @@ pub fn build(b: *std.Build) !void {
549584 .lldb = b.option([]const u8, "lldb", "path to lldb binary"),
550585 .optimize_modes = optimization_modes,
551586 .skip_single_threaded = skip_single_threaded,
552 .skip_non_native = skip_non_native,
553587 .skip_libc = skip_libc,
554588 })) |test_debugger_step| test_step.dependOn(test_debugger_step);
555589 if (tests.addLlvmIrTests(b, .{
ci/x86_64-linux-debug-llvm.sh created+70
......@@ -0,0 +1,70 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.15.0-dev.233+7c85dc460"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v29.0.0-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-9.2.0-rc1/bin:$HOME/local/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git fetch --unshallow || true
20git fetch --tags
21
22# Override the cache directories because they won't actually help other CI runs
23# which will be testing alternate versions of zig, and ultimately would just
24# fill up space on the hard drive for no reason.
25export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
26export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
27
28mkdir build-debug-llvm
29cd build-debug-llvm
30
31export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
32export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
33
34cmake .. \
35 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
36 -DCMAKE_PREFIX_PATH="$PREFIX" \
37 -DCMAKE_BUILD_TYPE=Debug \
38 -DZIG_TARGET_TRIPLE="$TARGET" \
39 -DZIG_TARGET_MCPU="$MCPU" \
40 -DZIG_STATIC=ON \
41 -DZIG_NO_LIB=ON \
42 -DZIG_EXTRA_BUILD_ARGS="-Duse-llvm=true" \
43 -GNinja
44
45# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
46# so that installation and testing do not get affected by them.
47unset CC
48unset CXX
49
50ninja install
51
52# simultaneously test building self-hosted without LLVM and with 32-bit arm
53stage3-debug/bin/zig build \
54 -Dtarget=arm-linux-musleabihf \
55 -Dno-lib
56
57stage3-debug/bin/zig build test docs \
58 --maxrss 21000000000 \
59 -Dlldb=$HOME/deps/lldb-zig/Debug-e0a42bb34/bin/lldb \
60 -fqemu \
61 -fwasmtime \
62 -Dstatic-llvm \
63 -Dskip-freebsd \
64 -Dskip-netbsd \
65 -Dskip-windows \
66 -Dskip-macos \
67 -Dtarget=native-native-musl \
68 --search-prefix "$PREFIX" \
69 --zig-lib-dir "$PWD/../lib" \
70 -Denable-superhtml
ci/x86_64-linux-debug.sh+4-38
......@@ -25,12 +25,6 @@ git fetch --tags
2525export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
2626export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
2727
28# Test building from source without LLVM.
29cc -o bootstrap bootstrap.c
30./bootstrap
31./zig2 build -Dno-lib
32./zig-out/bin/zig test test/behavior.zig
33
3428mkdir build-debug
3529cd build-debug
3630
......@@ -65,39 +59,11 @@ stage3-debug/bin/zig build test docs \
6559 -fqemu \
6660 -fwasmtime \
6761 -Dstatic-llvm \
62 -Dskip-freebsd \
63 -Dskip-netbsd \
64 -Dskip-windows \
65 -Dskip-macos \
6866 -Dtarget=native-native-musl \
6967 --search-prefix "$PREFIX" \
7068 --zig-lib-dir "$PWD/../lib" \
7169 -Denable-superhtml
72
73# Ensure that updating the wasm binary from this commit will result in a viable build.
74stage3-debug/bin/zig build update-zig1
75
76mkdir ../build-new
77cd ../build-new
78
79export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
80export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
81
82cmake .. \
83 -DCMAKE_PREFIX_PATH="$PREFIX" \
84 -DCMAKE_BUILD_TYPE=Debug \
85 -DZIG_TARGET_TRIPLE="$TARGET" \
86 -DZIG_TARGET_MCPU="$MCPU" \
87 -DZIG_STATIC=ON \
88 -DZIG_NO_LIB=ON \
89 -GNinja
90
91unset CC
92unset CXX
93
94ninja install
95
96stage3/bin/zig test ../test/behavior.zig
97stage3/bin/zig build -p stage4 \
98 -Dstatic-llvm \
99 -Dtarget=native-native-musl \
100 -Dno-lib \
101 --search-prefix "$PREFIX" \
102 --zig-lib-dir "$PWD/../lib"
103stage4/bin/zig test ../test/behavior.zig
test/src/Debugger.zig-1
......@@ -9,7 +9,6 @@ pub const Options = struct {
99 lldb: ?[]const u8,
1010 optimize_modes: []const std.builtin.OptimizeMode,
1111 skip_single_threaded: bool,
12 skip_non_native: bool,
1312 skip_libc: bool,
1413};
1514
test/tests.zig+21
......@@ -2273,6 +2273,11 @@ const ModuleTestOptions = struct {
22732273 include_paths: []const []const u8,
22742274 skip_single_threaded: bool,
22752275 skip_non_native: bool,
2276 skip_freebsd: bool,
2277 skip_netbsd: bool,
2278 skip_windows: bool,
2279 skip_macos: bool,
2280 skip_linux: bool,
22762281 skip_libc: bool,
22772282 use_llvm: ?bool = null,
22782283 max_rss: usize = 0,
......@@ -2295,6 +2300,12 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
22952300 if (options.skip_non_native and !test_target.target.isNative())
22962301 continue;
22972302
2303 if (options.skip_freebsd and test_target.target.os_tag == .freebsd) continue;
2304 if (options.skip_netbsd and test_target.target.os_tag == .netbsd) continue;
2305 if (options.skip_windows and test_target.target.os_tag == .windows) continue;
2306 if (options.skip_macos and test_target.target.os_tag == .macos) continue;
2307 if (options.skip_linux and test_target.target.os_tag == .linux) continue;
2308
22982309 const resolved_target = b.resolveTargetQuery(test_target.target);
22992310 const target = resolved_target.result;
23002311 const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");
......@@ -2501,6 +2512,11 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
25012512const CAbiTestOptions = struct {
25022513 test_target_filters: []const []const u8,
25032514 skip_non_native: bool,
2515 skip_freebsd: bool,
2516 skip_netbsd: bool,
2517 skip_windows: bool,
2518 skip_macos: bool,
2519 skip_linux: bool,
25042520 skip_release: bool,
25052521};
25062522
......@@ -2514,6 +2530,11 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
25142530
25152531 for (c_abi_targets) |c_abi_target| {
25162532 if (options.skip_non_native and !c_abi_target.target.isNative()) continue;
2533 if (options.skip_freebsd and c_abi_target.target.os_tag == .freebsd) continue;
2534 if (options.skip_netbsd and c_abi_target.target.os_tag == .netbsd) continue;
2535 if (options.skip_windows and c_abi_target.target.os_tag == .windows) continue;
2536 if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue;
2537 if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue;
25172538
25182539 const resolved_target = b.resolveTargetQuery(c_abi_target.target);
25192540 const target = resolved_target.result;