aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/go.test/test/testlib
blob: 29de7672ce1b6416898ecbf27ecebbebf951f0a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright 2012 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.

# These function names are also known to
# (and are the plan for transitioning to) run.go.

compile() {
	$G $D/$F.go
}

compiledir() {
	for gofile in $D/$F.dir/*.go
	do
		$G -I. "$gofile" || return 1
	done
}

build() {
	$G $D/$F.go && $L $F.$A
}

runoutput() {
	go run "$D/$F.go" > tmp.go
	go run tmp.go
}

run() {
	gofiles=""
	ingo=true
	while $ingo; do
		case "$1" in
		*.go)
			gofiles="$gofiles $1"
			shift
			;;
		*)
			ingo=false
			;;
		esac
	done

	$G $D/$F.go $gofiles && $L $F.$A && ./$A.out "$@"
}

cmpout() {
	$G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
}

errorcheck() {
	zero=""
	if [ "$1" = "-0" ]; then
		zero="-0"
		shift
	fi
	errchk $zero $G -e $* $D/$F.go
}

skip() {
	true
}