Skip to content

Commit b3a602e

Browse files
committed
Add github workflow for unit tests with ASAN
1 parent eeab709 commit b3a602e

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

.github/workflows/asan.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Asan Test
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ "*" ]
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+
make_check:
17+
name: asan test
18+
runs-on: ubuntu-latest
19+
# This should be a safe limit for the tests to run.
20+
timeout-minutes: 10
21+
steps:
22+
- uses: actions/checkout@v4
23+
name: Checkout wolfProvider
24+
25+
- name: Test wolfProvider
26+
run: |
27+
WOLFPROV_CONFIG_CFLAGS="-static-libasan -fsanitize=address,undefined -g" ./scripts/build-wolfprovider.sh
28+
29+
- name: Print errors
30+
if: ${{ failure() }}
31+
run: |
32+
if [ -f test-suite.log ] ; then
33+
cat test-suite.log
34+
fi
35+

scripts/utils-wolfprovider.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ source ${SCRIPT_DIR}/utils-general.sh
2525

2626
WOLFPROV_SOURCE_DIR=${SCRIPT_DIR}/..
2727
WOLFPROV_INSTALL_DIR=${SCRIPT_DIR}/../wolfprov-install
28+
WOLFPROV_CONFIG_OPTS=${WOLFPROV_CONFIG_OPTS:-"--with-openssl=${OPENSSL_INSTALL_DIR} --with-wolfssl=${WOLFSSL_INSTALL_DIR} --prefix=${WOLFPROV_INSTALL_DIR}"}
29+
WOLFPROV_CONFIG_CFLAGS=${WOLFPROV_CONFIG_CFLAGS:-''}
2830
if [ "$WOLFSSL_ISFIPS" -eq "1" ] || [ -n "$WOLFSSL_FIPS_BUNDLE" ]; then
2931
WOLFPROV_CONFIG=${WOLFPROV_CONFIG:-"$WOLFPROV_SOURCE_DIR/provider-fips.conf"}
3032
else
@@ -50,13 +52,14 @@ install_wolfprov() {
5052
if [ ! -e "${WOLFPROV_SOURCE_DIR}/configure" ]; then
5153
./autogen.sh >>$LOG_FILE 2>&1
5254
fi
55+
5356
if [ "$WOLFPROV_DEBUG" = "1" ]; then
54-
./configure --with-openssl=${OPENSSL_INSTALL_DIR} --with-wolfssl=${WOLFSSL_INSTALL_DIR} --prefix=${WOLFPROV_INSTALL_DIR} --enable-debug >>$LOG_FILE 2>&1
55-
RET=$?
56-
else
57-
./configure --with-openssl=${OPENSSL_INSTALL_DIR} --with-wolfssl=${WOLFSSL_INSTALL_DIR} --prefix=${WOLFPROV_INSTALL_DIR} >>$LOG_FILE 2>&1
58-
RET=$?
57+
WOLFPROV_CONFIG_OPTS+=" --enable-debug"
5958
fi
59+
60+
./configure ${WOLFPROV_CONFIG_OPTS} CFLAGS="${WOLFPROV_CONFIG_CFLAGS}" >>$LOG_FILE 2>&1
61+
RET=$?
62+
6063
if [ $RET != 0 ]; then
6164
printf "\n\n...\n"
6265
tail -n 40 $LOG_FILE

test/test_rsa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ int test_rsa_get_params(void *data)
868868
BN_free(eCmd);
869869
BN_free(eRet);
870870
EVP_PKEY_free(pkey);
871+
EVP_PKEY_CTX_free(ctx);
871872
return err;
872873
}
873874

0 commit comments

Comments
 (0)