Skip to content

Commit 7216a7c

Browse files
Uses Valgrind for ExperimentalMemCheck in ctest
1 parent 33b3a45 commit 7216a7c

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.github/workflows/cmake.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,14 @@ jobs:
130130
- name: Checkout LAPACK
131131
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
132132

133+
- name: Install ninja-build tool
134+
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3
135+
133136
- name: Configure CMake
134137
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
135138
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
136139
run: >
137-
cmake -B build
140+
cmake -B build -G Ninja
138141
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
139142
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install
140143
-D CBLAS:BOOL=ON
@@ -181,4 +184,40 @@ jobs:
181184
-D BUILD_SHARED_LIBS:BOOL=ON
182185
183186
- name: Install
184-
run: cmake --build build --target install -j2
187+
run: cmake --build build --target install -j2
188+
189+
memory-check:
190+
runs-on: ubuntu-latest
191+
env:
192+
BUILD_TYPE: Debug
193+
FFLAGS: "-fopenmp"
194+
195+
steps:
196+
197+
- name: Checkout LAPACK
198+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
199+
200+
- name: Install ninja-build tool
201+
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3
202+
203+
- name: Install Valgrind
204+
run: |
205+
sudo apt update
206+
sudo apt install -y valgrind
207+
208+
- name: Configure CMake
209+
run: >
210+
cmake -B build -G Ninja
211+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
212+
-D CBLAS:BOOL=ON
213+
-D LAPACKE:BOOL=ON
214+
-D BUILD_TESTING:BOOL=ON
215+
-D LAPACKE_WITH_TMG:BOOL=ON
216+
-D BUILD_SHARED_LIBS:BOOL=ON
217+
218+
- name: Build
219+
run: cmake --build build --config ${{env.BUILD_TYPE}}
220+
221+
- name: Test
222+
working-directory: ${{github.workspace}}/build
223+
run: ctest -C ${{env.BUILD_TYPE}} --schedule-random -j2 --output-on-failure

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ if(_is_coverage_build)
4545
find_package(codecov)
4646
endif()
4747

48+
# Use valgrind if it is found
49+
find_program( MEMORYCHECK_COMMAND valgrind )
50+
if( MEMORYCHECK_COMMAND )
51+
message( STATUS "Found valgrind: ${MEMORYCHECK_COMMAND}" )
52+
set( MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full" )
53+
endif()
54+
4855
# By default test Fortran compiler complex abs and complex division
4956
option(TEST_FORTRAN_COMPILER "Test Fortran compiler complex abs and complex division" OFF)
5057
if( TEST_FORTRAN_COMPILER )

0 commit comments

Comments
 (0)