mirror of
https://github.com/golang/go
synced 2024-11-14 07:30:22 -07:00
d2d7de974c
FreeBSD's srandom has a different signature to darwin/linux. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/5795067
74 lines
1.4 KiB
Bash
Executable File
74 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
set -e
|
|
|
|
goos=$(go env GOOS)
|
|
|
|
defer_panic_recover="
|
|
defer
|
|
defer2
|
|
"
|
|
|
|
effective_go="
|
|
eff_bytesize
|
|
eff_qr
|
|
eff_sequence
|
|
"
|
|
|
|
error_handling="
|
|
error
|
|
error2
|
|
error3
|
|
error4
|
|
"
|
|
|
|
law_of_reflection="
|
|
interface
|
|
interface2
|
|
"
|
|
|
|
c_go_cgo="
|
|
cgo1
|
|
cgo2
|
|
cgo3
|
|
cgo4
|
|
"
|
|
# cgo1 and cgo2 don't run on freebsd, srandom has a different signature
|
|
if [ "$goos" == "freebsd" ]; then
|
|
c_go_cgo="cgo3 cgo4"
|
|
fi
|
|
|
|
all=$(echo $defer_panic_recover $effective_go $error_handling $law_of_reflection $c_go_cgo slices go1)
|
|
|
|
for i in $all; do
|
|
go build $i.go
|
|
done
|
|
|
|
# Write to temporary file to avoid mingw bash bug.
|
|
TMPFILE="${TMPDIR:-/tmp}/gotest3.$USER"
|
|
|
|
function testit {
|
|
./$1 >"$TMPFILE" 2>&1 || true
|
|
x=$(echo $(cat "$TMPFILE")) # extra echo canonicalizes
|
|
if ! echo "$x" | grep "$2" > /dev/null
|
|
then
|
|
echo $1 failed: '"'$x'"' is not '"'$2'"'
|
|
fi
|
|
}
|
|
|
|
|
|
testit defer '^0 3210 2$'
|
|
testit defer2 '^Calling g. Printing in g 0 Printing in g 1 Printing in g 2 Printing in g 3 Panicking! Defer in g 3 Defer in g 2 Defer in g 1 Defer in g 0 Recovered in f 4 Returned normally from f.$'
|
|
|
|
testit eff_bytesize '^1.00YB 9.09TB$'
|
|
testit eff_sequence '^\[-1 2 6 16 44\]$'
|
|
|
|
testit go1 '^Christmas is a holiday: true Sleeping for 0.123s.*go1.go already exists$'
|
|
|
|
testit interface2 "^type: float64$"
|
|
|
|
rm -f $all "$TMPFILE"
|