Skip to content

Commit

Permalink
add UndefinedBehavior sanitize
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF committed Oct 8, 2024
1 parent f85c15b commit 3b9e100
Showing 1 changed file with 99 additions and 1 deletion.
100 changes: 99 additions & 1 deletion .github/workflows/cmake-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ jobs:
- name: Run ctest (Linux_Address)
run: |
cd "${{ runner.workspace }}/hdf5"
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-LEAK,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-ADDR,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
shell: bash
continue-on-error: true

Expand All @@ -313,3 +313,101 @@ jobs:
name: address-ubuntu-log
path: ${{ runner.workspace }}/hdf5/hdf5.log
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

build_and_test_linux_UndefinedBehaviorSanitizer:
# Linux (Ubuntu) w/ clang + UndefinedBehaviorSanitizer
#
name: "Ubuntu Clang UndefinedBehaviorSanitizer"
runs-on: ubuntu-latest
steps:
- name: Install CMake Dependencies (Linux_UndefinedBehavior)
run: |
sudo apt update
sudo apt-get install ninja-build doxygen graphviz curl libncurses5
- name: add clang to env
uses: KyleMayes/install-llvm-action@v2.0.5
id: setup-clang
with:
env: true
version: '18'

- name: Set file base name (Linux_UndefinedBehavior)
id: set-file-base
run: |
FILE_NAME_BASE=$(echo "${{ inputs.file_base }}")
echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT
if [[ '${{ inputs.use_environ }}' == 'release' ]]
then
SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}")
else
SOURCE_NAME_BASE=$(echo "hdfsrc")
fi
echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT
# Get files created by release script
- name: Get tgz-tarball (Linux_UndefinedBehavior)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: tgz-tarball
path: ${{ github.workspace }}

- name: List files for the space (Linux_UndefinedBehavior)
run: |
ls -l ${{ github.workspace }}
ls ${{ runner.workspace }}
- name: Uncompress source (Linux_UndefinedBehavior)
run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz

- name: Copy script files for the space (Linux_UndefinedBehavior)
run: |
cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf5
cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake ${{ runner.workspace }}/hdf5
- name: List files for the hdf5 (Linux_UndefinedBehavior)
run: |
ls ${{ runner.workspace }}/hdf5
- name: Create options file (Linux_UndefinedBehavior)
uses: "DamianReeves/write-file-action@master"
with:
path: ${{ runner.workspace }}/hdf5/HDF5options.cmake
write-mode: overwrite
contents: |
set (CTEST_DROP_SITE_INIT "my.cdash.org")
# Change following line to submit to your CDash dashboard to a different CDash project
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
#set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
set (LOCAL_MEMCHECK_TEST "TRUE")
set (CTEST_MEMORYCHECK_TYPE "UndefinedBehaviorSanitizer")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_STATIC_LIBS:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SANITIZERS:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DUSE_SANITIZER:STRING=Undefined")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF")
- name: Run ctest (Linux_UndefinedBehavior)
run: |
cd "${{ runner.workspace }}/hdf5"
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-UNDEF,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
shell: bash
continue-on-error: true

# Save log files created by ctest script
- name: Save log (Linux_UndefinedBehavior)
uses: actions/upload-artifact@v4
with:
name: undefined-ubuntu-log
path: ${{ runner.workspace }}/hdf5/hdf5.log
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

0 comments on commit 3b9e100

Please sign in to comment.