From b4978bf4526cec342c20ee51825f15a7b93bbc1a Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 20:27:23 +0000 Subject: [PATCH 1/6] run header-check in CI --- .github/workflows/rust.yml | 6 ++++ Cargo.toml | 5 ++- tools/check_headers | 63 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100755 tools/check_headers diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c439f89dd..39a81e466 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,4 +50,10 @@ jobs: run: cargo build -p propolis-mock-server --verbose - name: Test Libraries run: cargo test --lib --verbose + - name: Run header-checks + run: | + GATE_REF="$(./tools/check_headers gate_ref)" + git clone --depth 1 --revision "$GATE_REF" \ + https://github.com/oxidecomputer/illumos-gate ../illumos-gate + ./tools/check_headers run ../illumos-gate diff --git a/Cargo.toml b/Cargo.toml index cfb47cc3a..a3c16a5ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,14 @@ default-members = [ "xtask", ] +# `header-check` crates are excluded because they require an external checkout +# of illumos-gate (perhaps even to a specific revision) to run. So, to support +# more Propolis-local development, exclude these and leave them for more +# specific tools (see `tools/check_headers`, which is used to run these in CI) exclude = [ "crates/bhyve-api/header-check", "crates/nvpair/header-check", "crates/viona-api/header-check", - "phd-tests/buildomat", ] # If one wants the 'dev' profile, but with "panic = abort" semantics, they diff --git a/tools/check_headers b/tools/check_headers new file mode 100755 index 000000000..1b5133654 --- /dev/null +++ b/tools/check_headers @@ -0,0 +1,63 @@ +#!/bin/bash +set -e + +# The ref that headers should be checked against. +# +# This should almost certainly be `stlouis`, as in the "stlouis" branch in the +# Oxide fork of illumos. You may want to change this for testing or development +# if your changes to Propolis track changes in the OS as well. +# +# As a default this ref should probably not change. +HEADER_CHECK_REF="stlouis" + +# Directories with `ctest2`-based `header-check` crates. This list should track +# the similar exclusions in `Cargo.toml`, and are described more there. +HEADER_CHECK_DIRS=( + crates/bhyve-api/header-check/ + crates/nvpair/header-check/ + crates/viona-api/header-check/ +) + +function usage() { + SCRIPTNAME="${0##*/}" + echo "usage:" + echo " $SCRIPTNAME run " + echo " run Propolis header-check tests against the provided gate checkout" + echo " $SCRIPTNAME gate_ref" + echo " print the illumos-gate ref headers should be checked against" +} + +function run_checks() { + export GATE_SRC="$1" + + if ! [ -d "$GATE_SRC" ]; then + echo "header-check was given non-existent \"$GATE_SRC\" as gate directory" + exit 1 + fi + + for checkdir in "${HEADER_CHECK_DIRS[@]}"; do + echo "RUNNING HEADER-CHECK FOR $checkdir" + (cd "$checkdir"; GATE_SRC="$GATE_SRC" cargo test) + done +} + +OP="$1" + +if [ -z "$1" ]; then + usage + exit 1; +fi + +case "$OP" in + "gate_ref" ) + echo "$HEADER_CHECK_REF" + ;; + "run" ) + GATE_DIR="$2" + run_checks "$GATE_DIR" + ;; + * ) + usage + exit 1 + ;; +esac From 97cc66e7f1237393f8a9f661cab1f8b0f94eb7f7 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 21:13:37 +0000 Subject: [PATCH 2/6] debug: there should be headers in here.. --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 39a81e466..fba8a11c2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -55,5 +55,6 @@ jobs: GATE_REF="$(./tools/check_headers gate_ref)" git clone --depth 1 --revision "$GATE_REF" \ https://github.com/oxidecomputer/illumos-gate ../illumos-gate + ls ../illumos-gate/usr/src/uts/intel/sys/ ./tools/check_headers run ../illumos-gate From f0025f6506a21d18e5bdf46ceaeccb71ce4cc3ab Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 21:28:14 +0000 Subject: [PATCH 3/6] what if this is a path traversal thing --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fba8a11c2..728eec616 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -54,7 +54,7 @@ jobs: run: | GATE_REF="$(./tools/check_headers gate_ref)" git clone --depth 1 --revision "$GATE_REF" \ - https://github.com/oxidecomputer/illumos-gate ../illumos-gate - ls ../illumos-gate/usr/src/uts/intel/sys/ - ./tools/check_headers run ../illumos-gate + https://github.com/oxidecomputer/illumos-gate ./illumos-gate + ls ./illumos-gate/usr/src/uts/intel/sys/ + ./tools/check_headers run ./illumos-gate From 24ffac0996fcddd34f07659ef00529b14bc31ec1 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 21:39:54 +0000 Subject: [PATCH 4/6] it's that i cd'd and broke the relative path --- .github/workflows/rust.yml | 5 ++--- tools/check_headers | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 728eec616..39a81e466 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -54,7 +54,6 @@ jobs: run: | GATE_REF="$(./tools/check_headers gate_ref)" git clone --depth 1 --revision "$GATE_REF" \ - https://github.com/oxidecomputer/illumos-gate ./illumos-gate - ls ./illumos-gate/usr/src/uts/intel/sys/ - ./tools/check_headers run ./illumos-gate + https://github.com/oxidecomputer/illumos-gate ../illumos-gate + ./tools/check_headers run ../illumos-gate diff --git a/tools/check_headers b/tools/check_headers index 1b5133654..ee3cbca6d 100755 --- a/tools/check_headers +++ b/tools/check_headers @@ -28,7 +28,7 @@ function usage() { } function run_checks() { - export GATE_SRC="$1" + export GATE_SRC="$(readlink -e $1)" if ! [ -d "$GATE_SRC" ]; then echo "header-check was given non-existent \"$GATE_SRC\" as gate directory" From c4aa15791bf2c2df018109666c414785d60576d9 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 22:16:47 +0000 Subject: [PATCH 5/6] needs illumos, make it bmat --- .github/buildomat/jobs/check-headers.sh | 24 ++++++++++++++++++++++++ .github/workflows/rust.yml | 7 ------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 .github/buildomat/jobs/check-headers.sh diff --git a/.github/buildomat/jobs/check-headers.sh b/.github/buildomat/jobs/check-headers.sh new file mode 100644 index 000000000..78707c7ed --- /dev/null +++ b/.github/buildomat/jobs/check-headers.sh @@ -0,0 +1,24 @@ +#!/bin/bash +#: +#: name = "header-check" +#: variety = "basic" +#: target = "helios-2.0" +#: rust_toolchain = true +#: + +# Run the various `header-check` tests across Propolis' crates. +# +# These tests are run on an illumos target for best fidelity: while the +# immediate struct and function definitions could in theory be analyzed +# anywhere, they may contain definitions that vary across target OSes. We must +# ensure, at a minimum, that FFI definitions are correct w.r.t these headers' +# interpretation on illumos. Anywhere else is just a convenience. + +set -e + +GATE_REF="$(./tools/check_headers gate_ref)" + +git clone --depth 1 --revision "$GATE_REF" \ + https://github.com/oxidecomputer/illumos-gate ./gate_src + +./tools/check_headers run ./gate_src diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 39a81e466..b70fb0e04 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,10 +50,3 @@ jobs: run: cargo build -p propolis-mock-server --verbose - name: Test Libraries run: cargo test --lib --verbose - - name: Run header-checks - run: | - GATE_REF="$(./tools/check_headers gate_ref)" - git clone --depth 1 --revision "$GATE_REF" \ - https://github.com/oxidecomputer/illumos-gate ../illumos-gate - ./tools/check_headers run ../illumos-gate - From 530e74b93383bbdb403b0196af03a0f6fd4c2155 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 13 Jan 2026 22:25:54 +0000 Subject: [PATCH 6/6] dont have the newest git yet --- .github/buildomat/jobs/check-headers.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/buildomat/jobs/check-headers.sh b/.github/buildomat/jobs/check-headers.sh index 78707c7ed..f961c2d7d 100644 --- a/.github/buildomat/jobs/check-headers.sh +++ b/.github/buildomat/jobs/check-headers.sh @@ -18,7 +18,11 @@ set -e GATE_REF="$(./tools/check_headers gate_ref)" -git clone --depth 1 --revision "$GATE_REF" \ - https://github.com/oxidecomputer/illumos-gate ./gate_src +# TODO: `--branch` is overly restrictive, but it's what we've got. In git 2.49 +# the --revision flag was added to `git-clone`, and can clone an arbitrary +# revision, which is more appropriate here. We might be tracking an arbitrary +# commit with some changes in illumos-gate that isn't yet merged, after all. +git clone --depth 1 --branch "$GATE_REF" \ + https://code.oxide.computer/illumos-gate ./gate_src ./tools/check_headers run ./gate_src