Skip to content

Commit

Permalink
(#554) Enhance test.sh to run a sub-set of tests named by their drivi…
Browse files Browse the repository at this point in the history
…ng function.

This commit now allows running as "test.sh <fn-name>" interface, where
the name of the driving function executing a batch of tests can be
run independently, without having to go through full execution of all
tests. This helps developers shorten their fix-dev-test cycle, especially
when validating quick-fixes for long-running tests, like ASAN / MSAN builds.
  • Loading branch information
gapisback committed Mar 22, 2023
1 parent a5c821c commit ea7203a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ function usage() {
echo "To run CI-regression tests : INCLUDE_SLOW_TESTS=true ./${Me}"
echo "To run nightly regression tests : RUN_NIGHTLY_TESTS=true ./${Me}"
echo "To run make build-and-test tests : RUN_MAKE_TESTS=true ./${Me}"
echo
echo "To run a smaller collection of slow running tests,
name the function that drives the test execution.
Examples:"
echo " INCLUDE_SLOW_TESTS=true ./test.sh run_btree_tests"
echo " INCLUDE_SLOW_TESTS=true ./test.sh run_splinter_functionality_tests"
echo " INCLUDE_SLOW_TESTS=true ./test.sh nightly_cache_perf_tests"
}

# ##################################################################
Expand Down Expand Up @@ -743,6 +750,24 @@ fi

# ---- Rest of the coverage runs included in CI test runs ----

# ------------------------------------------------------------------------
# Fast-path execution support. You can invoke this script specifying the
# name of one of the functions to execute a specific set of tests. If the
# function takes arguments, pass them on the command-line. This way, one
# can debug script changes to ensure that test-execution still works.
#
# Examples:
# INCLUDE_SLOW_TESTS=true ./test.sh run_btree_tests
# ------------------------------------------------------------------------
if [ $# -ge 1 ]; then

# shellcheck disable=SC2048
$*
record_elapsed_time ${testRunStartSeconds} "All Tests"
cat_exec_log_file
exit 0
fi

# Run all the unit-tests first, to get basic coverage
run_with_timing "Fast unit tests" "$BINDIR"/unit_test

Expand Down

0 comments on commit ea7203a

Please sign in to comment.