2017-06-21 17:26:52 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
2017-07-05 17:27:32 -07:00
|
|
|
function usage {
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
USAGE
|
|
|
|
|
|
2019-02-01 14:39:37 -08:00
|
|
|
$0 [-h] [-l language-name] [-e example-file-name]
|
2017-07-05 17:27:32 -07:00
|
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
|
|
|
|
|
|
-h print this message
|
|
|
|
|
|
|
|
|
|
-l run only the benchmarks for the given language
|
|
|
|
|
|
2019-02-01 14:39:37 -08:00
|
|
|
-e run only the benchmarks that parse the example file with the given name
|
2017-07-06 10:22:14 -07:00
|
|
|
|
2017-07-05 17:27:32 -07:00
|
|
|
EOF
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-01 14:39:37 -08:00
|
|
|
while getopts "hl:e:" option; do
|
2017-06-21 17:26:52 -07:00
|
|
|
case ${option} in
|
2017-07-05 17:27:32 -07:00
|
|
|
h)
|
|
|
|
|
usage
|
|
|
|
|
exit
|
|
|
|
|
;;
|
2019-02-01 14:39:37 -08:00
|
|
|
e)
|
|
|
|
|
export TREE_SITTER_BENCHMARK_EXAMPLE_FILTER=${OPTARG}
|
2017-06-21 17:26:52 -07:00
|
|
|
;;
|
|
|
|
|
l)
|
2019-02-01 14:39:37 -08:00
|
|
|
export TREE_SITTER_BENCHMARK_LANGUAGE_FILTER=${OPTARG}
|
2017-07-06 10:22:14 -07:00
|
|
|
;;
|
2017-06-21 17:26:52 -07:00
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2019-02-01 14:39:37 -08:00
|
|
|
cargo bench
|