Skip to content

Commit 01a48e3

Browse files
authored
Merge pull request #162 from JeremiahM37/tcpdumpTest
tcpdump wolfProvider test
2 parents 3df7b3e + d153aa9 commit 01a48e3

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/scripts/check-workflow-result.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,21 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
256256
else
257257
echo "Error: liboauth2-test.log not found"
258258
fi
259+
# ----- TCPDUMP -----
260+
elif [ "$TEST_SUITE" = "tcpdump" ]; then
261+
if [ -f "tcpdump-test.log" ]; then
262+
# Check for expected 7 failed tests (ESP/crypto segfaults)
263+
if grep -q "7 tests failed" tcpdump-test.log; then
264+
echo "PASS: tcpdump tests failed as expected with force fail enabled (7 tests failed)"
265+
exit 0
266+
else
267+
echo "FAIL: tcpdump tests did not fail as expected (should have 7 failed tests)"
268+
exit 1
269+
fi
270+
else
271+
echo "Error: tcpdump-test.log not found"
272+
exit 1
273+
fi
259274
# ----- IPERF -----
260275
elif [ "$TEST_SUITE" = "iperf" ]; then
261276
IPERF_TEST_LOG="iperf-test.log"

.github/workflows/tcpdump.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: tcpdump Tests
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build_wolfprovider:
14+
uses: ./.github/workflows/build-wolfprovider.yml
15+
with:
16+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
17+
openssl_ref: ${{ matrix.openssl_ref }}
18+
strategy:
19+
matrix:
20+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
21+
openssl_ref: [ 'openssl-3.5.0' ]
22+
23+
test_tcpdump:
24+
runs-on: ubuntu-22.04
25+
needs: build_wolfprovider
26+
timeout-minutes: 15
27+
strategy:
28+
matrix:
29+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
30+
openssl_ref: [ 'openssl-3.5.0' ]
31+
tcpdump_ref: [ 'master', 'tcpdump-4.99.3' ]
32+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
33+
exclude:
34+
- tcpdump_ref: 'master'
35+
force_fail: 'WOLFPROV_FORCE_FAIL=1'
36+
37+
steps:
38+
- name: Checkout wolfProvider
39+
uses: actions/checkout@v4
40+
41+
- name: Retrieve OpenSSL from cache
42+
uses: actions/cache/restore@v4
43+
id: openssl-cache
44+
with:
45+
path: |
46+
openssl-source
47+
openssl-install
48+
key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
49+
fail-on-cache-miss: true
50+
51+
- name: Retrieve wolfSSL/wolfProvider from cache
52+
uses: actions/cache/restore@v4
53+
id: wolfprov-cache
54+
with:
55+
path: |
56+
wolfssl-source
57+
wolfssl-install
58+
wolfprov-install
59+
provider.conf
60+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
61+
fail-on-cache-miss: true
62+
63+
- name: Install test dependencies
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y build-essential flex bison autoconf libtool
67+
68+
- name: Checkout libpcap
69+
uses: actions/checkout@v4
70+
with:
71+
repository: the-tcpdump-group/libpcap
72+
path: libpcap_repo
73+
# Compiling tcpdump from source explicitly requires a built libpcap installation
74+
- name: Build and install libpcap
75+
working-directory: libpcap_repo
76+
run: |
77+
./autogen.sh
78+
./configure --prefix=$GITHUB_WORKSPACE/libpcap-install
79+
make -j$(nproc)
80+
make install
81+
82+
- name: Checkout tcpdump
83+
uses: actions/checkout@v4
84+
with:
85+
repository: the-tcpdump-group/tcpdump
86+
path: tcpdump_repo
87+
ref: ${{ matrix.tcpdump_ref }}
88+
89+
- name: Build and install tcpdump
90+
working-directory: tcpdump_repo
91+
run: |
92+
if [ -f ./autogen.sh ]; then
93+
./autogen.sh
94+
elif [ ! -f ./configure ]; then
95+
autoreconf -fiv
96+
fi
97+
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/libpcap-install/lib/pkgconfig:$PKG_CONFIG_CONFIG:$PKG_CONFIG_PATH
98+
./configure --prefix=$GITHUB_WORKSPACE/tcpdump-install --with-pcap=$GITHUB_WORKSPACE/libpcap-install
99+
make -j$(nproc)
100+
make install
101+
102+
- name: Run tcpdump tests
103+
working-directory: tcpdump_repo
104+
run: |
105+
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64:$GITHUB_WORKSPACE/libpcap-install/lib:$GITHUB_WORKSPACE/tcpdump-install/lib:$LD_LIBRARY_PATH"
106+
export OPENSSL_CONF="$GITHUB_WORKSPACE/provider.conf"
107+
export OPENSSL_MODULES="$GITHUB_WORKSPACE/wolfprov-install/lib"
108+
export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/openssl-install/lib64/pkgconfig:$GITHUB_WORKSPACE/libpcap-install/lib/pkgconfig:$PKG_CONFIG_PATH"
109+
export PATH="$GITHUB_WORKSPACE/tcpdump-install/sbin:$GITHUB_WORKSPACE/tcpdump-install/bin:$PATH"
110+
111+
export ${{ matrix.force_fail }}
112+
113+
echo "Checking OpenSSL providers:"
114+
$GITHUB_WORKSPACE/openssl-install/bin/openssl list -providers | tee provider-list.log
115+
grep libwolfprov provider-list.log || (echo "ERROR: libwolfprov not found in OpenSSL providers" && exit 1)
116+
117+
# Run tests
118+
make check 2>&1 | tee tcpdump-test.log
119+
TEST_RESULT=$?
120+
121+
if [ $TEST_RESULT -ne 0 ]; then
122+
grep -A2 -B2 "exit code\|failed\|FAILED" tcpdump-test.log || true
123+
fi
124+
125+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} tcpdump
126+

0 commit comments

Comments
 (0)