2016-01-15 11:19:24 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2016-01-15 11:35:35 -08:00
|
|
|
set -e
|
|
|
|
|
|
2016-01-15 11:19:24 -08:00
|
|
|
function usage {
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
USAGE
|
|
|
|
|
|
2016-08-29 11:51:47 -07:00
|
|
|
$0 [-dgGhv] [-f focus-string] [-s seed]
|
2016-01-15 11:19:24 -08:00
|
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
|
|
|
|
|
|
-h print this message
|
|
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
-a Compile C code with the Clang static analyzer
|
2017-06-14 13:28:03 -04:00
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
-l run only the corpus tests for the given language
|
2016-01-15 11:19:24 -08:00
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
-e run only the corpus tests whose name contain the given string
|
2016-01-15 11:19:24 -08:00
|
|
|
|
2016-08-29 11:51:47 -07:00
|
|
|
-s set the seed used to control random behavior
|
|
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
-d print parsing log to stderr
|
|
|
|
|
|
2017-12-28 12:41:23 -08:00
|
|
|
-D pipe tests' stderr to \`dot(1)\` to render an SVG log
|
2017-06-14 13:28:03 -04:00
|
|
|
|
2016-01-15 11:19:24 -08:00
|
|
|
EOF
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
export TREE_SITTER_TEST=1
|
|
|
|
|
export RUST_TEST_THREADS=1
|
|
|
|
|
export RUST_BACKTRACE=full
|
2017-06-27 15:44:58 -07:00
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
while getopts "bdl:e:s:gGhpvD" option; do
|
2016-01-15 11:19:24 -08:00
|
|
|
case ${option} in
|
|
|
|
|
h)
|
|
|
|
|
usage
|
|
|
|
|
exit
|
|
|
|
|
;;
|
2019-01-14 17:19:46 -08:00
|
|
|
l)
|
|
|
|
|
export TREE_SITTER_TEST_LANGUAGE_FILTER=${OPTARG}
|
2016-01-15 11:19:24 -08:00
|
|
|
;;
|
2019-01-14 17:19:46 -08:00
|
|
|
e)
|
|
|
|
|
export TREE_SITTER_TEST_EXAMPLE_FILTER=${OPTARG}
|
2016-01-15 11:19:24 -08:00
|
|
|
;;
|
|
|
|
|
s)
|
|
|
|
|
export TREE_SITTER_SEED=${OPTARG}
|
|
|
|
|
;;
|
2019-01-14 17:19:46 -08:00
|
|
|
d)
|
|
|
|
|
export TREE_SITTER_ENABLE_LOG=1
|
2016-08-29 11:51:47 -07:00
|
|
|
;;
|
2019-01-14 17:19:46 -08:00
|
|
|
D)
|
|
|
|
|
export TREE_SITTER_ENABLE_LOG_GRAPHS=1
|
2017-06-14 13:28:03 -04:00
|
|
|
;;
|
2016-01-15 11:19:24 -08:00
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
if [[ -n $TREE_SITTER_TEST_LANGUAGE_FILTER || -n $TREE_SITTER_TEST_EXAMPLE_FILTER ]]; then
|
|
|
|
|
top_level_filter=corpus
|
2016-11-18 13:47:31 -08:00
|
|
|
else
|
2019-01-14 17:19:46 -08:00
|
|
|
top_level_filter=$1
|
2016-11-18 13:47:31 -08:00
|
|
|
fi
|
|
|
|
|
|
2019-01-14 17:19:46 -08:00
|
|
|
cargo test --jobs 1 $top_level_filter -- --nocapture
|