ref: 250fc1f6a211ed0943125d9b94cb9b3bcf813979
parent: fa8de273e771bb0af79a226ba1dc34da02d0955c
parent: 4d91e16501691f412ada97033b56437f1b45ba82
author: Tom Finegan <[email protected]>
date: Fri Aug 15 09:53:05 EDT 2014
Merge "examples.sh: Run all example tests."
--- a/test/examples.sh
+++ b/test/examples.sh
@@ -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
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -144,6 +144,24 @@
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() {
--- a/test/vpxdec.sh
+++ b/test/vpxdec.sh
@@ -17,22 +17,21 @@
# 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
# LIBVPX_BIN_PATH points to the directory containing vpxdec. $1 is used as the
# 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,7 +41,7 @@
# 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}
@@ -49,15 +48,13 @@
}
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
}
--- a/test/vpxenc.sh
+++ b/test/vpxenc.sh
@@ -23,33 +23,30 @@
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 @@
# 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}