65 lines
977 B
Bash
Executable file
65 lines
977 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
function usage {
|
|
cat <<-EOF
|
|
USAGE
|
|
|
|
$0 [-Ld] [-l language-name] [-f example-file-name]
|
|
|
|
OPTIONS
|
|
|
|
-h print this message
|
|
|
|
-l run only the benchmarks for the given language
|
|
|
|
-f run only the benchmarks that parse the file with the given name
|
|
|
|
-d run tests in a debugger (either lldb or gdb)
|
|
|
|
-L run benchmarks with parse logging turned on
|
|
|
|
EOF
|
|
}
|
|
|
|
if [ "$(uname -s)" == "Darwin" ]; then
|
|
export LINK="clang++ -fsanitize=address"
|
|
fi
|
|
|
|
mode=normal
|
|
export BUILDTYPE=Test
|
|
cmd=out/Test/benchmarks
|
|
|
|
while getopts "dhf:l:SL" option; do
|
|
case ${option} in
|
|
h)
|
|
usage
|
|
exit
|
|
;;
|
|
d)
|
|
mode=debug
|
|
;;
|
|
f)
|
|
export TREE_SITTER_BENCHMARK_FILE_NAME=${OPTARG}
|
|
;;
|
|
l)
|
|
export TREE_SITTER_BENCHMARK_LANGUAGE=${OPTARG}
|
|
;;
|
|
L)
|
|
export TREE_SITTER_BENCHMARK_LOG=1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
make -j2 benchmarks
|
|
|
|
case $mode in
|
|
debug)
|
|
lldb $cmd
|
|
;;
|
|
|
|
normal)
|
|
exec $cmd
|
|
;;
|
|
esac
|