Unify test targets, use externally defined languages as fixtures
This commit is contained in:
parent
569b9d4099
commit
0f7dbea9a3
99 changed files with 602 additions and 91462 deletions
|
|
@ -1,92 +0,0 @@
|
|||
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 run only tests whose description contain the given string
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
local profile=
|
||||
local mode=normal
|
||||
local args=()
|
||||
local target=$1
|
||||
local cmd="out/Debug/${target}"
|
||||
shift
|
||||
|
||||
while getopts "df:s:ghpv" option; do
|
||||
case ${option} in
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
d)
|
||||
mode=debug
|
||||
;;
|
||||
g)
|
||||
mode=valgrind
|
||||
;;
|
||||
p)
|
||||
profile=true
|
||||
;;
|
||||
f)
|
||||
args+=("--only=${OPTARG}")
|
||||
;;
|
||||
v)
|
||||
args+=("--reporter=spec")
|
||||
;;
|
||||
s)
|
||||
export TREE_SITTER_SEED=${OPTARG}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
BUILDTYPE=Debug make $target
|
||||
args=${args:-""}
|
||||
|
||||
if [[ -n $profile ]]; then
|
||||
export CPUPROFILE=/tmp/${target}-$(date '+%s').prof
|
||||
fi
|
||||
|
||||
case ${mode} in
|
||||
valgrind)
|
||||
valgrind \
|
||||
--suppressions=./script/util/valgrind.supp \
|
||||
--dsymutil=yes \
|
||||
$cmd "${args[@]}" 2>&1 | \
|
||||
grep --color -E '\w+_specs?.cc:\d+|$'
|
||||
;;
|
||||
|
||||
debug)
|
||||
if which -s lldb; then
|
||||
lldb $cmd -- "${args[@]}"
|
||||
elif which -s gdb; then
|
||||
gdb $cmd -- "${args[@]}"
|
||||
else
|
||||
echo "No debugger found"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
normal)
|
||||
time $cmd "${args[@]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -n $profile ]]; then
|
||||
pprof $cmd $CPUPROFILE
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue