]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/go/testdata/script/gotoolchain_net.txt
cmd/go: additional doc-inspired tests and bug fixes
[gostls13.git] / src / cmd / go / testdata / script / gotoolchain_net.txt
1 # This test only checks that basic network lookups work.
2 # The full test of toolchain version selection is in gotoolchain.txt.
3
4 env TESTGO_VERSION=go1.21actual
5
6 # GOTOOLCHAIN from network, does not exist
7 env GOTOOLCHAIN=go1.9999x
8 ! go version
9 stderr 'go: download go1.9999x for .*: toolchain not available'
10
11 # GOTOOLCHAIN from network
12 [!exec:/bin/sh] stop 'the fake proxy serves shell scripts instead of binaries'
13 env GOTOOLCHAIN=go1.999testmod
14 go version
15 stderr 'go: downloading go1.999testmod \(.*/.*\)'
16
17 # GOTOOLCHAIN cached from network
18 go version
19 ! stderr downloading
20 stdout go1.999testmod
21
22 # GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should operate in cache and not try badurl
23 env oldsumdb=$GOSUMDB
24 env GOSUMDB=$oldsumdb' http://badurl'
25 go version
26 ! stderr downloading
27 stdout go1.999testmod
28
29 # GOTOOLCHAIN with GOSUMB=off should fail, because it cannot access even the cached sumdb info
30 # without the sumdb name.
31 env GOSUMDB=off
32 ! go version
33 stderr '^go: golang.org/toolchain@v0.0.1-go1.999testmod.[a-z0-9\-]*: verifying module: checksum database disabled by GOSUMDB=off$'
34
35 # GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should fail if cache is incomplete
36 env GOSUMDB=$oldsumdb' http://badurl'
37 rm $GOPATH/pkg/mod/cache/download/sumdb
38 ! go version
39 ! stderr downloading
40 stderr 'panic: use of network' # test catches network access
41 env GOSUMDB=$oldsumdb
42
43 # Test a real GOTOOLCHAIN
44 [short] skip
45 [!net:golang.org] skip
46 [!GOOS:darwin] [!GOOS:windows] [!GOOS:linux] skip
47 [!GOARCH:amd64] [!GOARCH:arm64] skip
48
49 env GOPROXY=
50 env GOSUMDB=
51 env GOTOOLCHAIN=go1.20.1
52
53         # Avoid resolving a "go1.20.1" from the user's real $PATH.
54         # That would not only cause the "downloading go1.20.1" message
55         # to be suppressed, but may spuriously fail:
56         # golang.org/dl/go1.20.1 expects to find its GOROOT in $HOME/sdk,
57         # but the script environment sets HOME=/no-home.
58 env PATH=
59 env path=
60
61 go version
62 stderr '^go: downloading go1.20.1 '
63 stdout go1.20.1