Skip to content

Commit

Permalink
CI: Address sanitizer (#612)
Browse files Browse the repository at this point in the history
Add test without TPLs to run CI with the address sanitizer enabled

---------

Co-authored-by: Cody Balos <[email protected]>
  • Loading branch information
gardner48 and balos1 authored Dec 9, 2024
1 parent 0d43b7a commit 8028e9e
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 10 deletions.
10 changes: 9 additions & 1 deletion .github/actions/test-driver/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
indexsize:
description: SUNDIALS_INDEX_SIZE
required: true
tpls:
description: "enable/disable TPLs"
required: true

runs:
using: composite
Expand All @@ -26,5 +29,10 @@ runs:
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
cd test
./test_driver.sh --testtype CUSTOM --env env/docker.sh --tpls --sunrealtype ${{ inputs.precision }} --indexsize ${{ inputs.indexsize }}
./test_driver.sh \
--testtype CUSTOM \
--env env/docker.sh \
--tpls ${{ inputs.tpls }} \
--sunrealtype ${{ inputs.precision }} \
--indexsize ${{ inputs.indexsize }}
shell: bash
59 changes: 59 additions & 0 deletions .github/workflows/test-address-sanitizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
name: Build and Test - Ubuntu/gcc (Address Sanitizer)

on:
push:
branches:
- main
- develop
pull_request:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
sanitizer_build_and_test:
runs-on: ubuntu-latest
container:
image: ghcr.io/llnl/sundials-ci-int${{ matrix.indexsize }}-${{ matrix.precision }}:latest
options: --user root
strategy:
max-parallel: 2
matrix:
indexsize: [32, 64]
precision: ['double']
buildtype: ['Debug']
# Address sanitizer is enabled in test_driver.sh with TPLs OFF
tpls: ['OFF']

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Run test_driver.sh
uses: ./.github/actions/test-driver
with:
indexsize: ${{ matrix.indexsize }}
precision: ${{ matrix.precision }}
tpls: ${{ matrix.tpls }}
env:
CMAKE_BUILD_TYPE: ${{ matrix.buildtype }}
- name: Archive build files from failed build
uses: actions/upload-artifact@v4
if: failure()
with:
name: build_files
path: |
${{ github.workspace }}/test/build_*
!${{ github.workspace }}/test/build_*/Testing/output
- name: Archive output files from failed build
uses: actions/upload-artifact@v4
if: failure()
with:
name: output_files
path: |
${{ github.workspace }}/test/build_*/Testing/
2 changes: 2 additions & 0 deletions .github/workflows/ubuntu-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
# Disable extended tests until compiler warnings are addressed
precision: ['single', 'double']
buildtype: ['Debug', 'Release', 'RelWithDebInfo']
tpls: ['ON']
exclude:
- buildtype: Debug
precision: single
Expand All @@ -49,6 +50,7 @@ jobs:
with:
indexsize: ${{ matrix.indexsize }}
precision: ${{ matrix.precision }}
tpls: ${{ matrix.tpls }}
env:
CMAKE_BUILD_TYPE: ${{ matrix.buildtype }}
- name: Archive build files from failed build
Expand Down
30 changes: 21 additions & 9 deletions test/test_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ help ()
all -- create all possible tarballs
--sunrealtype TYPE
Real type precision to use in a custom test. TYPE must be one of:
Precision to use in a custom test. TYPE must be one of:
double -- (default) use double precision
single -- use single precision
Expand All @@ -83,8 +83,8 @@ help ()
shared -- build shared libraries
both -- build static and shared libraries
--tpls
Enable external third-party libraries in a custom test.
--tpls ON/OFF
Enable or disable external third-party libraries in a custom test.
--suntesttype TYPE
SUNDIALS test type for a custom test. TYPE must be one of:
Expand Down Expand Up @@ -126,7 +126,7 @@ help ()
$0
$0 --testtype release --buildjobs 4
$0 --phase CONFIG --indexsize 32 --tpls --env env/default.sh
$0 --phase CONFIG --indexsize 32 --tpls ON --env env/default.sh
EOF
}
Expand Down Expand Up @@ -270,8 +270,20 @@ while [[ $# -gt 0 ]]; do
shift 2;;

--tpls)
tpls="ON"
shift;;
tpls=$2
case "$tpls" in
ON|On|on)
tpls=ON
;;
OFF|Off|off)
tpls=OFF
;;
*)
echo "ERROR: Invalid tpl option $tpl"
help
exit 1;;
esac
shift 2;;

--suntesttype)
suntesttype=$2
Expand Down Expand Up @@ -384,7 +396,7 @@ case "$testtype" in
args_libtypes+=("static")
args_tpls+=("OFF")
args_suntests+=("DEV")
args_phase+=("BUILD")
args_phase+=("TEST")
done

# Basic development tests
Expand All @@ -409,7 +421,7 @@ case "$testtype" in
args_libtypes+=("static")
args_tpls+=("OFF")
args_suntests+=("DEV")
args_phase+=("BUILD")
args_phase+=("TEST")
done

# More development tests
Expand Down Expand Up @@ -441,7 +453,7 @@ case "$testtype" in
args_libtypes+=("static")
args_tpls+=("OFF")
args_suntests+=("DEV")
args_phase+=("BUILD")
args_phase+=("TEST")
done

# Even more development tests
Expand Down

0 comments on commit 8028e9e

Please sign in to comment.