ref: 1d29ce53fe75cf03481f6044caa2b1cbbfc08c92
parent: 6653769a02870fd4f861902be8200f8dc0571bb4
author: Tom Finegan <tomfinegan@google.com>
date: Wed Apr 30 07:03:15 EDT 2014
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
--- a/test/decode_to_md5.sh
+++ b/test/decode_to_md5.sh
@@ -24,22 +24,25 @@
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 @@
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 @@
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
}
--- a/test/decode_with_drops.sh
+++ b/test/decode_with_drops.sh
@@ -36,7 +36,7 @@
[ -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
}
--- a/test/simple_decoder.sh
+++ b/test/simple_decoder.sh
@@ -34,7 +34,7 @@
[ -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
}
--- a/test/simple_encoder.sh
+++ b/test/simple_encoder.sh
@@ -31,8 +31,9 @@
[ -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
}
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -15,6 +15,7 @@
VPX_TEST_TOOLS_COMMON_SH=included
set -e
+devnull='> /dev/null 2>&1'
vlog() {
[ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo "$@"
@@ -197,9 +198,9 @@
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 @@
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 @@
--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 @@
--verbose)
VPX_TEST_VERBOSE_OUTPUT=yes
;;
+ --show-program-output)
+ devnull=
+ ;;
*)
vpx_test_usage
exit 1
@@ -445,6 +452,7 @@
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.
--
⑨