diff options
author | Androbin <robin.richtsfeld@gmail.com> | 2017-06-27 13:47:43 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-06-27 15:06:22 +0200 |
commit | cfb2ec0ad1ab4efcf3e332fb74e91a9cbdd10053 (patch) | |
tree | cfdd7affe0d2e6d70d0d157948148ff81f07193d /src | |
parent | fa46172bc3b9bd2398a9d79a05fc5cd55f6059ad (diff) |
Minor Bash improvements
Based on output of static analysis tool.
https://github.com/koalaman/shellcheck/wiki/SC2166
https://github.com/koalaman/shellcheck/wiki/SC2207
https://github.com/koalaman/shellcheck/wiki/SC2145
https://github.com/koalaman/shellcheck/wiki/SC2001
https://github.com/koalaman/shellcheck/wiki/SC2129
https://github.com/koalaman/shellcheck/wiki/SC2128
https://github.com/koalaman/shellcheck/wiki/SC2004
https://github.com/koalaman/shellcheck/wiki/SC2048
Closes #3162.
PiperOrigin-RevId: 160261247
Diffstat (limited to 'src')
-rwxr-xr-x | src/test/shell/testenv.sh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh index b1099970e6..f4f79922ce 100755 --- a/src/test/shell/testenv.sh +++ b/src/test/shell/testenv.sh @@ -122,7 +122,7 @@ python_server="${BAZEL_RUNFILES}/src/test/shell/bazel/testing_server.py" # Third-party MACHINE_TYPE="$(uname -m)" MACHINE_IS_64BIT='no' -if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' -o "${MACHINE_TYPE}" = 's390x' ]; then +if [ "${MACHINE_TYPE}" = 'amd64' ] || [ "${MACHINE_TYPE}" = 'x86_64' ] || [ "${MACHINE_TYPE}" = 's390x' ]; then MACHINE_IS_64BIT='yes' fi @@ -164,6 +164,8 @@ fi function copy_tools_directory() { cp -RL ${tools_dir}/* tools # tools/jdk/BUILD file for JDK 7 is generated. + # Only works if there's 0 or 1 matches. + # If there are multiple, the test fails. if [ -f tools/jdk/BUILD.* ]; then cp tools/jdk/BUILD.* tools/jdk/BUILD fi @@ -418,7 +420,7 @@ function cleanup_workspace() { done touch WORKSPACE fi - for i in ${workspaces}; do + for i in "${workspaces[@]}"; do if [ "$i" != "${WORKSPACE_DIR:-}" ]; then rm -fr $i fi @@ -435,9 +437,9 @@ function cleanup() { if rm -fr "${BAZEL_INSTALL_BASE}" ; then break fi - if (( $i == 10 )) || (( $i == 30 )) || (( $i == 60 )) ; then + if (( i == 10 )) || (( i == 30 )) || (( i == 60 )) ; then echo "Test cleanup: couldn't delete ${BAZEL_INSTALL_BASE} \ after $i seconds" - echo "(Timeout in $((120-$i)) seconds.)" + echo "(Timeout in $((120-i)) seconds.)" sleep 1 fi done |