Skip to content

Commit a0c7023

Browse files
committed
Ensure use of local wolfSSL and OpenSSL when running unit tests
1 parent fb7ef2c commit a0c7023

File tree

5 files changed

+23
-40
lines changed

5 files changed

+23
-40
lines changed

.github/workflows/asan.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/openssl-version.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ jobs:
7777

7878
- name: Build and test wolfProvider
7979
run: |
80-
WOLFPROV_CONFIG_CFLAGS="-static-libasan -fsanitize=address,undefined -g" \
80+
OPENSSL_CFLAGS="-static-libasan -fsanitize=address,undefined -g" \
81+
OPENSSL_CXXFLAGS="-static-libasan -fsanitize=address,undefined -g" \
82+
OPENSSL_LDFLAGS="-fsanitize=address,undefined -static-libasan" \
8183
OPENSSL_TAG=${{ matrix.openssl_ref }} \
8284
WOLFSSL_TAG=${{ matrix.wolfssl_ref }} \
8385
./scripts/build-wolfprovider.sh

scripts/env-setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fi
6767
export OPENSSL_CONF="${OPENSSL_CONF:=$DEFAULT_PROVIDER_CONF}"
6868

6969
export OPENSSL_MODULES="${OPENSSL_MODULES:=$WOLFPROV_LIB_PATH}"
70-
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:=$OPENSSL_LIB_PATH/pkgconfig:$REPO_ROOT/libdefault-stub-install/lib}"
70+
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:=$OPENSSL_LIB_PATH/pkgconfig}"
7171

7272
# Other variables used by test scripts
7373
export WOLFPROV_PATH="${WOLFPROV_LIB_PATH}"

scripts/utils-openssl.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ OPENSSL_INSTALL_DIR=${SCRIPT_DIR}/../openssl-install
3232
OPENSSL_BIN=${OPENSSL_INSTALL_DIR}/bin/openssl
3333
OPENSSL_TEST=${OPENSSL_SOURCE_DIR}/test
3434
OPENSSL_LIB_DIRS="${OPENSSL_INSTALL_DIR}/lib:${OPENSSL_INSTALL_DIR}/lib64"
35+
OPENSSL_CFLAGS=${OPENSSL_CFLAGS:-""}
36+
OPENSSL_CXXFLAGS=${OPENSSL_CXXFLAGS:-""}
37+
OPENSSL_LDFLAGS=${OPENSSL_LDFLAGS:-""}
3538

3639
NUMCPU=${NUMCPU:-8}
3740
WOLFPROV_DEBUG=${WOLFPROV_DEBUG:-0}
@@ -227,6 +230,10 @@ install_openssl() {
227230
fi
228231
printf "Done.\n"
229232

233+
export CFLAGS="${OPENSSL_CFLAGS}"
234+
export CXXFLAGS="${OPENSSL_CXXFLAGS}"
235+
export LDFLAGS="${OPENSSL_LDFLAGS}"
236+
230237
printf "\tBuild OpenSSL ${OPENSSL_TAG} ... "
231238
make -j$NUMCPU >>$LOG_FILE 2>&1
232239
if [ $? != 0 ]; then

scripts/utils-wolfprovider.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ install_wolfprov() {
135135
if [ "$WOLFPROV_REPLACE_DEFAULT" = "1" ]; then
136136
printf "\tWARNING: Skipping tests in replace mode...\n"
137137
else
138+
# Add the staged library path to the LD_LIBRARY_PATH so paths can
139+
# resolve prior to running `make install` which creates wolfprov-install.
140+
# Note that .libs is removed when running `make clean`.
141+
export LD_LIBRARY_PATH="$SCRIPT_DIR/../.libs:$LD_LIBRARY_PATH"
142+
143+
# Setup the environment to ensure we use the local builds of wolfprov, wolfssl, and openssl.
144+
if ! source ${SCRIPT_DIR}/env-setup; then
145+
printf "\n\nError: Failed to source env-setup\n"
146+
do_cleanup
147+
exit 1
148+
fi
149+
138150
printf "\tTest wolfProvider ... "
139151
make test >>$LOG_FILE 2>&1
140152
if [ $? != 0 ]; then
@@ -174,9 +186,6 @@ init_wolfprov() {
174186
install_wolfprov
175187
fi
176188
printf "\twolfProvider installed in: ${WOLFPROV_INSTALL_DIR}\n"
177-
178-
export OPENSSL_MODULES=$WOLFPROV_PATH
179-
export OPENSSL_CONF=${WOLFPROV_CONFIG}
180189
fi
181190
}
182191

0 commit comments

Comments
 (0)