Skip to content

Commit e1b9b3a

Browse files
Bridger Vosspadelsbach
authored andcommitted
Github actions for hostap
1 parent 6cfe601 commit e1b9b3a

2 files changed

Lines changed: 413 additions & 0 deletions

File tree

.github/workflows/hostap-basic.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: hostap-uml-tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ '*' ] #'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfprovider:
17+
uses: ./.github/workflows/build-wolfprovider.yml
18+
with:
19+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
20+
openssl_ref: ${{ matrix.openssl_ref }}
21+
strategy:
22+
matrix:
23+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24+
openssl_ref: [ 'openssl-3.5.0' ]
25+
26+
uml-hwsim:
27+
runs-on: ubuntu-24.04
28+
needs: build_wolfprovider
29+
timeout-minutes: 60
30+
strategy:
31+
matrix:
32+
wolfssl_ref: [ 'v5.8.0-stable' ]
33+
openssl_ref: [ 'openssl-3.5.0' ]
34+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
35+
env:
36+
KVER: "6.6.41"
37+
KURL: "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.41.tar.xz"
38+
steps:
39+
- name: Checkout wolfProvider
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 1
43+
44+
# - name: Retrieving wolfProvider from cache
45+
# uses: actions/cache/restore@v4
46+
# id: wolfprov-cache-restore
47+
# with:
48+
# path: |
49+
# wolfssl-install
50+
# wolfprov-install
51+
# openssl-install/lib64
52+
# openssl-install/include
53+
# openssl-install/bin
54+
# key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
55+
# fail-on-cache-miss: true
56+
57+
- name: Build wolfprovider
58+
run: |
59+
OPENSSL_TAG=${{ inputs.openssl_ref }} WOLFSSL_TAG=${{ inputs.wolfssl_ref }} ./scripts/build-wolfprovider.sh --debug
60+
61+
- name: Install build deps for UML + tests
62+
run: |
63+
sudo apt-get update
64+
sudo apt-get install -y \
65+
build-essential git bc kmod python3 python3-pip python3-venv \
66+
libelf-dev libssl-dev flex bison zlib1g-dev libncurses5-dev \
67+
libnl-3-dev libnl-genl-3-dev \
68+
lcov binutils-dev libpcap-dev libcurl4-openssl-dev libiberty-dev \
69+
# libbfd for some tooling
70+
71+
- name: Fetch hostap (if not vendored)
72+
run: |
73+
test -d hostap || git clone https://w1.fi/hostap.git
74+
75+
- name: Cache UML kernel build (entire build tree)
76+
id: cache-kernel
77+
uses: actions/cache@v4
78+
with:
79+
path: hostap/tests/hwsim/vm/linux-${{ env.KVER }}
80+
key: uml-${{ runner.os }}-linux-${{ env.KVER }}-cfg-${{ hashFiles('hostap/tests/hwsim/vm/kernel-config.uml') }}
81+
restore-keys: |
82+
uml-${{ runner.os }}-linux-${{ env.KVER }}-
83+
84+
- name: Prepare kernel tree
85+
if: steps.cache-kernel.outputs.cache-hit != 'true'
86+
working-directory: hostap/tests/hwsim/vm
87+
run: |
88+
curl -L "$KURL" -o "linux-${KVER}.tar.xz"
89+
tar -xf "linux-${KVER}.tar.xz"
90+
91+
- name: Build UML kernel (time-travel capable)
92+
# Build in the *real* dir, not the symlink
93+
working-directory: hostap/tests/hwsim/vm/linux-${{ env.KVER }}
94+
run: |
95+
# Only refresh .config when it changed to keep incremental builds fast
96+
if [ ! -f .config ] || ! cmp -s ../kernel-config.uml .config; then
97+
cp ../kernel-config.uml .config
98+
fi
99+
ARCH=um make -j"$(nproc)"
100+
# Optional: show we actually have a built kernel
101+
ls -lh vmlinux || true
102+
103+
- name: Insert environment variables (no heredoc)
104+
working-directory: hostap/tests/hwsim
105+
run: |
106+
set -e
107+
source "$GITHUB_WORKSPACE/scripts/env-setup"
108+
[ -n "${{ matrix.force_fail }}" ] && export ${{ matrix.force_fail }}
109+
110+
# Skip if we've already injected
111+
if grep -q '^# injected OpenSSL provider env$' start.sh; then
112+
echo "start.sh already injected"
113+
exit 0
114+
fi
115+
116+
# Pre-quote values safely for shell
117+
conf=$(printf %q "$OPENSSL_CONF")
118+
mods=$(printf %q "$OPENSSL_MODULES")
119+
ldld=$(printf %q "${LD_LIBRARY_PATH:-}")
120+
ff=$(printf %q "${WOLFPROV_FORCE_FAIL:-}")
121+
122+
LOGDIR="${HWSIM_TEST_LOG_DIR:-/tmp/hwsim-test-logs}"
123+
124+
tmp="$(mktemp)"
125+
{
126+
printf '#!/usr/bin/env bash\n'
127+
printf '# injected OpenSSL provider env\n'
128+
printf 'export OPENSSL_CONF=%s\n' "$conf"
129+
printf 'export OPENSSL_MODULES=%s\n' "$mods"
130+
[ -n "${LD_LIBRARY_PATH:-}" ] && printf 'export LD_LIBRARY_PATH=%s\n' "$ldld"
131+
[ -n "${WOLFPROV_FORCE_FAIL:-}" ] && printf 'export WOLFPROV_FORCE_FAIL=%s\n' "$ff"
132+
printf '\n'
133+
printf 'sudo() { command sudo env OPENSSL_CONF=%s OPENSSL_MODULES=%s LD_LIBRARY_PATH=%s WOLFPROV_FORCE_FAIL=%s "$@"; }\n' "$conf" "$mods" "$ldld" "$ff"
134+
printf '\n'
135+
# show exactly what the VM sees + list providers
136+
printf 'echo "[VM] OPENSSL_CONF=$OPENSSL_CONF" >&2\n'
137+
printf 'echo "[VM] OPENSSL_MODULES=$OPENSSL_MODULES" >&2\n'
138+
printf 'openssl list -providers -verbose 2>&1 | tee "$LOGDIR/openssl_providers.txt"\n'
139+
printf '\n'
140+
cat start.sh
141+
} > "$tmp"
142+
install -m 0755 "$tmp" start.sh
143+
sed -n '1,20p' start.sh
144+
145+
- name: Sanity check
146+
run: |
147+
openssl list -providers -verbose || true
148+
149+
- name: Build hostap test binaries
150+
working-directory: hostap/tests/hwsim
151+
run: ./build.sh
152+
# hwsim test build instructions and quick-run example are in example-setup docs. :contentReference[oaicite:3]{index=3}
153+
154+
- name: Smoke tests inside UML
155+
working-directory: hostap/tests/hwsim/vm
156+
env:
157+
# Tell vm-run.sh where the kernel is
158+
KERNEL: ${{ github.workspace }}/hostap/tests/hwsim/vm/linux-${{ env.KVER }}/linux
159+
run: |
160+
# Run a tiny subset first; you can pass patterns or test names
161+
timeout 1m ./vm-run.sh --timeout 600 -- \
162+
ap_open ap_wpa2_psk p2p_device_discovery || true
163+
TEST_RESULT=${PIPESTATUS[0]}
164+
echo "Test result: $TEST_RESULT"
165+
166+
- name: TLS/EAP pack (will fail if provider blocks TLS)
167+
working-directory: hostap/tests/hwsim/vm
168+
env:
169+
KERNEL: ${{ github.workspace }}/hostap/tests/hwsim/vm/linux-${{ env.KVER }}/linux
170+
run: |
171+
timeout 5m ./vm-run.sh --timeout 1200 -- \
172+
ap_wpa2_eap_tls \
173+
ap_wpa2_eap_peap_eap_mschapv2 \
174+
ap_wpa2_eap_ttls_mschapv2 || true
175+
TEST_RESULT=${PIPESTATUS[0]}
176+
echo "Test result: $TEST_RESULT"
177+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} hostap
178+
179+
- name: Archive logs
180+
if: always()
181+
run: |
182+
mkdir -p artifacts
183+
cp -a /tmp/hwsim-test-logs/* artifacts/ || true
184+
continue-on-error: true
185+
186+
- name: Upload logs
187+
if: always()
188+
uses: actions/upload-artifact@v4
189+
with:
190+
name: hwsim-logs-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ matrix.force_fail }}
191+
path: artifacts

0 commit comments

Comments
 (0)