summaryrefslogtreecommitdiff
path: root/test/run-arm
blob: 30bc1985ea4bda58eab3ce232da0e1aef9c88262 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
# 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.

export E=""
case X"$GOARCH" in
Xamd64)
	export A=6
	;;
X386)
	export A=8
	;;
Xarm)
	export A=5
	export E="qemu-arm -cpu cortex-a8 "
	;;
*)
	echo 1>&2 run: unsupported '$GOARCH'
	exit 1
esac

export G=${A}g
export L=${A}l
export GOTRACEBACK=0

PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/bin}:`pwd`

RUNFILE=/tmp/gorun-$$-$USER
TMP1FILE=/tmp/gotest1-$$-$USER
TMP2FILE=/tmp/gotest2-$$-$USER
FAILEDFILE=/tmp/gotest3-$$-$USER

# don't run the machine out of memory: limit individual processes to 4GB.
# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
ulimit -v 4000000


for i in $(cat arm-pass.txt)
do
	export F=$(basename $i .go)
	dir=$(dirname $i)
	export D=$dir
	sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
	if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE
	then
		echo
		echo "===========" $i
		cat $TMP1FILE
		cat $TMP2FILE
		echo >&2 fail: $i
		touch $FAILEDFILE
	elif test -s $TMP1FILE || test -s $TMP2FILE
	then
		echo
		echo "===========" $i
		cat $TMP1FILE
		cat $TMP2FILE
	elif [ $dir = "bugs" ]
	then
		echo $i succeeded with no output.
	fi
done | # clean up some stack noise
	egrep -v '^(r[0-9a-z]+|[cfg]s)  +0x'  |
	sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
		s!'$RUNFILE'!$RUNFILE!g
		s/ PC=0x[0-9a-f]*/ PC=xxx/
		s/^pc: 0x[0-9a-f]*/pc: xxx/
		/^Trace\/breakpoint trap/d
		/^Trace\/BPT trap/d
		/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
		/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
		/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out

failed=0
if test -f $FAILEDFILE; then
	failed=1
	rm -f $FAILEDFILE
fi

rm  -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out

exit $failed