1111 # make check — unit tests + examples against fwtpm_server
1212 # ----------------------------------------------------------------
1313 fwtpm-examples :
14- runs-on : ubuntu-latest
14+ runs-on : ${{ matrix.os || ' ubuntu-latest' }}
1515 strategy :
1616 fail-fast : false
1717 matrix :
@@ -148,6 +148,13 @@ jobs:
148148
149149 # Note: ASan / UBSan / LeakSan coverage moved to sanitizer.yml
150150
151+ # macOS: fwTPM with socket transport
152+ - name : fwtpm-macos-socket
153+ wolftpm_config : --enable-fwtpm --enable-swtpm --enable-debug
154+ wolfssl_config : --enable-wolftpm --enable-pkcallbacks --enable-keygen
155+ build_only : false
156+ os : macos-latest
157+
151158 steps :
152159 - name : Checkout wolfTPM
153160 uses : actions/checkout@v4
@@ -161,8 +168,12 @@ jobs:
161168 - name : Install tpm2-tools
162169 if : ${{ !matrix.build_only }}
163170 run : |
164- sudo apt-get update
165- sudo apt-get install -y tpm2-tools libtss2-tcti-mssim0
171+ if [ "$(uname)" = "Darwin" ]; then
172+ brew install tpm2-tools
173+ else
174+ sudo apt-get update
175+ sudo apt-get install -y tpm2-tools libtss2-tcti-mssim0
176+ fi
166177
167178 - name : Build wolfSSL
168179 working-directory : ./wolfssl
@@ -182,7 +193,9 @@ jobs:
182193 CC=${{ matrix.cc || 'gcc' }} eval ./configure $CONFIGURE_ARGS
183194 make
184195 sudo make install
185- sudo ldconfig
196+ if command -v ldconfig >/dev/null 2>&1; then
197+ sudo ldconfig
198+ fi
186199
187200 - name : Build wolfTPM
188201 run : |
@@ -208,7 +221,17 @@ jobs:
208221 if : ${{ !matrix.build_only }}
209222 env :
210223 WOLFSSL_PATH : ./wolfssl
211- run : make check
224+ run : |
225+ if command -v unshare >/dev/null 2>&1; then
226+ FWTPM_USE_FIXED_PORT=1 \
227+ unshare --user --net --map-root-user /bin/bash -c '
228+ set -e
229+ ip link set lo up
230+ make check
231+ '
232+ else
233+ make check
234+ fi
212235
213236 - name : Print test-suite.log on failure
214237 if : ${{ failure() && !matrix.build_only }}
@@ -404,27 +427,23 @@ jobs:
404427 CFLAGS="${{ matrix.extra_cflags }} -g -O1"
405428 make
406429
407- - name : Start fwtpm_server
408- run : |
409- rm -f fwtpm_nv.bin
410- ./src/fwtpm/fwtpm_server > /tmp/fwtpm_server.log 2>&1 &
411- echo $! > /tmp/fwtpm_server.pid
412- sleep 1
413- kill -0 $(cat /tmp/fwtpm_server.pid)
414-
415430 - name : Run unit.test under valgrind
416431 run : |
417- valgrind --error-exitcode=1 --leak-check=full \
418- --errors-for-leak-kinds=definite \
419- --show-leak-kinds=definite \
420- ./tests/unit.test
421-
422- - name : Stop fwtpm_server
423- if : always()
424- run : |
425- if [ -f /tmp/fwtpm_server.pid ]; then
426- kill $(cat /tmp/fwtpm_server.pid) 2>/dev/null || true
427- fi
432+ unshare --user --net --map-root-user /bin/bash -c '
433+ ip link set lo up
434+ rm -f fwtpm_nv.bin
435+ ./src/fwtpm/fwtpm_server > /tmp/fwtpm_server.log 2>&1 &
436+ SERVER_PID=$!
437+ sleep 1
438+ kill -0 $SERVER_PID
439+ valgrind --error-exitcode=1 --leak-check=full \
440+ --errors-for-leak-kinds=definite \
441+ --show-leak-kinds=definite \
442+ ./tests/unit.test
443+ RC=$?
444+ kill $SERVER_PID 2>/dev/null || true
445+ exit $RC
446+ '
428447
429448 - name : Upload failure logs
430449 if : failure()
0 commit comments