Commit a9824cd4 authored by Daniel Martí's avatar Daniel Martí Committed by Ian Lance Taylor

*.bash: always use the same string equality operator

POSIX Shell only supports = to compare variables inside '[' tests. But
this is Bash, where == is an alias for =. In practice they're the same,
but the current form is inconsisnent and breaks POSIX for no good
reason.

Change-Id: I38fa7a5a90658dc51acc2acd143049e510424ed8
Reviewed-on: https://go-review.googlesource.com/38031Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 723ba180
...@@ -20,7 +20,7 @@ trap cleanup 0 INT ...@@ -20,7 +20,7 @@ trap cleanup 0 INT
rm -f get.bin final-test.bin a.out rm -f get.bin final-test.bin a.out
# If called with -all, check that all code snippets compile. # If called with -all, check that all code snippets compile.
if [ "$1" == "-all" ]; then if [ "$1" = "-all" ]; then
for fn in *.go; do for fn in *.go; do
go build -o a.out $fn go build -o a.out $fn
done done
......
...@@ -42,7 +42,7 @@ zip -0 -r ../../zoneinfo.zip * ...@@ -42,7 +42,7 @@ zip -0 -r ../../zoneinfo.zip *
cd ../.. cd ../..
echo echo
if [ "$1" == "-work" ]; then if [ "$1" = "-work" ]; then
echo Left workspace behind in work/. echo Left workspace behind in work/.
else else
rm -rf work rm -rf work
......
...@@ -12,7 +12,7 @@ FC=$1 ...@@ -12,7 +12,7 @@ FC=$1
goos=$(go env GOOS) goos=$(go env GOOS)
libext="so" libext="so"
if [ "$goos" == "darwin" ]; then if [ "$goos" = "darwin" ]; then
libext="dylib" libext="dylib"
fi fi
......
...@@ -27,7 +27,7 @@ fi ...@@ -27,7 +27,7 @@ fi
# Directory where cgo headers and outputs will be installed. # Directory where cgo headers and outputs will be installed.
# The installation directory format varies depending on the platform. # The installation directory format varies depending on the platform.
installdir=pkg/${goos}_${goarch}_testcshared_shared installdir=pkg/${goos}_${goarch}_testcshared_shared
if [ "${goos}" == "darwin" ]; then if [ "${goos}" = "darwin" ]; then
installdir=pkg/${goos}_${goarch}_testcshared installdir=pkg/${goos}_${goarch}_testcshared
fi fi
...@@ -40,13 +40,13 @@ function cleanup() { ...@@ -40,13 +40,13 @@ function cleanup() {
rm -f testp testp2 testp3 testp4 testp5 rm -f testp testp2 testp3 testp4 testp5
rm -rf pkg "${goroot}/${installdir}" rm -rf pkg "${goroot}/${installdir}"
if [ "$goos" == "android" ]; then if [ "$goos" = "android" ]; then
adb shell rm -rf "$androidpath" adb shell rm -rf "$androidpath"
fi fi
} }
trap cleanup EXIT trap cleanup EXIT
if [ "$goos" == "android" ]; then if [ "$goos" = "android" ]; then
adb shell mkdir -p "$androidpath" adb shell mkdir -p "$androidpath"
fi fi
...@@ -69,7 +69,7 @@ function run() { ...@@ -69,7 +69,7 @@ function run() {
function binpush() { function binpush() {
bin=${1} bin=${1}
if [ "$goos" == "android" ]; then if [ "$goos" = "android" ]; then
adb push "$bin" "${androidpath}/${bin}" 2>/dev/null adb push "$bin" "${androidpath}/${bin}" 2>/dev/null
fi fi
} }
...@@ -79,7 +79,7 @@ rm -rf pkg ...@@ -79,7 +79,7 @@ rm -rf pkg
suffix="-installsuffix testcshared" suffix="-installsuffix testcshared"
libext="so" libext="so"
if [ "$goos" == "darwin" ]; then if [ "$goos" = "darwin" ]; then
libext="dylib" libext="dylib"
fi fi
...@@ -89,7 +89,7 @@ GOPATH=$(pwd) go install -buildmode=c-shared $suffix libgo ...@@ -89,7 +89,7 @@ GOPATH=$(pwd) go install -buildmode=c-shared $suffix libgo
GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo.$libext src/libgo/libgo.go GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo.$libext src/libgo/libgo.go
binpush libgo.$libext binpush libgo.$libext
if [ "$goos" == "linux" ] || [ "$goos" == "android" ] ; then if [ "$goos" = "linux" ] || [ "$goos" = "android" ] ; then
if readelf -d libgo.$libext | grep TEXTREL >/dev/null; then if readelf -d libgo.$libext | grep TEXTREL >/dev/null; then
echo "libgo.$libext has TEXTREL set" echo "libgo.$libext has TEXTREL set"
exit 1 exit 1
...@@ -97,7 +97,7 @@ if [ "$goos" == "linux" ] || [ "$goos" == "android" ] ; then ...@@ -97,7 +97,7 @@ if [ "$goos" == "linux" ] || [ "$goos" == "android" ] ; then
fi fi
GOGCCFLAGS=$(go env GOGCCFLAGS) GOGCCFLAGS=$(go env GOGCCFLAGS)
if [ "$goos" == "android" ]; then if [ "$goos" = "android" ]; then
GOGCCFLAGS="${GOGCCFLAGS} -pie" GOGCCFLAGS="${GOGCCFLAGS} -pie"
fi fi
...@@ -127,7 +127,7 @@ fi ...@@ -127,7 +127,7 @@ fi
GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo2.$libext libgo2 GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo2.$libext libgo2
binpush libgo2.$libext binpush libgo2.$libext
linkflags="-Wl,--no-as-needed" linkflags="-Wl,--no-as-needed"
if [ "$goos" == "darwin" ]; then if [ "$goos" = "darwin" ]; then
linkflags="" linkflags=""
fi fi
$(go env CC) ${GOGCCFLAGS} -o testp2 main2.c $linkflags libgo2.$libext $(go env CC) ${GOGCCFLAGS} -o testp2 main2.c $linkflags libgo2.$libext
...@@ -139,7 +139,7 @@ if [ "$output" != "PASS" ]; then ...@@ -139,7 +139,7 @@ if [ "$output" != "PASS" ]; then
fi fi
# test3: tests main.main is exported on android. # test3: tests main.main is exported on android.
if [ "$goos" == "android" ]; then if [ "$goos" = "android" ]; then
$(go env CC) ${GOGCCFLAGS} -o testp3 main3.c -ldl $(go env CC) ${GOGCCFLAGS} -o testp3 main3.c -ldl
binpush testp3 binpush testp3
output=$(run ./testp ./libgo.so) output=$(run ./testp ./libgo.so)
......
...@@ -72,7 +72,7 @@ testmsanshared() { ...@@ -72,7 +72,7 @@ testmsanshared() {
goos=$(go env GOOS) goos=$(go env GOOS)
suffix="-installsuffix testsanitizers" suffix="-installsuffix testsanitizers"
libext="so" libext="so"
if [ "$goos" == "darwin" ]; then if [ "$goos" = "darwin" ]; then
libext="dylib" libext="dylib"
fi fi
go build -msan -buildmode=c-shared $suffix -o ${TMPDIR}/libmsanshared.$libext msan_shared.go go build -msan -buildmode=c-shared $suffix -o ${TMPDIR}/libmsanshared.$libext msan_shared.go
...@@ -135,7 +135,7 @@ testtsanshared() { ...@@ -135,7 +135,7 @@ testtsanshared() {
goos=$(go env GOOS) goos=$(go env GOOS)
suffix="-installsuffix tsan" suffix="-installsuffix tsan"
libext="so" libext="so"
if [ "$goos" == "darwin" ]; then if [ "$goos" = "darwin" ]; then
libext="dylib" libext="dylib"
fi fi
go build -buildmode=c-shared $suffix -o ${TMPDIR}/libtsanshared.$libext tsan_shared.go go build -buildmode=c-shared $suffix -o ${TMPDIR}/libtsanshared.$libext tsan_shared.go
......
...@@ -24,11 +24,11 @@ if [ "$GOARCH" != "arm" ] && [ "$GOARCH" != "arm64" ]; then ...@@ -24,11 +24,11 @@ if [ "$GOARCH" != "arm" ] && [ "$GOARCH" != "arm64" ]; then
echo "iostest.bash requires GOARCH=arm or GOARCH=arm64, got GOARCH=$GOARCH" 1>&2 echo "iostest.bash requires GOARCH=arm or GOARCH=arm64, got GOARCH=$GOARCH" 1>&2
exit 1 exit 1
fi fi
if [ "$GOARCH" == "arm" ]; then if [ "$GOARCH" = "arm" ]; then
export GOARM=7 export GOARM=7
fi fi
if [ "$1" == "-restart" ]; then if [ "$1" = "-restart" ]; then
# Reboot to make sure previous runs do not interfere with the current run. # Reboot to make sure previous runs do not interfere with the current run.
# It is reasonably easy for a bad program leave an iOS device in an # It is reasonably easy for a bad program leave an iOS device in an
# almost unusable state. # almost unusable state.
...@@ -60,7 +60,7 @@ GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go build \ ...@@ -60,7 +60,7 @@ GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go build \
-o ../bin/go_darwin_${GOARCH}_exec \ -o ../bin/go_darwin_${GOARCH}_exec \
../misc/ios/go_darwin_arm_exec.go ../misc/ios/go_darwin_arm_exec.go
if [ "$GOIOS_DEV_ID" == "" ]; then if [ "$GOIOS_DEV_ID" = "" ]; then
echo "detecting iOS development identity" echo "detecting iOS development identity"
eval $(GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go run ../misc/ios/detect.go) eval $(GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go run ../misc/ios/detect.go)
fi fi
......
...@@ -107,7 +107,7 @@ done ...@@ -107,7 +107,7 @@ done
# Test for debian/kFreeBSD. # Test for debian/kFreeBSD.
# cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to # cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to
# disable cgo manually. # disable cgo manually.
if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
export CGO_ENABLED=0 export CGO_ENABLED=0
fi fi
...@@ -125,7 +125,7 @@ if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then ...@@ -125,7 +125,7 @@ if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1 exit 1
fi fi
if [ "$GOROOT_BOOTSTRAP" == "$GOROOT" ]; then if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
echo "ERROR: \$GOROOT_BOOTSTRAP must not be set to \$GOROOT" >&2 echo "ERROR: \$GOROOT_BOOTSTRAP must not be set to \$GOROOT" >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1 exit 1
......
...@@ -36,12 +36,12 @@ ulimit -c 0 ...@@ -36,12 +36,12 @@ ulimit -c 0
# This is a system misconfiguration and should be fixed on the # This is a system misconfiguration and should be fixed on the
# broken system, not "fixed" by ignoring the failure here. # broken system, not "fixed" by ignoring the failure here.
# See longer discussion on golang.org/issue/7381. # See longer discussion on golang.org/issue/7381.
[ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n) [ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n)
[ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d) [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d)
# Thread count limit on NetBSD 7. # Thread count limit on NetBSD 7.
if ulimit -T &> /dev/null; then if ulimit -T &> /dev/null; then
[ "$(ulimit -H -T)" == "unlimited" ] || ulimit -S -T $(ulimit -H -T) [ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
fi fi
exec go tool dist test -rebuild "$@" exec go tool dist test -rebuild "$@"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment