Skip to content

Commit

Permalink
Slightly more robust check for compute-sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
trevilo committed Jul 18, 2024
1 parent 8700daf commit ccc14d5
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test/cuda-memcheck.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,35 @@

TEST="cuda-memcheck"
RUNFILE="inputs/input.dtconst.2iters.cyl.ini"
LIBTOOL_RUN="../libtool --mode=execute"

setup() {
found=1

# if in path, use whatever compute-sanitizer we find
SANITIZER=$(type -P compute-sanitizer) || found=0

# if not in path, try /usr/local/cuda/bin
if [ $found -eq 0 ]; then
SANITIZER=$(type -P /usr/local/cuda/bin/compute-sanitizer) || found=-1
fi

# otherwise, give up and skip
if [ $found -eq -1 ]; then
SANITIZER=skip
fi
}

@test "[$TEST] verify cuda-memcheck detects known error" {
[ "x$SANITIZER" == "xskip" ] && skip "compute-sanitizer not found"
test -e ./badcuda
run /usr/local/cuda/bin/compute-sanitizer --error-exitcode 1 ./badcuda
run $SANITIZER --error-exitcode 1 ./badcuda
[[ "${status}" -eq 1 ]]
}

@test "[$TEST] run tps with input -> $RUNFILE under cuda-memcheck" {
[ "x$SANITIZER" == "xskip" ] && skip "compute-sanitizer not found"
test -s $RUNFILE

../libtool --mode=execute /usr/local/cuda/bin/compute-sanitizer --error-exitcode 1 ../src/tps --runFile $RUNFILE
$LIBTOOL_RUN $SANITIZER --error-exitcode 1 ../src/tps --runFile $RUNFILE
}

0 comments on commit ccc14d5

Please sign in to comment.