From 1d29ce53fe75cf03481f6044caa2b1cbbfc08c92 Mon Sep 17 00:00:00 2001 From: Tom Finegan <tomfinegan@google.com> Date: Wed, 30 Apr 2014 11:03:15 -0700 Subject: [PATCH] Add --show-program-output option to shell tests. When used --show-program-output shows the output from the programs run during testing. Change-Id: I15a47c43d1fcf0243c8df1a75d0d2a584ae1f08f --- test/decode_to_md5.sh | 17 +++++++++-------- test/decode_with_drops.sh | 2 +- test/simple_decoder.sh | 2 +- test/simple_encoder.sh | 5 +++-- test/tools_common.sh | 24 ++++++++++++++++-------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/test/decode_to_md5.sh b/test/decode_to_md5.sh index da1a870621..f64acc8b00 100755 --- a/test/decode_to_md5.sh +++ b/test/decode_to_md5.sh @@ -24,22 +24,25 @@ decode_to_md5_verify_environment() { fi } -# Runs decode_to_md5 on $1 and echoes the MD5 sum for the final frame. $2 is -# interpreted as codec name and used solely to name the output file. +# Runs decode_to_md5 on $1 and captures the md5 sum for the final frame. $2 is +# interpreted as codec name and used solely to name the output file. $3 is the +# expected md5 sum: It must match that of the final frame. decode_to_md5() { local decoder="${LIBVPX_BIN_PATH}/decode_to_md5${VPX_TEST_EXE_SUFFIX}" local input_file="$1" local codec="$2" + local expected_md5="$3" local output_file="${VPX_TEST_OUTPUT_DIR}/decode_to_md5_${codec}" [ -x "${decoder}" ] || return 1 - "${decoder}" "${input_file}" "${output_file}" > /dev/null 2>&1 + eval "${decoder}" "${input_file}" "${output_file}" ${devnull} [ -e "${output_file}" ] || return 1 local md5_last_frame=$(tail -n1 "${output_file}") - echo "${md5_last_frame% *}" | tr -d [:space:] + local actual_md5=$(echo "${md5_last_frame% *}" | tr -d [:space:]) + [ "${actual_md5}" = "${expected_md5}" ] || return 1 } decode_to_md5_vp8() { @@ -47,8 +50,7 @@ decode_to_md5_vp8() { local expected_md5="56794d911b02190212bca92f88ad60c6" if [ "$(vp8_decode_available)" = "yes" ]; then - local actual_md5="$(decode_to_md5 "${VP8_IVF_FILE}" vp8)" || return 1 - [ "${actual_md5}" = "${expected_md5}" ] || return 1 + decode_to_md5 "${VP8_IVF_FILE}" "vp8" "${expected_md5}" fi } @@ -57,8 +59,7 @@ decode_to_md5_vp9() { local expected_md5="2952c0eae93f3dadd1aa84c50d3fd6d2" if [ "$(vp9_decode_available)" = "yes" ]; then - local actual_md5="$(decode_to_md5 "${VP9_IVF_FILE}" vp9)" || return 1 - [ "${actual_md5}" = "${expected_md5}" ] || return 1 + decode_to_md5 "${VP9_IVF_FILE}" "vp9" "${expected_md5}" fi } diff --git a/test/decode_with_drops.sh b/test/decode_with_drops.sh index d0321bfb26..82e934db24 100755 --- a/test/decode_with_drops.sh +++ b/test/decode_with_drops.sh @@ -36,7 +36,7 @@ decode_with_drops() { [ -x "${decoder}" ] || return 1 - "${decoder}" "${input_file}" "${output_file}" "${drop_mode}" > /dev/null 2>&1 + eval "${decoder}" "${input_file}" "${output_file}" "${drop_mode}" ${devnull} [ -e "${output_file}" ] || return 1 } diff --git a/test/simple_decoder.sh b/test/simple_decoder.sh index a0db58ff83..24b17c5ef8 100755 --- a/test/simple_decoder.sh +++ b/test/simple_decoder.sh @@ -34,7 +34,7 @@ simple_decoder() { [ -x "${decoder}" ] || return 1 - "${decoder}" "${input_file}" "${output_file}" > /dev/null 2>&1 + eval "${decoder}" "${input_file}" "${output_file}" ${devnull} [ -e "${output_file}" ] || return 1 } diff --git a/test/simple_encoder.sh b/test/simple_encoder.sh index 13f5e298b7..6232093c98 100755 --- a/test/simple_encoder.sh +++ b/test/simple_encoder.sh @@ -31,8 +31,9 @@ simple_encoder() { [ -x "${encoder}" ] || return 1 - "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ - "${YUV_RAW_INPUT}" "${output_file}" 9999 > /dev/null 2>&1 + eval "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \ + "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" 9999 \ + ${devnull} [ -e "${output_file}" ] || return 1 } diff --git a/test/tools_common.sh b/test/tools_common.sh index 1ed017620e..30f0faea9c 100755 --- a/test/tools_common.sh +++ b/test/tools_common.sh @@ -15,6 +15,7 @@ if [ -z "${VPX_TEST_TOOLS_COMMON_SH}" ]; then VPX_TEST_TOOLS_COMMON_SH=included set -e +devnull='> /dev/null 2>&1' vlog() { [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo "$@" @@ -197,9 +198,9 @@ vpxdec() { local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" if [ -z "${pipe_input}" ]; then - "${decoder}" "$input" --summary --noblit "$@" > /dev/null 2>&1 + eval "${decoder}" "$input" --summary --noblit "$@" ${devnull} else - cat "${input}" | "${decoder}" - --summary --noblit "$@" > /dev/null 2>&1 + cat "${input}" | eval "${decoder}" - --summary --noblit "$@" ${devnull} fi } @@ -245,14 +246,16 @@ vpxenc() { fi if [ -z "${pipe_input}" ]; then - "${encoder}" --codec=${codec} --width=${width} --height=${height} \ + eval "${encoder}" --codec=${codec} --width=${width} --height=${height} \ --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" \ - "${input}" > /dev/null 2>&1 + "${input}" \ + ${devnull} else cat "${input}" \ - | "${encoder}" --codec=${codec} --width=${width} --height=${height} \ - --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" - \ - > /dev/null 2>&1 + | eval "${encoder}" --codec=${codec} --width=${width} \ + --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \ + --output="${output}" - \ + ${devnull} fi if [ ! -e "${output}" ]; then @@ -336,6 +339,7 @@ cat << EOF --run-disabled-tests: Run disabled tests. --help: Display this message and exit. --test-data-path <path to libvpx test data directory> + --show-program-output: Shows output from all programs being tested. --verbose: Verbose output. When the --bin-path option is not specified the script attempts to use @@ -388,6 +392,9 @@ while [ -n "$1" ]; do --verbose) VPX_TEST_VERBOSE_OUTPUT=yes ;; + --show-program-output) + devnull= + ;; *) vpx_test_usage exit 1 @@ -445,6 +452,7 @@ vlog "$(basename "${0%.*}") test configuration: VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} VPX_TEST_FILTER=${VPX_TEST_FILTER} - VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS}" + VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} + VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT}" fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. -- GitLab