Add '--benchmarks' target to testing script.

This commit is contained in:
Sergio Benitez 2021-03-26 20:12:19 -07:00
parent 3119e6f453
commit 0be3b41687
2 changed files with 13 additions and 1 deletions

View File

@ -40,6 +40,7 @@ PROJECT_ROOT=$(relative "") || exit $?
CORE_ROOT=$(relative "core") || exit $?
CONTRIB_ROOT=$(relative "contrib") || exit $?
SITE_ROOT=$(relative "site") || exit $?
BENCHMARKS_ROOT=$(relative "benchmarks") || exit $?
# Root of project-like directories.
CORE_LIB_ROOT=$(relative "core/lib") || exit $?
@ -93,6 +94,7 @@ function print_environment() {
echo " CORE_ROOT: ${CORE_ROOT}"
echo " CONTRIB_ROOT: ${CONTRIB_ROOT}"
echo " SITE_ROOT: ${SITE_ROOT}"
echo " BENCHMARKS_ROOT: ${BENCHMARKS_ROOT}"
echo " CORE_LIB_ROOT: ${CORE_LIB_ROOT}"
echo " CORE_CODEGEN_ROOT: ${CORE_CODEGEN_ROOT}"
echo " CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}"

View File

@ -119,6 +119,15 @@ function test_default() {
popd > /dev/null 2>&1
}
function run_benchmarks() {
echo ":: Running benchmarks..."
pushd "${BENCHMARKS_ROOT}" > /dev/null 2>&1
$CARGO bench $@
popd > /dev/null 2>&1
}
if [[ $1 == +* ]]; then
CARGO="$CARGO $1"
shift
@ -126,7 +135,7 @@ fi
# The kind of test we'll be running.
TEST_KIND="default"
KINDS=("contrib" "core" "examples" "default" "all")
KINDS=("contrib" "benchmarks" "core" "examples" "default" "all")
if [[ " ${KINDS[@]} " =~ " ${1#"--"} " ]]; then
TEST_KIND=${1#"--"}
@ -157,6 +166,7 @@ case $TEST_KIND in
contrib) test_contrib $@ ;;
examples) test_examples $@ ;;
default) test_default $@ ;;
benchmarks) run_benchmarks $@ ;;
all)
test_default $@ & default=$!
test_examples $@ & examples=$!