Make valgrind part of test scripts
This commit is contained in:
parent
c5ac02c571
commit
ccbf4fb5da
4 changed files with 46 additions and 18 deletions
|
|
@ -2,6 +2,5 @@
|
|||
|
||||
set -e -u
|
||||
|
||||
make compiler_specs
|
||||
source `dirname $0`/util/run_tests.sh
|
||||
run_tests out/Default/compiler_specs "$@"
|
||||
run_tests compiler_specs "$@"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,5 @@
|
|||
|
||||
set -e -u
|
||||
|
||||
make runtime_specs
|
||||
source `dirname $0`/util/run_tests.sh
|
||||
run_tests out/Default/runtime_specs "$@"
|
||||
run_tests runtime_specs "$@"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,38 @@
|
|||
function usage {
|
||||
cat <<-EOF
|
||||
USAGE
|
||||
|
||||
$0 [-dghv] [-f focus-string]
|
||||
|
||||
OPTIONS
|
||||
|
||||
-h print this message
|
||||
|
||||
-d run tests in a debugger (either lldb or gdb)
|
||||
|
||||
-g run tests with valgrind
|
||||
|
||||
-v run tests with verbose output
|
||||
|
||||
-f focus tests to those containing the substring
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
local cmd=$1
|
||||
local debug
|
||||
local args
|
||||
local valgrind
|
||||
local target=$1
|
||||
local cmd="out/Default/${target}"
|
||||
shift
|
||||
|
||||
local debug=
|
||||
local args=
|
||||
|
||||
while getopts "dvf:" option; do
|
||||
while getopts "hdgvf:" option; do
|
||||
case ${option} in
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
d)
|
||||
debug=true
|
||||
;;
|
||||
|
|
@ -16,13 +42,22 @@ function run_tests {
|
|||
v)
|
||||
args="$args --reporter=spec"
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
g)
|
||||
valgrind=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n $debug ]]; then
|
||||
make $target
|
||||
|
||||
if [[ -n $valgrind ]]; then
|
||||
eval valgrind \
|
||||
--suppressions=./etc/valgrind.supp \
|
||||
--dsymutil=yes \
|
||||
$cmd \
|
||||
$args
|
||||
|
||||
elif [[ -n $debug ]]; then
|
||||
if which -s gdb; then
|
||||
eval gdb $cmd -- $args
|
||||
elif which -s lldb; then
|
||||
|
|
@ -31,6 +66,7 @@ function run_tests {
|
|||
echo "No debugger found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
eval time $cmd $args
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
valgrind $@ \
|
||||
--suppressions=./etc/valgrind.supp \
|
||||
--dsymutil=yes \
|
||||
out/Default/runtime_specs
|
||||
Loading…
Add table
Add a link
Reference in a new issue