- Remove vpxdec and vpxenc from the exclude list.
- vpx{dec,enc}.sh: Updates to support finding their executable when
LIBVPX_BIN_PATH is setup for the examples.
- tools_common.sh: New library function, vpx_tool_path(). Provides
support for finding the exectuables in vpx{dec,enc}.sh.
Change-Id: I730f11cceb44646491a7a7ff58603a4a760129ef
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
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() {
# 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
# 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}
# 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
}
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}
# 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}