Merge "examples.sh: Run all example tests."

This commit is contained in:
Tom Finegan 2014-08-15 13:53:05 -07:00 committed by Gerrit Code Review
commit 250fc1f6a2
4 changed files with 36 additions and 24 deletions

View File

@ -15,7 +15,7 @@
example_tests=$(ls $(dirname $0)/*.sh)
# List of script names to exclude.
exclude_list="examples vpxdec vpxenc tools_common"
exclude_list="examples tools_common"
# Filter out the scripts in $exclude_list.
for word in ${exclude_list}; do

View File

@ -144,6 +144,24 @@ is_windows_target() {
fi
}
# Echoes path to $1 when it's executable and exists in ${LIBVPX_BIN_PATH}, or an
# empty string. Caller is responsible for testing the string once the function
# returns.
vpx_tool_path() {
local readonly tool_name="$1"
local tool_path="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}"
if [ ! -x "${tool_path}" ]; then
# Try one directory up: when running via examples.sh the tool could be in
# the parent directory of $LIBVPX_BIN_PATH.
tool_path="${LIBVPX_BIN_PATH}/../${tool_name}${VPX_TEST_EXE_SUFFIX}"
fi
if [ ! -x "${tool_path}" ]; then
tool_path=""
fi
echo "${tool_path}"
}
# Echoes yes to stdout when the file named by positional parameter one exists
# in LIBVPX_BIN_PATH, and is executable.
vpx_tool_available() {

View File

@ -17,14 +17,13 @@
# Environment check: Make sure input is available.
vpxdec_verify_environment() {
if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_WEBM_FILE}" ]; then
echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
elog "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
return 1
fi
if [ -z "$(vpx_tool_path vpxdec)" ]; then
elog "vpxdec not found. It must exist in LIBVPX_BIN_PATH or its parent."
return 1
fi
}
# Echoes yes to stdout when vpxdec exists according to vpx_tool_available().
vpxdec_available() {
[ -n "$(vpx_tool_available vpxdec)" ] && echo yes
}
# Wrapper function for running vpxdec with pipe input. Requires that
@ -32,7 +31,7 @@ vpxdec_available() {
# input file path and shifted away. All remaining parameters are passed through
# to vpxdec.
vpxdec_pipe() {
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
local decoder="$(vpx_tool_path vpxdec)"
local input="$1"
shift
cat "${input}" | eval "${VPX_TEST_PREFIX}" "${decoder}" - "$@" ${devnull}
@ -42,22 +41,20 @@ vpxdec_pipe() {
# the directory containing vpxdec. $1 one is used as the input file path and
# shifted away. All remaining parameters are passed through to vpxdec.
vpxdec() {
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
local decoder="$(vpx_tool_path vpxdec)"
local input="${1}"
shift
eval "${VPX_TEST_PREFIX}" "${decoder}" "$input" "$@" ${devnull}
}
vpxdec_can_decode_vp8() {
if [ "$(vpxdec_available)" = "yes" ] && \
[ "$(vp8_decode_available)" = "yes" ]; then
if [ "$(vp8_decode_available)" = "yes" ]; then
echo yes
fi
}
vpxdec_can_decode_vp9() {
if [ "$(vpxdec_available)" = "yes" ] && \
[ "$(vp9_decode_available)" = "yes" ]; then
if [ "$(vp9_decode_available)" = "yes" ]; then
echo yes
fi
}

View File

@ -23,33 +23,30 @@ vpxenc_verify_environment() {
echo "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH."
return 1
fi
if [ -z "$(vpx_tool_path vpxenc)" ]; then
elog "vpxenc not found. It must exist in LIBVPX_BIN_PATH or its parent."
return 1
fi
}
vpxenc_can_encode_vp8() {
if [ "$(vpxenc_available)" = "yes" ] && \
[ "$(vp8_encode_available)" = "yes" ]; then
if [ "$(vp8_encode_available)" = "yes" ]; then
echo yes
fi
}
vpxenc_can_encode_vp9() {
if [ "$(vpxenc_available)" = "yes" ] && \
[ "$(vp9_encode_available)" = "yes" ]; then
if [ "$(vp9_encode_available)" = "yes" ]; then
echo yes
fi
}
# Echoes yes to stdout when vpxenc exists according to vpx_tool_available().
vpxenc_available() {
[ -n "$(vpx_tool_available vpxenc)" ] && echo yes
}
# Wrapper function for running vpxenc with pipe input. Requires that
# LIBVPX_BIN_PATH points to the directory containing vpxenc. $1 is used as the
# input file path and shifted away. All remaining parameters are passed through
# to vpxenc.
vpxenc_pipe() {
local readonly encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}"
local readonly encoder="$(vpx_tool_path vpxenc)"
local readonly input="$1"
shift
cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - "$@" ${devnull}
@ -59,7 +56,7 @@ vpxenc_pipe() {
# the directory containing vpxenc. $1 one is used as the input file path and
# shifted away. All remaining parameters are passed through to vpxenc.
vpxenc() {
local readonly encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}"
local readonly encoder="$(vpx_tool_path vpxenc)"
local readonly input="${1}"
shift
eval "${VPX_TEST_PREFIX}" "${encoder}" "$input" "$@" ${devnull}