test/tools_common.sh: Add support for dumping list of tests.

Via new command line argument --list-tests.

Change-Id: I0f12d10b49c14f5f68aafd5bc45362b1ea4f361f
This commit is contained in:
Tom Finegan 2014-09-19 11:09:39 -07:00
parent c92abbc447
commit f34d728717

View File

@ -200,11 +200,11 @@ webm_io_available() {
[ "$(vpx_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes [ "$(vpx_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes
} }
# Filters strings from positional parameter one using the filter specified by # Filters strings from $1 using the filter specified by $2. Filter behavior
# positional parameter two. Filter behavior depends on the presence of a third # depends on the presence of $3. When $3 is present, strings that match the
# positional parameter. When parameter three is present, strings that match the # filter are excluded. When $3 is omitted, strings matching the filter are
# filter are excluded. When omitted, strings matching the filter are included. # included.
# The filtered string is echoed to stdout. # The filtered result is echoed to stdout.
filter_strings() { filter_strings() {
strings=${1} strings=${1}
filter=${2} filter=${2}
@ -253,6 +253,15 @@ run_tests() {
tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER}) tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER})
fi fi
# User requested test listing: Dump test names and return.
if [ "${VPX_TEST_LIST_TESTS}" = "yes" ]; then
for test_name in $tests_to_filter; do
echo ${test_name}
done
return
fi
# Combine environment and actual tests.
local tests_to_run="${env_tests} ${tests_to_filter}" local tests_to_run="${env_tests} ${tests_to_filter}"
check_git_hashes check_git_hashes
@ -283,6 +292,7 @@ cat << EOF
--prefix: Allows for a user specified prefix to be inserted before all test --prefix: Allows for a user specified prefix to be inserted before all test
programs. Grants the ability, for example, to run test programs programs. Grants the ability, for example, to run test programs
within valgrind. within valgrind.
--list-tests: List all test names and exit without actually running tests.
--verbose: Verbose output. --verbose: Verbose output.
When the --bin-path option is not specified the script attempts to use When the --bin-path option is not specified the script attempts to use
@ -342,6 +352,9 @@ while [ -n "$1" ]; do
--show-program-output) --show-program-output)
devnull= devnull=
;; ;;
--list-tests)
VPX_TEST_LIST_TESTS=yes
;;
*) *)
vpx_test_usage vpx_test_usage
exit 1 exit 1
@ -401,6 +414,7 @@ vlog "$(basename "${0%.*}") test configuration:
VP9_WEBM_FILE=${VP9_WEBM_FILE} VP9_WEBM_FILE=${VP9_WEBM_FILE}
VPX_TEST_EXE_SUFFIX=${VPX_TEST_EXE_SUFFIX} VPX_TEST_EXE_SUFFIX=${VPX_TEST_EXE_SUFFIX}
VPX_TEST_FILTER=${VPX_TEST_FILTER} VPX_TEST_FILTER=${VPX_TEST_FILTER}
VPX_TEST_LIST_TESTS=${VPX_TEST_LIST_TESTS}
VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}
VPX_TEST_PREFIX=${VPX_TEST_PREFIX} VPX_TEST_PREFIX=${VPX_TEST_PREFIX}
VPX_TEST_RAND=${VPX_TEST_RAND} VPX_TEST_RAND=${VPX_TEST_RAND}