Commit 1d29ce53 authored by Tom Finegan's avatar Tom Finegan
Browse files

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
Showing with 30 additions and 20 deletions
...@@ -24,22 +24,25 @@ decode_to_md5_verify_environment() { ...@@ -24,22 +24,25 @@ decode_to_md5_verify_environment() {
fi fi
} }
# Runs decode_to_md5 on $1 and echoes the MD5 sum for the final frame. $2 is # 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. # 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() { decode_to_md5() {
local decoder="${LIBVPX_BIN_PATH}/decode_to_md5${VPX_TEST_EXE_SUFFIX}" local decoder="${LIBVPX_BIN_PATH}/decode_to_md5${VPX_TEST_EXE_SUFFIX}"
local input_file="$1" local input_file="$1"
local codec="$2" local codec="$2"
local expected_md5="$3"
local output_file="${VPX_TEST_OUTPUT_DIR}/decode_to_md5_${codec}" local output_file="${VPX_TEST_OUTPUT_DIR}/decode_to_md5_${codec}"
[ -x "${decoder}" ] || return 1 [ -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 [ -e "${output_file}" ] || return 1
local md5_last_frame=$(tail -n1 "${output_file}") 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() { decode_to_md5_vp8() {
...@@ -47,8 +50,7 @@ decode_to_md5_vp8() { ...@@ -47,8 +50,7 @@ decode_to_md5_vp8() {
local expected_md5="56794d911b02190212bca92f88ad60c6" local expected_md5="56794d911b02190212bca92f88ad60c6"
if [ "$(vp8_decode_available)" = "yes" ]; then if [ "$(vp8_decode_available)" = "yes" ]; then
local actual_md5="$(decode_to_md5 "${VP8_IVF_FILE}" vp8)" || return 1 decode_to_md5 "${VP8_IVF_FILE}" "vp8" "${expected_md5}"
[ "${actual_md5}" = "${expected_md5}" ] || return 1
fi fi
} }
...@@ -57,8 +59,7 @@ decode_to_md5_vp9() { ...@@ -57,8 +59,7 @@ decode_to_md5_vp9() {
local expected_md5="2952c0eae93f3dadd1aa84c50d3fd6d2" local expected_md5="2952c0eae93f3dadd1aa84c50d3fd6d2"
if [ "$(vp9_decode_available)" = "yes" ]; then if [ "$(vp9_decode_available)" = "yes" ]; then
local actual_md5="$(decode_to_md5 "${VP9_IVF_FILE}" vp9)" || return 1 decode_to_md5 "${VP9_IVF_FILE}" "vp9" "${expected_md5}"
[ "${actual_md5}" = "${expected_md5}" ] || return 1
fi fi
} }
......
...@@ -36,7 +36,7 @@ decode_with_drops() { ...@@ -36,7 +36,7 @@ decode_with_drops() {
[ -x "${decoder}" ] || return 1 [ -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 [ -e "${output_file}" ] || return 1
} }
......
...@@ -34,7 +34,7 @@ simple_decoder() { ...@@ -34,7 +34,7 @@ simple_decoder() {
[ -x "${decoder}" ] || return 1 [ -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 [ -e "${output_file}" ] || return 1
} }
......
...@@ -31,8 +31,9 @@ simple_encoder() { ...@@ -31,8 +31,9 @@ simple_encoder() {
[ -x "${encoder}" ] || return 1 [ -x "${encoder}" ] || return 1
"${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ eval "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT}" "${output_file}" 9999 > /dev/null 2>&1 "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" 9999 \
${devnull}
[ -e "${output_file}" ] || return 1 [ -e "${output_file}" ] || return 1
} }
......
...@@ -15,6 +15,7 @@ if [ -z "${VPX_TEST_TOOLS_COMMON_SH}" ]; then ...@@ -15,6 +15,7 @@ if [ -z "${VPX_TEST_TOOLS_COMMON_SH}" ]; then
VPX_TEST_TOOLS_COMMON_SH=included VPX_TEST_TOOLS_COMMON_SH=included
set -e set -e
devnull='> /dev/null 2>&1'
vlog() { vlog() {
[ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo "$@" [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo "$@"
...@@ -197,9 +198,9 @@ vpxdec() { ...@@ -197,9 +198,9 @@ vpxdec() {
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
if [ -z "${pipe_input}" ]; then if [ -z "${pipe_input}" ]; then
"${decoder}" "$input" --summary --noblit "$@" > /dev/null 2>&1 eval "${decoder}" "$input" --summary --noblit "$@" ${devnull}
else else
cat "${input}" | "${decoder}" - --summary --noblit "$@" > /dev/null 2>&1 cat "${input}" | eval "${decoder}" - --summary --noblit "$@" ${devnull}
fi fi
} }
...@@ -245,14 +246,16 @@ vpxenc() { ...@@ -245,14 +246,16 @@ vpxenc() {
fi fi
if [ -z "${pipe_input}" ]; then 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}" \ --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" \
"${input}" > /dev/null 2>&1 "${input}" \
${devnull}
else else
cat "${input}" \ cat "${input}" \
| "${encoder}" --codec=${codec} --width=${width} --height=${height} \ | eval "${encoder}" --codec=${codec} --width=${width} \
--limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" - \ --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \
> /dev/null 2>&1 --output="${output}" - \
${devnull}
fi fi
if [ ! -e "${output}" ]; then if [ ! -e "${output}" ]; then
...@@ -336,6 +339,7 @@ cat << EOF ...@@ -336,6 +339,7 @@ cat << EOF
--run-disabled-tests: Run disabled tests. --run-disabled-tests: Run disabled tests.
--help: Display this message and exit. --help: Display this message and exit.
--test-data-path <path to libvpx test data directory> --test-data-path <path to libvpx test data directory>
--show-program-output: Shows output from all programs being tested.
--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
...@@ -388,6 +392,9 @@ while [ -n "$1" ]; do ...@@ -388,6 +392,9 @@ while [ -n "$1" ]; do
--verbose) --verbose)
VPX_TEST_VERBOSE_OUTPUT=yes VPX_TEST_VERBOSE_OUTPUT=yes
;; ;;
--show-program-output)
devnull=
;;
*) *)
vpx_test_usage vpx_test_usage
exit 1 exit 1
...@@ -445,6 +452,7 @@ vlog "$(basename "${0%.*}") test configuration: ...@@ -445,6 +452,7 @@ vlog "$(basename "${0%.*}") test configuration:
VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR} VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}
VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT}
VPX_TEST_FILTER=${VPX_TEST_FILTER} 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. fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment