OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 ## | 2 ## |
3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
4 ## | 4 ## |
5 ## Use of this source code is governed by a BSD-style license | 5 ## Use of this source code is governed by a BSD-style license |
6 ## that can be found in the LICENSE file in the root of the source | 6 ## that can be found in the LICENSE file in the root of the source |
7 ## tree. An additional intellectual property rights grant can be found | 7 ## tree. An additional intellectual property rights grant can be found |
8 ## in the file PATENTS. All contributing project authors may | 8 ## in the file PATENTS. All contributing project authors may |
9 ## be found in the AUTHORS file in the root of the source tree. | 9 ## be found in the AUTHORS file in the root of the source tree. |
10 ## | 10 ## |
11 ## This file contains shell code shared by test scripts for libvpx tools. | 11 ## This file contains shell code shared by test scripts for libvpx tools. |
12 | 12 |
13 # Use $VPX_TEST_TOOLS_COMMON_SH as a pseudo include guard. | 13 # Use $VPX_TEST_TOOLS_COMMON_SH as a pseudo include guard. |
14 if [ -z "${VPX_TEST_TOOLS_COMMON_SH}" ]; then | 14 if [ -z "${VPX_TEST_TOOLS_COMMON_SH}" ]; then |
15 VPX_TEST_TOOLS_COMMON_SH=included | 15 VPX_TEST_TOOLS_COMMON_SH=included |
16 | 16 |
17 set -e | 17 set -e |
18 devnull='> /dev/null 2>&1' | 18 devnull='> /dev/null 2>&1' |
19 | 19 |
| 20 elog() { |
| 21 echo "$@" 1>&2 |
| 22 } |
| 23 |
20 vlog() { | 24 vlog() { |
21 if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then | 25 if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then |
22 echo "$@" | 26 echo "$@" |
23 fi | 27 fi |
24 } | 28 } |
25 | 29 |
26 # Sets $VPX_TOOL_TEST to the name specified by positional parameter one. | 30 # Sets $VPX_TOOL_TEST to the name specified by positional parameter one. |
27 test_begin() { | 31 test_begin() { |
28 VPX_TOOL_TEST="${1}" | 32 VPX_TOOL_TEST="${1}" |
29 } | 33 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 filtered_strings="${strings}" | 299 filtered_strings="${strings}" |
296 fi | 300 fi |
297 echo "${filtered_strings}" | 301 echo "${filtered_strings}" |
298 } | 302 } |
299 | 303 |
300 # Runs user test functions passed via positional parameters one and two. | 304 # Runs user test functions passed via positional parameters one and two. |
301 # Functions in positional parameter one are treated as environment verification | 305 # Functions in positional parameter one are treated as environment verification |
302 # functions and are run unconditionally. Functions in positional parameter two | 306 # functions and are run unconditionally. Functions in positional parameter two |
303 # are run according to the rules specified in vpx_test_usage(). | 307 # are run according to the rules specified in vpx_test_usage(). |
304 run_tests() { | 308 run_tests() { |
305 env_tests="verify_vpx_test_environment ${1}" | 309 local env_tests="verify_vpx_test_environment $1" |
306 tests_to_filter="${2}" | 310 local tests_to_filter="$2" |
| 311 local test_name="${VPX_TEST_NAME}" |
| 312 |
| 313 if [ -z "${test_name}" ]; then |
| 314 test_name="$(basename "${0%.*}")" |
| 315 fi |
307 | 316 |
308 if [ "${VPX_TEST_RUN_DISABLED_TESTS}" != "yes" ]; then | 317 if [ "${VPX_TEST_RUN_DISABLED_TESTS}" != "yes" ]; then |
309 # Filter out DISABLED tests. | 318 # Filter out DISABLED tests. |
310 tests_to_filter=$(filter_strings "${tests_to_filter}" ^DISABLED exclude) | 319 tests_to_filter=$(filter_strings "${tests_to_filter}" ^DISABLED exclude) |
311 fi | 320 fi |
312 | 321 |
313 if [ -n "${VPX_TEST_FILTER}" ]; then | 322 if [ -n "${VPX_TEST_FILTER}" ]; then |
314 # Remove tests not matching the user's filter. | 323 # Remove tests not matching the user's filter. |
315 tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER}) | 324 tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER}) |
316 fi | 325 fi |
317 | 326 |
318 tests_to_run="${env_tests} ${tests_to_filter}" | 327 local tests_to_run="${env_tests} ${tests_to_filter}" |
319 | 328 |
320 check_git_hashes | 329 check_git_hashes |
321 | 330 |
322 # Run tests. | 331 # Run tests. |
323 for test in ${tests_to_run}; do | 332 for test in ${tests_to_run}; do |
324 test_begin "${test}" | 333 test_begin "${test}" |
325 vlog " RUN ${test}" | 334 vlog " RUN ${test}" |
326 "${test}" | 335 "${test}" |
327 vlog " PASS ${test}" | 336 vlog " PASS ${test}" |
328 test_end "${test}" | 337 test_end "${test}" |
329 done | 338 done |
330 | 339 |
331 tested_config="$(test_configuration_target) @ $(current_hash)" | 340 local tested_config="$(test_configuration_target) @ $(current_hash)" |
332 echo $(basename "${0%.*}"): Done, all tests pass for ${tested_config}. | 341 echo "${test_name}: Done, all tests pass for ${tested_config}." |
333 } | 342 } |
334 | 343 |
335 vpx_test_usage() { | 344 vpx_test_usage() { |
336 cat << EOF | 345 cat << EOF |
337 Usage: ${0##*/} [arguments] | 346 Usage: ${0##*/} [arguments] |
338 --bin-path <path to libvpx binaries directory> | 347 --bin-path <path to libvpx binaries directory> |
339 --config-path <path to libvpx config directory> | 348 --config-path <path to libvpx config directory> |
340 --filter <filter>: User test filter. Only tests matching filter are run. | 349 --filter <filter>: User test filter. Only tests matching filter are run. |
341 --run-disabled-tests: Run disabled tests. | 350 --run-disabled-tests: Run disabled tests. |
342 --help: Display this message and exit. | 351 --help: Display this message and exit. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 YUV_RAW_INPUT_WIDTH=352 | 453 YUV_RAW_INPUT_WIDTH=352 |
445 YUV_RAW_INPUT_HEIGHT=288 | 454 YUV_RAW_INPUT_HEIGHT=288 |
446 | 455 |
447 # Setup a trap function to clean up after tests complete. | 456 # Setup a trap function to clean up after tests complete. |
448 trap cleanup EXIT | 457 trap cleanup EXIT |
449 | 458 |
450 vlog "$(basename "${0%.*}") test configuration: | 459 vlog "$(basename "${0%.*}") test configuration: |
451 LIBVPX_BIN_PATH=${LIBVPX_BIN_PATH} | 460 LIBVPX_BIN_PATH=${LIBVPX_BIN_PATH} |
452 LIBVPX_CONFIG_PATH=${LIBVPX_CONFIG_PATH} | 461 LIBVPX_CONFIG_PATH=${LIBVPX_CONFIG_PATH} |
453 LIBVPX_TEST_DATA_PATH=${LIBVPX_TEST_DATA_PATH} | 462 LIBVPX_TEST_DATA_PATH=${LIBVPX_TEST_DATA_PATH} |
| 463 VP8_IVF_FILE=${VP8_IVF_FILE} |
| 464 VP9_IVF_FILE=${VP9_IVF_FILE} |
| 465 VP9_WEBM_FILE=${VP9_WEBM_FILE} |
| 466 VPX_TEST_EXE_SUFFIX=${VPX_TEST_EXE_SUFFIX} |
| 467 VPX_TEST_FILTER=${VPX_TEST_FILTER} |
454 VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} | 468 VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} |
| 469 VPX_TEST_RAND=${VPX_TEST_RAND} |
| 470 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} |
| 471 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT} |
| 472 VPX_TEST_TEMP_ROOT=${VPX_TEST_TEMP_ROOT} |
455 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} | 473 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} |
456 VPX_TEST_FILTER=${VPX_TEST_FILTER} | 474 YUV_RAW_INPUT=${YUV_RAW_INPUT} |
457 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} | 475 YUV_RAW_INPUT_WIDTH=${YUV_RAW_INPUT_WIDTH} |
458 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT}" | 476 YUV_RAW_INPUT_HEIGHT=${YUV_RAW_INPUT_HEIGHT}" |
459 | 477 |
460 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. | 478 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. |
OLD | NEW |