2009-11-14 16:29:09 -07:00
|
|
|
#!/usr/bin/env bash
|
2008-10-08 10:46:54 -06:00
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2012-03-09 12:42:23 -07:00
|
|
|
eval $(go env)
|
2012-02-03 22:54:08 -07:00
|
|
|
|
2010-03-31 20:48:33 -06:00
|
|
|
unset CDPATH # in case user has it set
|
2012-03-20 10:47:27 -06:00
|
|
|
unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens
|
|
|
|
# to be under $GOPATH, then some tests below will fail
|
2009-12-11 16:14:09 -07:00
|
|
|
|
2009-11-10 00:11:36 -07:00
|
|
|
# no core files, please
|
|
|
|
ulimit -c 0
|
|
|
|
|
2012-09-16 11:11:28 -06:00
|
|
|
# Raise soft limits to hard limits for NetBSD/OpenBSD.
|
|
|
|
# We need at least 256 files and ~300 MB of bss.
|
|
|
|
# On OS X ulimit -S -n rejects 'unlimited'.
|
|
|
|
[ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n)
|
2012-09-16 11:26:57 -06:00
|
|
|
[ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d)
|
2012-09-16 11:11:28 -06:00
|
|
|
|
2012-02-03 22:54:08 -07:00
|
|
|
# allow all.bash to avoid double-build of everything
|
2010-03-31 20:48:33 -06:00
|
|
|
rebuild=true
|
|
|
|
if [ "$1" = "--no-rebuild" ]; then
|
|
|
|
shift
|
2012-02-03 22:54:08 -07:00
|
|
|
else
|
|
|
|
echo '# Building packages and commands.'
|
2012-01-30 21:43:46 -07:00
|
|
|
time go install -a -v std
|
2012-02-03 22:54:08 -07:00
|
|
|
echo
|
2011-02-14 07:27:02 -07:00
|
|
|
fi
|
2008-11-20 11:54:11 -07:00
|
|
|
|
2012-04-04 09:14:54 -06:00
|
|
|
# we must unset GOROOT_FINAL before tests, because runtime/debug requires
|
|
|
|
# correct access to source code, so if we have GOROOT_FINAL in effect,
|
|
|
|
# at least runtime/debug test will fail.
|
|
|
|
unset GOROOT_FINAL
|
|
|
|
|
2012-02-03 22:54:08 -07:00
|
|
|
echo '# Testing packages.'
|
2012-02-02 22:45:51 -07:00
|
|
|
time go test std -short -timeout=120s
|
2012-01-30 21:43:46 -07:00
|
|
|
echo
|
2012-02-03 22:54:08 -07:00
|
|
|
|
2012-03-05 14:40:27 -07:00
|
|
|
echo '# GOMAXPROCS=2 runtime -cpu=1,2,4'
|
2012-03-21 02:19:37 -06:00
|
|
|
GOMAXPROCS=2 go test runtime -short -timeout=240s -cpu=1,2,4
|
2012-01-30 21:43:46 -07:00
|
|
|
echo
|
2012-02-03 22:54:08 -07:00
|
|
|
|
2012-01-30 21:43:46 -07:00
|
|
|
echo '# sync -cpu=10'
|
2012-02-02 22:45:51 -07:00
|
|
|
go test sync -short -timeout=120s -cpu=10
|
2008-12-04 13:51:36 -07:00
|
|
|
|
2012-11-01 12:02:52 -06:00
|
|
|
case "$GOHOSTOS-$GOOS-$GOARCH" in
|
|
|
|
linux-linux-amd64 | darwin-darwin-amd64)
|
|
|
|
echo
|
|
|
|
echo '# Testing race detector.'
|
|
|
|
go test -race -i flag
|
|
|
|
go test -race -short flag
|
|
|
|
esac
|
|
|
|
|
2012-02-03 22:54:08 -07:00
|
|
|
xcd() {
|
|
|
|
echo
|
2012-03-06 21:27:30 -07:00
|
|
|
echo '#' $1
|
2012-02-03 22:54:08 -07:00
|
|
|
builtin cd "$GOROOT"/src/$1
|
|
|
|
}
|
2012-01-30 21:43:46 -07:00
|
|
|
|
2011-08-10 19:36:48 -06:00
|
|
|
[ "$CGO_ENABLED" != 1 ] ||
|
2011-02-08 18:37:08 -07:00
|
|
|
[ "$GOHOSTOS" == windows ] ||
|
2009-10-03 12:33:51 -06:00
|
|
|
(xcd ../misc/cgo/stdio
|
2012-08-06 19:38:35 -06:00
|
|
|
go run $GOROOT/test/run.go - .
|
2009-10-03 12:33:51 -06:00
|
|
|
) || exit $?
|
|
|
|
|
2011-08-10 19:36:48 -06:00
|
|
|
[ "$CGO_ENABLED" != 1 ] ||
|
2010-12-17 10:51:55 -07:00
|
|
|
(xcd ../misc/cgo/life
|
2012-08-06 19:38:35 -06:00
|
|
|
go run $GOROOT/test/run.go - .
|
2010-12-17 10:51:55 -07:00
|
|
|
) || exit $?
|
|
|
|
|
2011-08-10 19:36:48 -06:00
|
|
|
[ "$CGO_ENABLED" != 1 ] ||
|
2011-03-11 13:09:32 -07:00
|
|
|
(xcd ../misc/cgo/test
|
2012-03-06 21:27:30 -07:00
|
|
|
go test
|
2011-03-11 13:09:32 -07:00
|
|
|
) || exit $?
|
|
|
|
|
2011-11-22 07:57:49 -07:00
|
|
|
[ "$CGO_ENABLED" != 1 ] ||
|
|
|
|
[ "$GOHOSTOS" == windows ] ||
|
2012-03-07 08:15:20 -07:00
|
|
|
[ "$GOHOSTOS" == darwin ] ||
|
2011-11-22 07:57:49 -07:00
|
|
|
(xcd ../misc/cgo/testso
|
2012-03-07 08:15:20 -07:00
|
|
|
./test.bash
|
2011-11-22 07:57:49 -07:00
|
|
|
) || exit $?
|
|
|
|
|
2009-01-06 16:49:27 -07:00
|
|
|
(xcd ../doc/progs
|
2011-02-08 18:37:08 -07:00
|
|
|
time ./run
|
2009-01-06 16:49:27 -07:00
|
|
|
) || exit $?
|
|
|
|
|
2011-03-27 21:39:42 -06:00
|
|
|
[ "$GOARCH" == arm ] || # uses network, fails under QEMU
|
2012-03-07 15:23:56 -07:00
|
|
|
(xcd ../doc/articles/wiki
|
|
|
|
make clean
|
2012-03-07 20:04:49 -07:00
|
|
|
./test.bash
|
2011-01-30 21:58:44 -07:00
|
|
|
) || exit $?
|
2011-01-25 21:56:52 -07:00
|
|
|
|
2012-03-25 23:08:21 -06:00
|
|
|
(xcd ../doc/codewalk
|
|
|
|
# TODO: test these too.
|
2012-03-26 00:03:04 -06:00
|
|
|
set -e
|
2012-03-25 23:08:21 -06:00
|
|
|
go build pig.go
|
|
|
|
go build urlpoll.go
|
|
|
|
rm -f pig urlpoll
|
|
|
|
) || exit $?
|
|
|
|
|
2012-03-07 15:23:56 -07:00
|
|
|
echo
|
|
|
|
echo '#' ../misc/dashboard/builder ../misc/goplay
|
2012-03-17 12:20:46 -06:00
|
|
|
go build ../misc/dashboard/builder ../misc/goplay
|
2010-10-20 17:46:10 -06:00
|
|
|
|
2010-09-21 23:30:42 -06:00
|
|
|
[ "$GOARCH" == arm ] ||
|
2011-12-13 15:46:54 -07:00
|
|
|
(xcd ../test/bench/shootout
|
2011-02-08 18:37:08 -07:00
|
|
|
./timing.sh -test
|
2009-08-09 15:31:05 -06:00
|
|
|
) || exit $?
|
|
|
|
|
2012-03-07 15:23:56 -07:00
|
|
|
echo
|
|
|
|
echo '#' ../test/bench/go1
|
2012-03-17 12:20:46 -06:00
|
|
|
go test ../test/bench/go1
|
2011-12-15 10:32:59 -07:00
|
|
|
|
2008-10-08 10:46:54 -06:00
|
|
|
(xcd ../test
|
2012-03-05 20:47:23 -07:00
|
|
|
time go run run.go
|
2008-10-29 16:23:29 -06:00
|
|
|
) || exit $?
|
2008-10-08 10:46:54 -06:00
|
|
|
|
2012-03-17 12:20:46 -06:00
|
|
|
echo
|
|
|
|
echo '# Checking API compatibility.'
|
2012-10-03 19:35:17 -06:00
|
|
|
go tool api -c $GOROOT/api/go1.txt -next $GOROOT/api/next.txt -except $GOROOT/api/except.txt
|
2012-03-17 12:20:46 -06:00
|
|
|
|
2011-02-14 07:27:02 -07:00
|
|
|
echo
|
|
|
|
echo ALL TESTS PASSED
|