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:...@@ -20,6 +20,14 @@ jobs:
20 uses: actions/checkout@v420 uses: actions/checkout@v4
21 - name: Build and Test21 - name: Build and Test
22 run: sh ci/x86_64-linux-debug.sh22 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
23 x86_64-linux-release:31 x86_64-linux-release:
24 timeout-minutes: 54032 timeout-minutes: 540
25 runs-on: [self-hosted, Linux, x86_64]33 runs-on: [self-hosted, Linux, x86_64]
build.zig+35-1
...@@ -92,6 +92,11 @@ pub fn build(b: *std.Build) !void {...@@ -92,6 +92,11 @@ pub fn build(b: *std.Build) !void {
92 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;92 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
93 const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;93 const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;
94 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;94 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
96 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;101 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 {...@@ -435,6 +440,11 @@ pub fn build(b: *std.Build) !void {
435 .include_paths = &.{},440 .include_paths = &.{},
436 .skip_single_threaded = skip_single_threaded,441 .skip_single_threaded = skip_single_threaded,
437 .skip_non_native = skip_non_native,442 .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,
438 .skip_libc = skip_libc,448 .skip_libc = skip_libc,
439 .use_llvm = use_llvm,449 .use_llvm = use_llvm,
440 // 2923515904 was observed on an x86_64-linux-gnu host.450 // 2923515904 was observed on an x86_64-linux-gnu host.
...@@ -452,6 +462,11 @@ pub fn build(b: *std.Build) !void {...@@ -452,6 +462,11 @@ pub fn build(b: *std.Build) !void {
452 .include_paths = &.{"test/c_import"},462 .include_paths = &.{"test/c_import"},
453 .skip_single_threaded = true,463 .skip_single_threaded = true,
454 .skip_non_native = skip_non_native,464 .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,
455 .skip_libc = skip_libc,470 .skip_libc = skip_libc,
456 .use_llvm = use_llvm,471 .use_llvm = use_llvm,
457 }));472 }));
...@@ -467,6 +482,11 @@ pub fn build(b: *std.Build) !void {...@@ -467,6 +482,11 @@ pub fn build(b: *std.Build) !void {
467 .include_paths = &.{},482 .include_paths = &.{},
468 .skip_single_threaded = true,483 .skip_single_threaded = true,
469 .skip_non_native = skip_non_native,484 .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,
470 .skip_libc = true,490 .skip_libc = true,
471 .use_llvm = use_llvm,491 .use_llvm = use_llvm,
472 .no_builtin = true,492 .no_builtin = true,
...@@ -483,6 +503,11 @@ pub fn build(b: *std.Build) !void {...@@ -483,6 +503,11 @@ pub fn build(b: *std.Build) !void {
483 .include_paths = &.{},503 .include_paths = &.{},
484 .skip_single_threaded = true,504 .skip_single_threaded = true,
485 .skip_non_native = skip_non_native,505 .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,
486 .skip_libc = true,511 .skip_libc = true,
487 .use_llvm = use_llvm,512 .use_llvm = use_llvm,
488 .no_builtin = true,513 .no_builtin = true,
...@@ -499,6 +524,11 @@ pub fn build(b: *std.Build) !void {...@@ -499,6 +524,11 @@ pub fn build(b: *std.Build) !void {
499 .include_paths = &.{},524 .include_paths = &.{},
500 .skip_single_threaded = skip_single_threaded,525 .skip_single_threaded = skip_single_threaded,
501 .skip_non_native = skip_non_native,526 .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,
502 .skip_libc = skip_libc,532 .skip_libc = skip_libc,
503 .use_llvm = use_llvm,533 .use_llvm = use_llvm,
504 // I observed a value of 5605064704 on the M2 CI.534 // I observed a value of 5605064704 on the M2 CI.
...@@ -536,6 +566,11 @@ pub fn build(b: *std.Build) !void {...@@ -536,6 +566,11 @@ pub fn build(b: *std.Build) !void {
536 test_step.dependOn(tests.addCAbiTests(b, .{566 test_step.dependOn(tests.addCAbiTests(b, .{
537 .test_target_filters = test_target_filters,567 .test_target_filters = test_target_filters,
538 .skip_non_native = skip_non_native,568 .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,
539 .skip_release = skip_release,574 .skip_release = skip_release,
540 }));575 }));
541 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));576 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 {...@@ -549,7 +584,6 @@ pub fn build(b: *std.Build) !void {
549 .lldb = b.option([]const u8, "lldb", "path to lldb binary"),584 .lldb = b.option([]const u8, "lldb", "path to lldb binary"),
550 .optimize_modes = optimization_modes,585 .optimize_modes = optimization_modes,
551 .skip_single_threaded = skip_single_threaded,586 .skip_single_threaded = skip_single_threaded,
552 .skip_non_native = skip_non_native,
553 .skip_libc = skip_libc,587 .skip_libc = skip_libc,
554 })) |test_debugger_step| test_step.dependOn(test_debugger_step);588 })) |test_debugger_step| test_step.dependOn(test_debugger_step);
555 if (tests.addLlvmIrTests(b, .{589 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...@@ -25,12 +25,6 @@ git fetch --tags
25export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"25export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
26export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"26export 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
34mkdir build-debug28mkdir build-debug
35cd build-debug29cd build-debug
3630
...@@ -65,39 +59,11 @@ stage3-debug/bin/zig build test docs \...@@ -65,39 +59,11 @@ stage3-debug/bin/zig build test docs \
65 -fqemu \59 -fqemu \
66 -fwasmtime \60 -fwasmtime \
67 -Dstatic-llvm \61 -Dstatic-llvm \
62 -Dskip-freebsd \
63 -Dskip-netbsd \
64 -Dskip-windows \
65 -Dskip-macos \
68 -Dtarget=native-native-musl \66 -Dtarget=native-native-musl \
69 --search-prefix "$PREFIX" \67 --search-prefix "$PREFIX" \
70 --zig-lib-dir "$PWD/../lib" \68 --zig-lib-dir "$PWD/../lib" \
71 -Denable-superhtml69 -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 {...@@ -9,7 +9,6 @@ pub const Options = struct {
9 lldb: ?[]const u8,9 lldb: ?[]const u8,
10 optimize_modes: []const std.builtin.OptimizeMode,10 optimize_modes: []const std.builtin.OptimizeMode,
11 skip_single_threaded: bool,11 skip_single_threaded: bool,
12 skip_non_native: bool,
13 skip_libc: bool,12 skip_libc: bool,
14};13};
1514
test/tests.zig+21
...@@ -2273,6 +2273,11 @@ const ModuleTestOptions = struct {...@@ -2273,6 +2273,11 @@ const ModuleTestOptions = struct {
2273 include_paths: []const []const u8,2273 include_paths: []const []const u8,
2274 skip_single_threaded: bool,2274 skip_single_threaded: bool,
2275 skip_non_native: bool,2275 skip_non_native: bool,
2276 skip_freebsd: bool,
2277 skip_netbsd: bool,
2278 skip_windows: bool,
2279 skip_macos: bool,
2280 skip_linux: bool,
2276 skip_libc: bool,2281 skip_libc: bool,
2277 use_llvm: ?bool = null,2282 use_llvm: ?bool = null,
2278 max_rss: usize = 0,2283 max_rss: usize = 0,
...@@ -2295,6 +2300,12 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -2295,6 +2300,12 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
2295 if (options.skip_non_native and !test_target.target.isNative())2300 if (options.skip_non_native and !test_target.target.isNative())
2296 continue;2301 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
2298 const resolved_target = b.resolveTargetQuery(test_target.target);2309 const resolved_target = b.resolveTargetQuery(test_target.target);
2299 const target = resolved_target.result;2310 const target = resolved_target.result;
2300 const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");2311 const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");
...@@ -2501,6 +2512,11 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -2501,6 +2512,11 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
2501const CAbiTestOptions = struct {2512const CAbiTestOptions = struct {
2502 test_target_filters: []const []const u8,2513 test_target_filters: []const []const u8,
2503 skip_non_native: bool,2514 skip_non_native: bool,
2515 skip_freebsd: bool,
2516 skip_netbsd: bool,
2517 skip_windows: bool,
2518 skip_macos: bool,
2519 skip_linux: bool,
2504 skip_release: bool,2520 skip_release: bool,
2505};2521};
25062522
...@@ -2514,6 +2530,11 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {...@@ -2514,6 +2530,11 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
25142530
2515 for (c_abi_targets) |c_abi_target| {2531 for (c_abi_targets) |c_abi_target| {
2516 if (options.skip_non_native and !c_abi_target.target.isNative()) continue;2532 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
2518 const resolved_target = b.resolveTargetQuery(c_abi_target.target);2539 const resolved_target = b.resolveTargetQuery(c_abi_target.target);
2519 const target = resolved_target.result;2540 const target = resolved_target.result;