Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 92 additions & 2 deletions .github/workflows/kernel-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#
# dynpriv-lint (fast gate)
# │
# ▼
# build (4 jobs: arch × mode)
# ├──────────────────────────────┐
# ▼ ▼
# build (4 jobs: arch × mode) macos-tests (2 jobs: arch)
# │
# ▼
# unit-tests (2 jobs: arch)
Expand Down Expand Up @@ -139,6 +140,95 @@ jobs:
fi
echo "Kernel ELF: $(ls -lh "$elf")"

# ============================================================================
# macOS Host Build + Unit Tests (arm64 runner, arch matrix)
# ============================================================================

macos-tests:
name: macos-tests (${{ matrix.arch }})
runs-on: macos-15
needs: dynpriv-lint
timeout-minutes: 45

strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Runner diagnostics
run: |
sw_vers
sysctl -n machdep.cpu.brand_string hw.ncpu hw.memsize
df -h / | tail -1

- name: Install build dependencies
run: |
make deps
brew install python@3.12

- name: Fetch Limine EFI binaries
run: make limine

- name: Cache musl sysroot
uses: actions/cache@v4
id: musl-cache
with:
path: userland/sysroot
key: macos-musl-sysroot-1.2.5-v2

- name: Build musl libc
if: steps.musl-cache.outputs.cache-hit != 'true'
run: make musl

- name: Cache libc++ sysroot
uses: actions/cache@v4
id: libcxx-cache
with:
path: |
userland/sysroot/x86_64/lib/libc++.a
userland/sysroot/x86_64/lib/libc++abi.a
userland/sysroot/x86_64/lib/libunwind.a
userland/sysroot/x86_64/include/c++
userland/sysroot/aarch64/lib/libc++.a
userland/sysroot/aarch64/lib/libc++abi.a
userland/sysroot/aarch64/lib/libunwind.a
userland/sysroot/aarch64/include/c++
key: macos-libcxx-sysroot-18.1.8-v2

- name: Build libc++
if: steps.libcxx-cache.outputs.cache-hit != 'true'
run: make libcxx

- name: Cache compiler-rt builtins
uses: actions/cache@v4
id: compiler-rt-cache
with:
path: |
userland/sysroot/x86_64/lib/libclang_rt.builtins-x86_64.a
userland/sysroot/aarch64/lib/libclang_rt.builtins-aarch64.a
key: macos-compiler-rt-builtins-18.1.8-v2

- name: Build compiler-rt builtins
if: steps.compiler-rt-cache.outputs.cache-hit != 'true'
run: make compiler-rt

- name: Run unit tests
env:
STLX_TEST_TIMEOUT: "300"
run: make test ARCH=${{ matrix.arch }} 2>&1 | tee test-log-macos-${{ matrix.arch }}.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing GNU timeout on macOS

High Severity · Logic Bug

The macos-tests job fails with a false timeout because the timeout command used in scripts/run_tests.sh isn't found. macOS doesn't have a native timeout utility, and although make deps installs GNU coreutils (as gtimeout), the workflow doesn't add the necessary gnubin directory to the PATH for it to be accessible.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2894467. Configure here.


- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: test-log-macos-${{ matrix.arch }}
path: test-log-macos-${{ matrix.arch }}.txt
if-no-files-found: ignore

# ============================================================================
# Unit Tests (arch matrix)
# ============================================================================
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Skip the host-side shared-module check when cross-compiling from a
non-Linux host. The check runs the build interpreter with PYTHONPATH
pointing into the cross-build tree, so importing its own dependencies
(e.g. math) can dlopen cross-built Linux ELF modules and crash on
macOS. On Linux hosts the check runs unchanged.

--- a/Tools/build/check_extension_modules.py
+++ b/Tools/build/check_extension_modules.py
@@ -18,6 +18,11 @@ Module information is parsed from several sources:

See --help for more information
"""
+import sys
+
+if not sys.platform.startswith("linux"):
+ raise SystemExit(0)
+
import argparse
import collections
import enum
Loading