github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/misc/cgo/errors/test.bash (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2013 The Go Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style 5 # license that can be found in the LICENSE file. 6 7 check() { 8 file=$1 9 line=$(grep -n 'ERROR HERE' $file | sed 's/:.*//') 10 if [ "$line" = "" ]; then 11 echo 1>&2 misc/cgo/errors/test.bash: BUG: cannot find ERROR HERE in $file 12 exit 1 13 fi 14 expect $file $file:$line: 15 } 16 17 expect() { 18 file=$1 19 error=$2 20 if go build $file >errs 2>&1; then 21 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected cgo to fail but it succeeded 22 exit 1 23 fi 24 if ! test -s errs; then 25 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output but saw none 26 exit 1 27 fi 28 if ! fgrep $error errs >/dev/null 2>&1; then 29 echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output to contain \"$error\" but saw: 30 cat 1>&2 errs 31 exit 1 32 fi 33 } 34 35 check err1.go 36 check err2.go 37 check err3.go 38 check issue7757.go 39 check issue8442.go 40 check issue11097a.go 41 check issue11097b.go 42 expect issue13129.go C.ushort 43 44 if ! go run ptr.go; then 45 exit 1 46 fi 47 48 rm -rf errs _obj 49 exit 0