shithub: libvpx

Download patch

ref: 39c5a4b8be3f9e624270dd6e8571ed5e39d99ee9
parent: b0d9bfe420fbcb745b3cefc5569e4d272b3c8ac9
author: Tom Finegan <tomfinegan@google.com>
date: Tue Apr 22 15:36:40 EDT 2014

tools_common.sh: Set VPX_TEST_EXE_SUFFIX for windows targets.

Change-Id: Ic3c792bcb76917c4d4b829d0377a9c36e06dd77d

--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -130,11 +130,9 @@
 # Echoes yes to stdout when the file named by positional parameter one exists
 # in LIBVPX_BIN_PATH, and is executable.
 vpx_tool_available() {
-  tool_name="${1}"
-  if [ "$(is_windows_target)" = "yes" ]; then
-    tool_name="${tool_name}.exe"
-  fi
-  [ -x "${LIBVPX_BIN_PATH}/${1}" ] && echo yes
+  local tool_name="$1"
+  local tool="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}"
+  [ -x "${tool}" ] && echo yes
 }
 
 # Echoes yes to stdout when vpx_config_option_enabled() reports yes for
@@ -178,8 +176,8 @@
 # present, is interpreted as a boolean flag that means the input should be sent
 # to vpxdec via pipe from cat instead of directly.
 vpxdec() {
-  input="${1}"
-  pipe_input=${2}
+  local input="${1}"
+  local pipe_input=${2}
 
   if [ $# -gt 2 ]; then
     # shift away $1 and $2 so the remaining arguments can be passed to vpxdec
@@ -187,12 +185,8 @@
     shift 2
   fi
 
-  decoder="${LIBVPX_BIN_PATH}/vpxdec"
+  local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
 
-  if [ "$(is_windows_target)" = "yes" ]; then
-    decoder="${decoder}.exe"
-  fi
-
   if [ -z "${pipe_input}" ]; then
     "${decoder}" "$input" --summary --noblit "$@" > /dev/null 2>&1
   else
@@ -218,19 +212,15 @@
 #       Note: Extra flags currently supports a special case: when set to "-"
 #             input is piped to vpxenc via cat.
 vpxenc() {
-  encoder="${LIBVPX_BIN_PATH}/vpxenc"
-  codec="${1}"
-  width=${2}
-  height=${3}
-  frames=${4}
-  input=${5}
-  output="${VPX_TEST_OUTPUT_DIR}/${6}"
-  extra_flags=${7}
+  local encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}"
+  local codec="${1}"
+  local width=${2}
+  local height=${3}
+  local frames=${4}
+  local input=${5}
+  local output="${VPX_TEST_OUTPUT_DIR}/${6}"
+  local extra_flags=${7}
 
-  if [ "$(is_windows_target)" = "yes" ]; then
-    encoder="${encoder}.exe"
-  fi
-
   # Because --ivf must be within the command line to get IVF from vpxenc.
   if echo "${output}" | egrep -q 'ivf$'; then
     use_ivf=--ivf
@@ -419,6 +409,10 @@
   echo "${0##*/}: Cannot create output directory, giving up."
   echo "${0##*/}:   VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}"
   exit 1
+fi
+
+if [ "$(is_windows_target)" = "yes" ]; then
+  VPX_TEST_EXE_SUFFIX=".exe"
 fi
 
 trap cleanup EXIT