Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/scripts/check-workflow-result.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
echo "Error: sssd-test.log not found"
exit 1
fi
# ----- NET-SNMP -----
elif [ "$TEST_SUITE" = "net-snmp" ]; then
if [ -f "tests/test.log" ]; then
# Check if we have exactly 29 failed tests and a FAIL result
if grep -q "We failed these 29 tests:" tests/test.log && grep -q "Result: FAIL" tests/test.log; then
echo "PASS: net-snmp tests failed as expected with force fail enabled"
exit 0
else
echo "FAIL: net-snmp tests unexpectedly succeeded with force fail enabled"
exit 1
fi
else
echo "Error: tests/test.log not found"
exit 1
fi
# ----- NGINX -----
elif [ "$TEST_SUITE" = "nginx" ]; then
if [ -f "nginx-test.log" ]; then
Expand Down
139 changes: 139 additions & 0 deletions .github/workflows/net-snmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Net-SNMP Tests

# START OF COMMON SECTION
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# END OF COMMON SECTION

jobs:
build_wolfprovider:
name: Build wolfProvider
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
matrix:
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
openssl_ref: [ 'openssl-3.5.0' ]
steps:
- name: Checkout wolfProvider
uses: actions/checkout@v4

# Check if this version of wolfssl/wolfprovider has already been built,
# mark to cache these items on post if we do end up building
- name: Checking wolfSSL/wolfProvider in cache
uses: actions/cache@v4
id: wolfprov-cache
with:
path: |
wolfssl-source
wolfssl-install
wolfprov-install
provider.conf

key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
lookup-only: true

# If wolfssl/wolfprovider have not yet been built, pull ossl from cache
- name: Checking OpenSSL in cache
if: steps.wolfprov-cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: openssl-cache
with:
path: |
openssl-source
openssl-install

key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
lookup-only: true

# If not yet built this version, build it now
- name: Build wolfProvider
if: steps.wolfprov-cache.outputs.cache-hit != 'true'
run: |
OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh

- name: Print errors
if: ${{ failure() }}
run: |
if [ -f test-suite.log ] ; then
cat test-suite.log
fi

test_net_snmp:
runs-on: ubuntu-22.04
needs: build_wolfprovider
# This should be a safe limit for the tests to run.
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
net_snmp_ref: ['v5.9.3']
wolfssl_ref: ['master', 'v5.8.0-stable']
openssl_ref: ['openssl-3.5.0']
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
steps:
- name: Checkout wolfProvider
uses: actions/checkout@v4

- name: Retrieving OpenSSL from cache
uses: actions/cache/restore@v4
id: openssl-cache
with:
path: |
openssl-source
openssl-install

key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Retrieving wolfSSL/wolfProvider from cache
uses: actions/cache/restore@v4
id: wolfprov-cache
with:
path: |
wolfssl-source
wolfssl-install
wolfprov-install
provider.conf

key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libperl-dev

- name: Build net-snmp with wolfProvider
uses: wolfSSL/actions-build-autotools-project@v1
with:
repository: net-snmp/net-snmp
ref: ${{ matrix.net_snmp_ref }}
path: net-snmp
configure: >-
--disable-shared --with-openssl=$GITHUB_WORKSPACE/openssl-install
--with-default-snmp-version="3" --with-sys-contact="@@no.where"
--with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log"
--with-persistent-directory="/var/net-snmp" LDFLAGS="-L$GITHUB_WORKSPACE/openssl-install/lib64 -lcrypto -lssl"
CPPFLAGS="-I$GITHUB_WORKSPACE/openssl-install/include" LIBS="-lcrypto -lssl"
check: false

- name: Run tests
working-directory: net-snmp
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
export ${{ matrix.force_fail }}
autoconf --version | grep -P '2\.\d\d' -o > dist/autoconf-version
mkdir -p tests
make -j test TESTOPTS="-e agentxperl" | tee tests/test.log || true
TEST_RESULT=$?
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} net-snmp