run_valgrind.sh 1.81 KB
Newer Older
1
2
#!/bin/bash

3
4
5
6
7
8
9
10
# Assumes current path is MOREFEM_ROOT to use this script.

# Utility function used at the end of each Valgrind run.
function printDone()
{
    echo "Memcheck done for $1, output file $2 written."
}

11
12
13
# arg1: executable, arg2: lua input, arg3: memcheck_output_file
function runValgrind()
{
14
15
16
17
18
19
    EXECUTABLE="Sources/$1"
    OUTPUT="${MOREFEM_ROOT}/$3"
    
    valgrind --error-exitcode=1 --log-file=$OUTPUT --gen-suppressions=all --show-leak-kinds=all --show-reachable=yes --track-origins=yes --leak-check=full --errors-for-leak-kinds=all --suppressions=../ExternalTools/Valgrind/openmpi.suppr --suppressions=../ExternalTools/Valgrind/libgomp.suppr --suppressions=../ExternalTools/Valgrind/libc.suppr $EXECUTABLE -i $2 -e MOREFEM_RESULT_DIR=${PWD}
    
    printDone $EXECUTABLE $3
20
21
22
23
24
25
26
27
28
29
}

export MOREFEM_ROOT=${PWD}

mkdir -p build_4_valgrind

cd build_4_valgrind && python ../cmake/Scripts/configure_cmake.py --cache_file=../cmake/PreCache/linux.cmake --cmake_args="-G Ninja"  --third_party_directory=/opt --mode="debug"

ninja

30
31
32
33
34
35
36
37
38
runValgrind MoReFEMTestPetscMatrixOperations ../Sources/Test/ThirdParty/PETSc/MatrixOperations/demo.lua memcheck_matrix_operations.txt

runValgrind MoReFEM4Elasticity ../Sources/ModelInstances/Elasticity/demo_2d_binary.lua memcheck_elasticity.txt

runValgrind MoReFEM4Heat ../Sources/ModelInstances/Heat/demo_input_heat.lua memcheck_heat.txt

runValgrind MoReFEM4Hyperelasticity ../Sources/ModelInstances/Hyperelasticity/demo_input_hyperelasticity.lua memcheck_hyperelasticity.txt

runValgrind MoReFEM4Laplacian ../Sources/ModelInstances/Laplacian/demo_input_laplacian.lua memcheck_laplacian.txt
39

40
runValgrind MoReFEM4RivlinCube ../Sources/ModelInstances/RivlinCube/demo_input_rivlin_cube_hexahedra.lua memcheck_rivlin_cube.txt
41

42
runValgrind MoReFEM4Stokes ../Sources/ModelInstances/Stokes/demo.lua memcheck_stokes.txt