OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2012 The Go Authors. All rights reserved. | 2 # Copyright 2012 The Go Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style | 3 # Use of this source code is governed by a BSD-style |
4 # license that can be found in the LICENSE file. | 4 # license that can be found in the LICENSE file. |
5 | 5 |
6 set -e | 6 set -e |
7 go build -o testgo | 7 go build -o testgo |
8 go() { | 8 go() { |
9 echo TEST ERROR: ran go, not testgo: go "$@" >&2 | 9 echo TEST ERROR: ran go, not testgo: go "$@" >&2 |
10 exit 2 | 10 exit 2 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if ./testgo get -u foo 2>testdata/err; then | 160 if ./testgo get -u foo 2>testdata/err; then |
161 echo "go get -u foo succeeded unexpectedly" | 161 echo "go get -u foo succeeded unexpectedly" |
162 ok=false | 162 ok=false |
163 elif ! grep testdata/shadow/root1/src/foo testdata/err >/dev/null; then | 163 elif ! grep testdata/shadow/root1/src/foo testdata/err >/dev/null; then |
164 echo "go get -u error does not mention shadow/root1/src/foo:" | 164 echo "go get -u error does not mention shadow/root1/src/foo:" |
165 cat testdata/err | 165 cat testdata/err |
166 ok=false | 166 ok=false |
167 fi | 167 fi |
168 unset GOPATH | 168 unset GOPATH |
169 | 169 |
| 170 TEST go install fails with no buildable files |
| 171 export GOPATH=$(pwd)/testdata |
| 172 export CGO_ENABLED=0 |
| 173 if ./testgo install cgotest 2>testdata/err; then |
| 174 echo "go install cgotest succeeded unexpectedly" |
| 175 elif ! grep 'no buildable Go source files' testdata/err >/dev/null; then |
| 176 echo "go install cgotest did not report 'no buildable Go source files'" |
| 177 cat testdata/err |
| 178 ok=false |
| 179 fi |
| 180 unset CGO_ENABLED |
| 181 unset GOPATH |
| 182 |
170 # Test that without $GOBIN set, binaries get installed | 183 # Test that without $GOBIN set, binaries get installed |
171 # into the GOPATH bin directory. | 184 # into the GOPATH bin directory. |
172 TEST install into GOPATH | 185 TEST install into GOPATH |
173 rm -rf testdata/bin | 186 rm -rf testdata/bin |
174 if ! GOPATH=$(pwd)/testdata ./testgo install go-cmd-test; then | 187 if ! GOPATH=$(pwd)/testdata ./testgo install go-cmd-test; then |
175 echo "go install go-cmd-test failed" | 188 echo "go install go-cmd-test failed" |
176 ok=false | 189 ok=false |
177 elif ! test -x testdata/bin/go-cmd-test; then | 190 elif ! test -x testdata/bin/go-cmd-test; then |
178 echo "go install go-cmd-test did not write to testdata/bin/go-cmd-test" | 191 echo "go install go-cmd-test did not write to testdata/bin/go-cmd-test" |
179 ok=false | 192 ok=false |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 if $started; then stop; fi | 617 if $started; then stop; fi |
605 rm -rf testdata/bin testdata/bin1 | 618 rm -rf testdata/bin testdata/bin1 |
606 rm -f testgo | 619 rm -f testgo |
607 | 620 |
608 if $allok; then | 621 if $allok; then |
609 echo PASS | 622 echo PASS |
610 else | 623 else |
611 echo FAIL | 624 echo FAIL |
612 exit 1 | 625 exit 1 |
613 fi | 626 fi |
OLD | NEW |