1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:54:42 -07:00
go/test/run
Russ Cox 4608feb18b runtime: simpler heap map, memory allocation
The old heap maps used a multilevel table, but that
was overkill: there are only 1M entries on a 32-bit
machine and we can arrange to use a dense address
range on a 64-bit machine.

The heap map is in bss.  The assumption is that if
we don't touch the pages they won't be mapped in.

Also moved some duplicated memory allocation
code out of the OS-specific files.

R=r
CC=golang-dev
https://golang.org/cl/4118042
2011-01-28 15:03:26 -05:00

136 lines
3.0 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.
eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
case X"$GOARCH" in
Xamd64)
export A=6
;;
X386)
export A=8
;;
Xarm)
export A=5
export E="$GORUN"
;;
*)
echo 1>&2 run: unsupported '$GOARCH'
exit 1
esac
case X"$GOOS" in
Xnacl)
export E=${GORUN:-$GOROOT/misc/nacl/naclrun}
esac
export G=${A}g
export L=${A}l
export GOTRACEBACK=0
export LANG=C
unset GREP_OPTIONS # in case user has a non-standard set
failed=0
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
RUNFILE=/tmp/gorun-$$-$USER
TMP1FILE=/tmp/gotest1-$$-$USER
TMP2FILE=/tmp/gotest2-$$-$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.
# Linux charges reserved but not mapped addresses to ulimit -v
# so we have to use ulimit -m.
ulimit -m 4000000
# no core files please
ulimit -c 0
true >pass.out >times.out
exclude=false # exclude nothing
golden=golden.out
filterout() {
grep '^'"$2"'$' $1 >/dev/null
}
for dir in . ken chan interface nilptr syntax fixedbugs bugs
do
echo
echo '==' $dir'/'
for i in $(ls $dir/*.go 2>/dev/null)
do (
if $exclude $i; then
exit 0 # continues for loop
fi
export F=$(basename $i .go)
export D=$dir
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >$RUNFILE
if ! { time -p bash -c "bash $RUNFILE >$TMP1FILE 2>&1" ; } 2>$TMP2FILE
then
echo
echo "===========" $i
cat $TMP1FILE
echo >&2 fail: $i
echo "# $i # fail" >>pass.out
elif test -s $TMP1FILE
then
echo
echo "===========" $i
cat $TMP1FILE
if grep -q '^BUG' $TMP1FILE
then
if [ $dir != bugs ]
then
echo >&2 bug: $i
fi
echo "# $i # fail, BUG" >>pass.out
else
echo $i >>pass.out
fi
elif [ $dir = "bugs" ]
then
echo $i succeeded with no output.
else
echo $i >>pass.out
fi
echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
) done
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/
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
/Fault in NaCl untrusted code/d
/Segmentation fault/d
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
diffmsg=""
if ! diff $golden run.out
then
diffmsg="; test output differs"
failed=1
fi
notinbugs=$(sed '/^== bugs/q' run.out | grep -c '^BUG')
inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
if [ "$failed" != "0" ]; then
echo FAILED
fi
exit $failed