Skip to content

Commit 12949c3

Browse files
committed
Rebase net-snmp.yml workflow
1 parent 9b53f9a commit 12949c3

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,21 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
182182
echo "Error: sssd-test.log not found"
183183
exit 1
184184
fi
185+
# ----- NET-SNMP -----
186+
elif [ "$TEST_SUITE" = "net-snmp" ]; then
187+
if [ -f "tests/test.log" ]; then
188+
# Check if we have exactly 29 failed tests and a FAIL result
189+
if grep -q "We failed these 29 tests:" tests/test.log && grep -q "Result: FAIL" tests/test.log; then
190+
echo "PASS: net-snmp tests failed as expected with force fail enabled"
191+
exit 0
192+
else
193+
echo "FAIL: net-snmp tests unexpectedly succeeded with force fail enabled"
194+
exit 1
195+
fi
196+
else
197+
echo "Error: tests/test.log not found"
198+
exit 1
199+
fi
185200
# ----- NGINX -----
186201
elif [ "$TEST_SUITE" = "nginx" ]; then
187202
if [ -f "nginx-test.log" ]; then

.github/workflows/net-snmp.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Net-SNMP 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+
name: Build wolfProvider
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
23+
openssl_ref: [ 'openssl-3.5.0' ]
24+
steps:
25+
- name: Checkout wolfProvider
26+
uses: actions/checkout@v4
27+
28+
# Check if this version of wolfssl/wolfprovider has already been built,
29+
# mark to cache these items on post if we do end up building
30+
- name: Checking wolfSSL/wolfProvider in cache
31+
uses: actions/cache@v4
32+
id: wolfprov-cache
33+
with:
34+
path: |
35+
wolfssl-source
36+
wolfssl-install
37+
wolfprov-install
38+
provider.conf
39+
40+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
41+
lookup-only: true
42+
43+
# If wolfssl/wolfprovider have not yet been built, pull ossl from cache
44+
- name: Checking OpenSSL in cache
45+
if: steps.wolfprov-cache.outputs.cache-hit != 'true'
46+
uses: actions/cache@v4
47+
id: openssl-cache
48+
with:
49+
path: |
50+
openssl-source
51+
openssl-install
52+
53+
key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
54+
lookup-only: true
55+
56+
# If not yet built this version, build it now
57+
- name: Build wolfProvider
58+
if: steps.wolfprov-cache.outputs.cache-hit != 'true'
59+
run: |
60+
OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh
61+
62+
- name: Print errors
63+
if: ${{ failure() }}
64+
run: |
65+
if [ -f test-suite.log ] ; then
66+
cat test-suite.log
67+
fi
68+
69+
test_net_snmp:
70+
runs-on: ubuntu-22.04
71+
needs: build_wolfprovider
72+
# This should be a safe limit for the tests to run.
73+
timeout-minutes: 20
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
net_snmp_ref: ['v5.9.3']
78+
wolfssl_ref: ['master', 'v5.8.0-stable']
79+
openssl_ref: ['openssl-3.5.0']
80+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
81+
steps:
82+
- name: Checkout wolfProvider
83+
uses: actions/checkout@v4
84+
85+
- name: Retrieving OpenSSL from cache
86+
uses: actions/cache/restore@v4
87+
id: openssl-cache
88+
with:
89+
path: |
90+
openssl-source
91+
openssl-install
92+
93+
key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
94+
fail-on-cache-miss: true
95+
96+
- name: Retrieving wolfSSL/wolfProvider from cache
97+
uses: actions/cache/restore@v4
98+
id: wolfprov-cache
99+
with:
100+
path: |
101+
wolfssl-source
102+
wolfssl-install
103+
wolfprov-install
104+
provider.conf
105+
106+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
107+
fail-on-cache-miss: true
108+
109+
- name: Install dependencies
110+
run: |
111+
sudo apt-get update
112+
sudo apt-get install -y libperl-dev
113+
114+
- name: Build net-snmp with wolfProvider
115+
uses: wolfSSL/actions-build-autotools-project@v1
116+
with:
117+
repository: net-snmp/net-snmp
118+
ref: ${{ matrix.net_snmp_ref }}
119+
path: net-snmp
120+
configure: >-
121+
--disable-shared --with-openssl=$GITHUB_WORKSPACE/openssl-install
122+
--with-default-snmp-version="3" --with-sys-contact="@@no.where"
123+
--with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log"
124+
--with-persistent-directory="/var/net-snmp" LDFLAGS="-L$GITHUB_WORKSPACE/openssl-install/lib64 -lcrypto -lssl"
125+
CPPFLAGS="-I$GITHUB_WORKSPACE/openssl-install/include" LIBS="-lcrypto -lssl"
126+
check: false
127+
128+
- name: Run tests
129+
working-directory: net-snmp
130+
run: |
131+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
132+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
133+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
134+
export ${{ matrix.force_fail }}
135+
autoconf --version | grep -P '2\.\d\d' -o > dist/autoconf-version
136+
mkdir -p tests
137+
make -j test TESTOPTS="-e agentxperl" | tee tests/test.log || true
138+
TEST_RESULT=$?
139+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} net-snmp

0 commit comments

Comments
 (0)