Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(243)

Side by Side Diff: doc/progs/run

Issue 171044: Remove GOBIN in PATH dependency; don't assume cwd is $G... (Closed)
Patch Set: code review 171044: Remove GOBIN in PATH dependency; don't assume cwd is $G... Created 15 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright 2009 The Go Authors. All rights reserved. 2 # Copyright 2009 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 GOBIN="${GOBIN:-$HOME/bin}"
7
6 . "$GOROOT"/src/Make.$GOARCH 8 . "$GOROOT"/src/Make.$GOARCH
7 9
8 if [ -z "$O" ]; then 10 if [ -z "$O" ]; then
9 echo 'missing $O - maybe no Make.$GOARCH?' 1>&2 11 echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
10 exit 1 12 exit 1
11 fi 13 fi
12 14
13 rm -f *.$O 15 rm -f *.$O
14 16
15 for i in \ 17 for i in \
16 file.go \ 18 file.go \
17 helloworld.go \ 19 helloworld.go \
18 helloworld3.go \ 20 helloworld3.go \
19 echo.go \ 21 echo.go \
20 cat.go \ 22 cat.go \
21 cat_rot13.go \ 23 cat_rot13.go \
22 sum.go \ 24 sum.go \
23 sort.go \ 25 sort.go \
24 sortmain.go \ 26 sortmain.go \
25 print.go \ 27 print.go \
26 print_string.go \ 28 print_string.go \
27 sieve.go \ 29 sieve.go \
28 sieve1.go \ 30 sieve1.go \
29 server1.go \ 31 server1.go \
30 ; do 32 ; do
31 BASE=$(basename $i .go) 33 BASE=$(basename $i .go)
32 34
33 » $GC $i 35 » "${GOBIN}"/$GC $i
rsc 2009/12/11 21:51:17 drop unnecessary braces
34 done 36 done
35 37
36 function testit { 38 function testit {
37 » $LD $1.$O 39 » "${GOBIN}"/$LD $1.$O
rsc 2009/12/11 21:51:17 drop unnecessary braces
38 x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes 40 x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes
39 if [ "$x" != "$3" ] 41 if [ "$x" != "$3" ]
40 then 42 then
41 echo $1 failed: '"'$x'"' is not '"'$3'"' 43 echo $1 failed: '"'$x'"' is not '"'$3'"'
42 fi 44 fi
43 } 45 }
44 46
45 function testitpipe { 47 function testitpipe {
46 » $LD $1.$O 48 » "${GOBIN}"/$LD $1.$O
rsc 2009/12/11 21:51:17 drop unnecessary braces
47 x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes 49 x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes
48 if [ "$x" != "$3" ] 50 if [ "$x" != "$3" ]
49 then 51 then
50 echo $1 failed: '"'$x'"' is not '"'$3'"' 52 echo $1 failed: '"'$x'"' is not '"'$3'"'
51 fi 53 fi
52 } 54 }
53 55
54 56
55 testit helloworld "" "Hello, world; or Καλημέρα κόσμε; or こんにちは 世界" 57 testit helloworld "" "Hello, world; or Καλημέρα κόσμε; or こんにちは 世界"
56 testit helloworld3 "" "hello, world can't open file; err=no such file or directo ry" 58 testit helloworld3 "" "hello, world can't open file; err=no such file or directo ry"
57 testit echo "hello, world" "hello, world" 59 testit echo "hello, world" "hello, world"
58 testit sum "" "6" 60 testit sum "" "6"
59 61
60 alphabet=abcdefghijklmnopqrstuvwxyz 62 alphabet=abcdefghijklmnopqrstuvwxyz
61 rot13=nopqrstuvwxyzabcdefghijklm 63 rot13=nopqrstuvwxyzabcdefghijklm
62 echo $alphabet | testit cat "" $alphabet 64 echo $alphabet | testit cat "" $alphabet
63 echo $alphabet | testit cat_rot13 "--rot13" $rot13 65 echo $alphabet | testit cat_rot13 "--rot13" $rot13
64 echo $rot13 | testit cat_rot13 "--rot13" $alphabet 66 echo $rot13 | testit cat_rot13 "--rot13" $alphabet
65 67
66 testit sortmain "" "Sunday Monday Tuesday Wednesday Thursday Friday Saturday" 68 testit sortmain "" "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
67 69
68 testit print "" "18446744073709551615 -1 18446744073709551615 {77 Sunset Strip} [1 2 3 4] 18446744073709551615 {77 Sunset Strip} [1 2 3 4] 18446744073709551615 {77 Sunset Strip} [1 2 3 4]" 70 testit print "" "18446744073709551615 -1 18446744073709551615 {77 Sunset Strip} [1 2 3 4] 18446744073709551615 {77 Sunset Strip} [1 2 3 4] 18446744073709551615 {77 Sunset Strip} [1 2 3 4]"
69 testit print_string "" "77 Sunset Strip" 71 testit print_string "" "77 Sunset Strip"
70 72
71 testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29" 73 testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
72 testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29" 74 testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
73 75
74 # server hangs; don't run it, just compile it 76 # server hangs; don't run it, just compile it
75 $GC server.go 77 "${GOBIN}"/$GC server.go
rsc 2009/12/11 21:51:17 drop unnecessary braces
76 testit server1 "" "" 78 testit server1 "" ""
77 79
78 rm -f $O.out *.$O 80 rm -f $O.out *.$O
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b