Skip to content

Commit

Permalink
add memleak check into github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
joewpeterson committed Oct 14, 2024
1 parent 1743251 commit a8e9053
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/scripts/prep_valgrind_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash
echo "
check_return_code() {
if [ $? -ne 0 ]; then
echo \"Memory leak detected. Test Failed...\"
exit 1
fi
}
" > test_valgrind.sh

find . -iname "*.test" -type f | while IFS= read -r line; do
dirname=$(dirname "$line")
realname=$(basename "$line")
echo "cd ${dirname}; valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./${realname}; check_return_code; cd -" >> test_valgrind.sh
done
15 changes: 14 additions & 1 deletion .github/workflows/ContinuousIntegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,24 @@ jobs:
- name: mkdir bin
run: mkdir bin
- name: cmake
run: cmake -DPYTHON_EXECUTABLE=$(which python3) -D CMAKE_CXX_COMPILER=`which ${{matrix.cxx}}` -D CMAKE_BUILD_TYPE=${{matrix.build_type}} -D tools.tests=ON ..
run: cmake -DCMAKE_CXX_FLAGS="-gdwarf-4" -DPYTHON_EXECUTABLE=$(which python3) -D CMAKE_CXX_COMPILER=`which ${{matrix.cxx}}` -D CMAKE_BUILD_TYPE=${{matrix.build_type}} -D tools.tests=ON ..
working-directory: ./bin
- name: make
run: make -j2
working-directory: ./bin
- name: ctest
run: ctest -j2
working-directory: ./bin

- name: Setup Valgrind on Ubuntu
if: ${{matrix.os == 'ubuntu-22.04'}}
run: |
sudo apt-get install valgrind;
bash .github/scripts/prep_valgrind_test.sh
working-directory: .

- name: Run tests with Valgrind
if: ${{matrix.os == 'ubuntu-22.04'}}
run: |
bash test_valgrind.sh
working-directory: .

0 comments on commit a8e9053

Please sign in to comment.