| 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 VPX_TEST_PREFIX="" |
| 19 | 20 |
| 20 elog() { | 21 elog() { |
| 21 echo "$@" 1>&2 | 22 echo "$@" 1>&2 |
| 22 } | 23 } |
| 23 | 24 |
| 24 vlog() { | 25 vlog() { |
| 25 if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then | 26 if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then |
| 26 echo "$@" | 27 echo "$@" |
| 27 fi | 28 fi |
| 28 } | 29 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 198 |
| 198 if [ $# -gt 2 ]; then | 199 if [ $# -gt 2 ]; then |
| 199 # shift away $1 and $2 so the remaining arguments can be passed to vpxdec | 200 # shift away $1 and $2 so the remaining arguments can be passed to vpxdec |
| 200 # via $@. | 201 # via $@. |
| 201 shift 2 | 202 shift 2 |
| 202 fi | 203 fi |
| 203 | 204 |
| 204 local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" | 205 local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" |
| 205 | 206 |
| 206 if [ -z "${pipe_input}" ]; then | 207 if [ -z "${pipe_input}" ]; then |
| 207 eval "${decoder}" "$input" --summary --noblit "$@" ${devnull} | 208 eval "${VPX_TEST_PREFIX}" "${decoder}" "$input" --summary --noblit "$@" \ |
| 209 ${devnull} |
| 208 else | 210 else |
| 209 cat "${input}" | eval "${decoder}" - --summary --noblit "$@" ${devnull} | 211 cat "${input}" \ |
| 212 | eval "${VPX_TEST_PREFIX}" "${decoder}" - --summary --noblit "$@" \ |
| 213 ${devnull} |
| 210 fi | 214 fi |
| 211 } | 215 } |
| 212 | 216 |
| 213 # Echoes yes to stdout when vpxenc exists according to vpx_tool_available(). | 217 # Echoes yes to stdout when vpxenc exists according to vpx_tool_available(). |
| 214 vpxenc_available() { | 218 vpxenc_available() { |
| 215 [ -n $(vpx_tool_available vpxenc) ] && echo yes | 219 [ -n $(vpx_tool_available vpxenc) ] && echo yes |
| 216 } | 220 } |
| 217 | 221 |
| 218 # Wrapper function for running vpxenc. Positional parameters are interpreted as | 222 # Wrapper function for running vpxenc. Positional parameters are interpreted as |
| 219 # follows: | 223 # follows: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 245 fi | 249 fi |
| 246 | 250 |
| 247 if [ "${extra_flags}" = "-" ]; then | 251 if [ "${extra_flags}" = "-" ]; then |
| 248 pipe_input=yes | 252 pipe_input=yes |
| 249 extra_flags=${8} | 253 extra_flags=${8} |
| 250 else | 254 else |
| 251 unset pipe_input | 255 unset pipe_input |
| 252 fi | 256 fi |
| 253 | 257 |
| 254 if [ -z "${pipe_input}" ]; then | 258 if [ -z "${pipe_input}" ]; then |
| 255 eval "${encoder}" --codec=${codec} --width=${width} --height=${height} \ | 259 eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} --width=${width} \ |
| 256 --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" \ | 260 --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \ |
| 257 "${input}" \ | 261 --output="${output}" "${input}" ${devnull} |
| 258 ${devnull} | |
| 259 else | 262 else |
| 260 cat "${input}" \ | 263 cat "${input}" \ |
| 261 | eval "${encoder}" --codec=${codec} --width=${width} \ | 264 | eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} \ |
| 262 --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \ | 265 --width=${width} --height=${height} --limit=${frames} ${use_ivf} \ |
| 263 --output="${output}" - \ | 266 ${extra_flags} --output="${output}" - ${devnull} |
| 264 ${devnull} | |
| 265 fi | 267 fi |
| 266 | 268 |
| 267 if [ ! -e "${output}" ]; then | 269 if [ ! -e "${output}" ]; then |
| 268 # Return non-zero exit status: output file doesn't exist, so something | 270 # Return non-zero exit status: output file doesn't exist, so something |
| 269 # definitely went wrong. | 271 # definitely went wrong. |
| 270 return 1 | 272 return 1 |
| 271 fi | 273 fi |
| 272 } | 274 } |
| 273 | 275 |
| 274 # Filters strings from positional parameter one using the filter specified by | 276 # Filters strings from positional parameter one using the filter specified by |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 vpx_test_usage() { | 346 vpx_test_usage() { |
| 345 cat << EOF | 347 cat << EOF |
| 346 Usage: ${0##*/} [arguments] | 348 Usage: ${0##*/} [arguments] |
| 347 --bin-path <path to libvpx binaries directory> | 349 --bin-path <path to libvpx binaries directory> |
| 348 --config-path <path to libvpx config directory> | 350 --config-path <path to libvpx config directory> |
| 349 --filter <filter>: User test filter. Only tests matching filter are run. | 351 --filter <filter>: User test filter. Only tests matching filter are run. |
| 350 --run-disabled-tests: Run disabled tests. | 352 --run-disabled-tests: Run disabled tests. |
| 351 --help: Display this message and exit. | 353 --help: Display this message and exit. |
| 352 --test-data-path <path to libvpx test data directory> | 354 --test-data-path <path to libvpx test data directory> |
| 353 --show-program-output: Shows output from all programs being tested. | 355 --show-program-output: Shows output from all programs being tested. |
| 356 --prefix: Allows for a user specified prefix to be inserted before all test |
| 357 programs. Grants the ability, for example, to run test programs |
| 358 within valgrind. |
| 354 --verbose: Verbose output. | 359 --verbose: Verbose output. |
| 355 | 360 |
| 356 When the --bin-path option is not specified the script attempts to use | 361 When the --bin-path option is not specified the script attempts to use |
| 357 \$LIBVPX_BIN_PATH and then the current directory. | 362 \$LIBVPX_BIN_PATH and then the current directory. |
| 358 | 363 |
| 359 When the --config-path option is not specified the script attempts to use | 364 When the --config-path option is not specified the script attempts to use |
| 360 \$LIBVPX_CONFIG_PATH and then the current directory. | 365 \$LIBVPX_CONFIG_PATH and then the current directory. |
| 361 | 366 |
| 362 When the -test-data-path option is not specified the script attempts to use | 367 When the -test-data-path option is not specified the script attempts to use |
| 363 \$LIBVPX_TEST_DATA_PATH and then the current directory. | 368 \$LIBVPX_TEST_DATA_PATH and then the current directory. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 393 VPX_TEST_RUN_DISABLED_TESTS=yes | 398 VPX_TEST_RUN_DISABLED_TESTS=yes |
| 394 ;; | 399 ;; |
| 395 --help) | 400 --help) |
| 396 vpx_test_usage | 401 vpx_test_usage |
| 397 exit | 402 exit |
| 398 ;; | 403 ;; |
| 399 --test-data-path) | 404 --test-data-path) |
| 400 LIBVPX_TEST_DATA_PATH="$2" | 405 LIBVPX_TEST_DATA_PATH="$2" |
| 401 shift | 406 shift |
| 402 ;; | 407 ;; |
| 408 --prefix) |
| 409 VPX_TEST_PREFIX="$2" |
| 410 shift |
| 411 ;; |
| 403 --verbose) | 412 --verbose) |
| 404 VPX_TEST_VERBOSE_OUTPUT=yes | 413 VPX_TEST_VERBOSE_OUTPUT=yes |
| 405 ;; | 414 ;; |
| 406 --show-program-output) | 415 --show-program-output) |
| 407 devnull= | 416 devnull= |
| 408 ;; | 417 ;; |
| 409 *) | 418 *) |
| 410 vpx_test_usage | 419 vpx_test_usage |
| 411 exit 1 | 420 exit 1 |
| 412 ;; | 421 ;; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 vlog "$(basename "${0%.*}") test configuration: | 468 vlog "$(basename "${0%.*}") test configuration: |
| 460 LIBVPX_BIN_PATH=${LIBVPX_BIN_PATH} | 469 LIBVPX_BIN_PATH=${LIBVPX_BIN_PATH} |
| 461 LIBVPX_CONFIG_PATH=${LIBVPX_CONFIG_PATH} | 470 LIBVPX_CONFIG_PATH=${LIBVPX_CONFIG_PATH} |
| 462 LIBVPX_TEST_DATA_PATH=${LIBVPX_TEST_DATA_PATH} | 471 LIBVPX_TEST_DATA_PATH=${LIBVPX_TEST_DATA_PATH} |
| 463 VP8_IVF_FILE=${VP8_IVF_FILE} | 472 VP8_IVF_FILE=${VP8_IVF_FILE} |
| 464 VP9_IVF_FILE=${VP9_IVF_FILE} | 473 VP9_IVF_FILE=${VP9_IVF_FILE} |
| 465 VP9_WEBM_FILE=${VP9_WEBM_FILE} | 474 VP9_WEBM_FILE=${VP9_WEBM_FILE} |
| 466 VPX_TEST_EXE_SUFFIX=${VPX_TEST_EXE_SUFFIX} | 475 VPX_TEST_EXE_SUFFIX=${VPX_TEST_EXE_SUFFIX} |
| 467 VPX_TEST_FILTER=${VPX_TEST_FILTER} | 476 VPX_TEST_FILTER=${VPX_TEST_FILTER} |
| 468 VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} | 477 VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} |
| 478 VPX_TEST_PREFIX=${VPX_TEST_PREFIX} |
| 469 VPX_TEST_RAND=${VPX_TEST_RAND} | 479 VPX_TEST_RAND=${VPX_TEST_RAND} |
| 470 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} | 480 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} |
| 471 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT} | 481 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT} |
| 472 VPX_TEST_TEMP_ROOT=${VPX_TEST_TEMP_ROOT} | 482 VPX_TEST_TEMP_ROOT=${VPX_TEST_TEMP_ROOT} |
| 473 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} | 483 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} |
| 474 YUV_RAW_INPUT=${YUV_RAW_INPUT} | 484 YUV_RAW_INPUT=${YUV_RAW_INPUT} |
| 475 YUV_RAW_INPUT_WIDTH=${YUV_RAW_INPUT_WIDTH} | 485 YUV_RAW_INPUT_WIDTH=${YUV_RAW_INPUT_WIDTH} |
| 476 YUV_RAW_INPUT_HEIGHT=${YUV_RAW_INPUT_HEIGHT}" | 486 YUV_RAW_INPUT_HEIGHT=${YUV_RAW_INPUT_HEIGHT}" |
| 477 | 487 |
| 478 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. | 488 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. |
| OLD | NEW |