github.com/shijuvar/go@v0.0.0-20141209052335-e8f13700b70c/misc/cgo/errors/test.bash (about) 1 # Copyright 2013 The Go Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style 3 # license that can be found in the LICENSE file. 4 5 check() { 6 file=$1 7 line=$(grep -n 'ERROR HERE' $file | sed 's/:.*//') 8 if [ "$line" = "" ]; then 9 echo 1>&2 misc/cgo/errors/test.bash: BUG: cannot find ERROR HERE in $file 10 exit 1 11 fi 12 if go build $file >errs 2>&1; then 13 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected cgo to fail but it succeeded 14 exit 1 15 fi 16 if ! test -s errs; then 17 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output but saw none 18 exit 1 19 fi 20 if ! fgrep $file:$line: errs >/dev/null 2>&1; then 21 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error on line $line but saw: 22 cat 1>&2 errs 23 exit 1 24 fi 25 } 26 27 check err1.go 28 check err2.go 29 check err3.go 30 check issue7757.go 31 check issue8442.go 32 33 rm -rf errs _obj 34 exit 0