authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-08 12:35:11+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-08 12:35:11+01:00
logd1be8b138e17ff72f5d3341e7718c72059886c4a
treef44fada7aa37fa2f4946b87f43909d327994ab0c
parentac917993329076170d7a25ae5d7a9e822fb388ad
parent046386295f5a58bf7a4b2be12b82c5ee9421a243

Merge pull request 'enable `x86_64-openbsd` CI' (#30733) from alexrp/zig:openbsd-ci into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30733

7 files changed, 157 insertions(+), 0 deletions(-)

.forgejo/workflows/ci.yaml+21
......@@ -195,6 +195,27 @@ jobs:
195195 run: sh ci/x86_64-linux-release.sh
196196 timeout-minutes: 360
197197
198 x86_64-openbsd-debug:
199 runs-on: [self-hosted, x86_64-openbsd]
200 steps:
201 - name: Checkout
202 uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
203 with:
204 fetch-depth: 0
205 - name: Build and Test
206 run: sh ci/x86_64-openbsd-debug.sh
207 timeout-minutes: 120
208 x86_64-openbsd-release:
209 runs-on: [self-hosted, x86_64-openbsd]
210 steps:
211 - name: Checkout
212 uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
213 with:
214 fetch-depth: 0
215 - name: Build and Test
216 run: sh ci/x86_64-openbsd-release.sh
217 timeout-minutes: 120
218
198219 x86_64-windows-debug:
199220 runs-on: [self-hosted, x86_64-windows]
200221 steps:
ci/x86_64-openbsd-debug.sh created+62
......@@ -0,0 +1,62 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8TARGET="x86_64-openbsd-none"
9MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2051+28b83e3b0"
11PREFIX="$HOME/deps/$CACHE_BASENAME"
12ZIG="$PREFIX/bin/zig"
13
14# Override the cache directories because they won't actually help other CI runs
15# which will be testing alternate versions of zig, and ultimately would just
16# fill up space on the hard drive for no reason.
17export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
18export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
19
20mkdir build-debug
21cd build-debug
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Debug \
30 -DZIG_TARGET_TRIPLE="$TARGET" \
31 -DZIG_TARGET_MCPU="$MCPU" \
32 -DZIG_STATIC=ON \
33 -DZIG_NO_LIB=ON \
34 -GNinja \
35 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
36 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
37# https://github.com/ziglang/zig/issues/22213
38
39# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
40# so that installation and testing do not get affected by them.
41unset CC
42unset CXX
43
44ninja install
45
46stage3-debug/bin/zig build test docs \
47 --maxrss ${ZSF_MAX_RSS:-0} \
48 -Dstatic-llvm \
49 -Dskip-non-native \
50 --search-prefix "$PREFIX" \
51 --zig-lib-dir "$PWD/../lib" \
52 --test-timeout 2m
53
54stage3-debug/bin/zig build \
55 --prefix stage4-debug \
56 -Denable-llvm \
57 -Dno-lib \
58 -Dtarget=$TARGET \
59 -Duse-zig-libcxx \
60 -Dversion-string="$(stage3-debug/bin/zig version)"
61
62stage4-debug/bin/zig test ../test/behavior.zig
ci/x86_64-openbsd-release.sh created+68
......@@ -0,0 +1,68 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8TARGET="x86_64-openbsd-none"
9MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2051+28b83e3b0"
11PREFIX="$HOME/deps/$CACHE_BASENAME"
12ZIG="$PREFIX/bin/zig"
13
14# Override the cache directories because they won't actually help other CI runs
15# which will be testing alternate versions of zig, and ultimately would just
16# fill up space on the hard drive for no reason.
17export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
18export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
19
20mkdir build-release
21cd build-release
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-release" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Release \
30 -DZIG_TARGET_TRIPLE="$TARGET" \
31 -DZIG_TARGET_MCPU="$MCPU" \
32 -DZIG_STATIC=ON \
33 -DZIG_NO_LIB=ON \
34 -GNinja \
35 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
36 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
37# https://github.com/ziglang/zig/issues/22213
38
39# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
40# so that installation and testing do not get affected by them.
41unset CC
42unset CXX
43
44ninja install
45
46stage3-release/bin/zig build test docs \
47 --maxrss ${ZSF_MAX_RSS:-0} \
48 -Dstatic-llvm \
49 -Dskip-non-native \
50 --search-prefix "$PREFIX" \
51 --zig-lib-dir "$PWD/../lib" \
52 --test-timeout 2m
53
54# Ensure that stage3 and stage4 are byte-for-byte identical.
55stage3-release/bin/zig build \
56 --prefix stage4-release \
57 -Denable-llvm \
58 -Dno-lib \
59 -Doptimize=ReleaseFast \
60 -Dstrip \
61 -Dtarget=$TARGET \
62 -Duse-zig-libcxx \
63 -Dversion-string="$(stage3-release/bin/zig version)"
64
65# diff returns an error code if the files differ.
66echo "If the following command fails, it means nondeterminism has been"
67echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
68diff stage3-release/bin/zig stage4-release/bin/zig
lib/std/fs/test.zig+2
......@@ -1130,6 +1130,7 @@ test "renameAbsolute" {
11301130
11311131test "openExecutable" {
11321132 if (native_os == .wasi) return error.SkipZigTest;
1133 if (native_os == .openbsd) return error.SkipZigTest;
11331134
11341135 const io = testing.io;
11351136
......@@ -1139,6 +1140,7 @@ test "openExecutable" {
11391140
11401141test "executablePath" {
11411142 if (native_os == .wasi) return error.SkipZigTest;
1143 if (native_os == .openbsd) return error.SkipZigTest;
11421144
11431145 const io = testing.io;
11441146 var buf: [Dir.max_path_bytes]u8 = undefined;
test/error_traces.zig+1
......@@ -439,6 +439,7 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
439439 .{ .powerpc64le, .linux },
440440 .{ .riscv64, .linux },
441441 .{ .s390x, .linux },
442 .{ .x86_64, .openbsd },
442443 .{ .x86_64, .windows },
443444 .{ .x86, .windows },
444445 .{ .x86_64, .macos },
test/standalone/libfuzzer/build.zig+1
......@@ -6,6 +6,7 @@ pub fn build(b: *std.Build) void {
66 const optimize = b.standardOptimizeOption(.{});
77
88 if (builtin.os.tag == .windows) return; // TODO: libfuzzer support for windows
9 if (builtin.os.tag == .openbsd) return; // https://codeberg.org/ziglang/zig/issues/30728
910
1011 const run_step = b.step("run", "Run executables");
1112 const exe = b.addExecutable(.{
test/standalone/self_exe_symlink/build.zig+2
......@@ -9,6 +9,8 @@ pub fn build(b: *std.Build) void {
99 const optimize: std.builtin.OptimizeMode = .Debug;
1010 const target = b.graph.host;
1111
12 if (target.result.os.tag == .openbsd) return; // realpath not supported
13
1214 const main = b.addExecutable(.{
1315 .name = "main",
1416 .root_module = b.createModule(.{