summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Alanis <alanisbaez@google.com>2021-11-26 20:12:11 +0000
committerRoberto Alanis Baez <alanisbaez@google.com>2021-12-16 23:05:53 +0000
commit2a1a8fd043d285981dee9d3fac3f4bfd9c059c20 (patch)
tree437e65f95f458e828700abd81aa1ad857bd1df9a
parentc7de961ef8534fb11b6970d480e7419ce680e31d (diff)
downloadlibwebm-2a1a8fd043d285981dee9d3fac3f4bfd9c059c20.tar.gz
Fix shellcheck issues in infra/*.sh
There is an update of shellcheck v0.8.0 which adds more issues. Change-Id: I1a8008bb9f6346cf49566bafe4692534548408bd Bug: b:185520494
-rwxr-xr-xinfra/compile.sh7
-rwxr-xr-xinfra/compile_android.sh7
-rwxr-xr-xinfra/run_unit_tests.sh13
3 files changed, 18 insertions, 9 deletions
diff --git a/infra/compile.sh b/infra/compile.sh
index 9fa5208..b4f81f9 100755
--- a/infra/compile.sh
+++ b/infra/compile.sh
@@ -30,8 +30,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
+shopt -s inherit_errexit
+
LIBWEBM_ROOT="$(realpath "$(dirname "$0")/..")"
-WORKSPACE=${WORKSPACE:-"$(mktemp -d)"}
+readonly LIBWEBM_ROOT
+readonly WORKSPACE=${WORKSPACE:-"$(mktemp -d -t webm.XXX)"}
# shellcheck source=infra/common.sh
source "${LIBWEBM_ROOT}/infra/common.sh"
@@ -53,7 +56,7 @@ EOF
# Setup ccache for toolchain.
#######################################
setup_ccache() {
- if [[ -x "$(command -v ccache)" ]]; then
+ if command -v ccache 2> /dev/null; then
export CCACHE_CPP2=yes
export PATH="/usr/lib/ccache:${PATH}"
fi
diff --git a/infra/compile_android.sh b/infra/compile_android.sh
index f96f111..df0d39c 100755
--- a/infra/compile_android.sh
+++ b/infra/compile_android.sh
@@ -30,8 +30,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
+shopt -s inherit_errexit
+
LIBWEBM_ROOT="$(realpath "$(dirname "$0")/..")"
-WORKSPACE=${WORKSPACE:-"$(mktemp -d)"}
+readonly LIBWEBM_ROOT
+readonly WORKSPACE=${WORKSPACE:-"$(mktemp -d)"}
# shellcheck source=infra/common.sh
source "${LIBWEBM_ROOT}/infra/common.sh"
@@ -66,7 +69,7 @@ APP_ABI=${2:?"Application Binary Interface not defined.$(
)"}
BUILD_DIR="${WORKSPACE}/build-${APP_OPTIM}"
-if [[ ! -x "$(command -v ndk-build)" ]]; then
+if ! command -v ndk-build 2> /dev/null; then
log_err "unable to find ndk-build in PATH"
exit 1
fi
diff --git a/infra/run_unit_tests.sh b/infra/run_unit_tests.sh
index b98f4f3..abcae55 100755
--- a/infra/run_unit_tests.sh
+++ b/infra/run_unit_tests.sh
@@ -30,8 +30,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -xeo pipefail
+shopt -s inherit_errexit
+
readonly GOOGLETEST_REPO="https://github.com/google/googletest.git"
-readonly LIBWEBM_ROOT="$(realpath "$(dirname "$0")/..")"
+LIBWEBM_ROOT="$(realpath "$(dirname "$0")/..")"
+readonly LIBWEBM_ROOT
readonly WORKSPACE=${WORKSPACE:-"$(mktemp -d -t webm.XXX)"}
# shellcheck source=infra/common.sh
@@ -90,8 +93,7 @@ dump_sanitizer_log() {
return 1
fi
- local asan_symbolize_tool
- if [[ -x "$(command -v asan_symbolize)" ]]; then
+ if command -v asan_symbolize; then
asan_symbolize_tool="asan_symbolize"
else
asan_symbolize_tool="asan_symbolize.py"
@@ -111,7 +113,7 @@ dump_sanitizer_log() {
fi
;;
*) ;; # No other sanitizer options are required
- # TODO(b/185520494): Handle ubsan warning output inspection
+ # TODO(b/185520494): Handle ubsan warning output inspection
esac
}
@@ -168,10 +170,11 @@ cmake "${LIBWEBM_ROOT}" "${opts[@]}"
make -j 4
popd
+find_tests="$(find "${BUILD_DIR}" -name '*_tests')"
UNIT_TESTS=()
while IFS='' read -r line; do
UNIT_TESTS+=("${line}")
-done < <(find "${BUILD_DIR}" -name '*_tests')
+done < <(echo "${find_tests}")
export LIBWEBM_TEST_DATA_PATH="${LIBWEBM_ROOT}/testing/testdata"
case "${TARGET}" in