Skip to content

Commit 62e9a3a

Browse files
committed
run header-check in CI
1 parent ff31c52 commit 62e9a3a

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

.github/workflows/rust.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@ jobs:
5050
run: cargo build -p propolis-mock-server --verbose
5151
- name: Test Libraries
5252
run: cargo test --lib --verbose
53+
- name: Run header-checks
54+
run: |
55+
GATE_REF="$(./tools/check_headers.sh gate_ref)"
56+
git clone --depth 1 --revision "$GATE_REF" \
57+
https://github.com/oxidecomputer/illumos-gate ../illumos-gate
58+
./tools/check_headers.sh run ../illumos-gate
5359

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ default-members = [
2222
"xtask",
2323
]
2424

25+
# `header-check` crates are excluded because they require an external checkout
26+
# of illumos-gate (perhaps even to a specific revision) to run. So, to support
27+
# more Propolis-local development, exclude these and leave them for more
28+
# specific tools (see `tools/check_headers`, which is used to run these in CI)
2529
exclude = [
2630
"crates/bhyve-api/header-check",
2731
"crates/nvpair/header-check",
2832
"crates/viona-api/header-check",
29-
"phd-tests/buildomat",
3033
]
3134

3235
# If one wants the 'dev' profile, but with "panic = abort" semantics, they

tools/check_headers

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# The ref that headers should be checked against.
5+
#
6+
# This should almost certainly be `stlouis`, as in the "stlouis" branch in the
7+
# Oxide fork of illumos. You may want to change this for testing or development
8+
# if your changes to Propolis track changes in the OS as well.
9+
#
10+
# As a default this ref should probably not change.
11+
HEADER_CHECK_REF="stlouis"
12+
13+
# Directories with `ctest2`-based `header-check` crates. This list should track
14+
# the similar exclusions in `Cargo.toml`, and are described more there.
15+
HEADER_CHECK_DIRS=(
16+
crates/bhyve-api/header-check/
17+
crates/nvpair/header-check/
18+
crates/viona-api/header-check/
19+
)
20+
21+
function usage() {
22+
SCRIPTNAME="${0##*/}"
23+
echo "usage:"
24+
echo " $SCRIPTNAME run <gate_src_dir>"
25+
echo " run Propolis header-check tests against the provided gate checkout"
26+
echo " $SCRIPTNAME gate_ref"
27+
echo " print the illumos-gate ref headers should be checked against"
28+
}
29+
30+
function run_checks() {
31+
export GATE_SRC="$1"
32+
33+
if ! [ -d "$GATE_SRC" ]; then
34+
echo "header-check was given non-existent \"$GATE_SRC\" as gate directory"
35+
exit 1
36+
fi
37+
38+
for checkdir in "${HEADER_CHECK_DIRS[@]}"; do
39+
echo "RUNNING HEADER-CHECK FOR $checkdir"
40+
(cd "$checkdir"; GATE_SRC="$GATE_SRC" cargo test)
41+
done
42+
}
43+
44+
OP="$1"
45+
46+
if [ -z "$1" ]; then
47+
usage
48+
exit 1;
49+
fi
50+
51+
case "$OP" in
52+
"gate_ref" )
53+
echo "$HEADER_CHECK_REF"
54+
;;
55+
"run" )
56+
GATE_DIR="$2"
57+
run_checks "$GATE_DIR"
58+
;;
59+
* )
60+
usage
61+
exit 1
62+
;;
63+
esac

0 commit comments

Comments
 (0)