void
prints(int8 *s)
{
- write(1, s, findnull((byte*)s));
+ write(fd, s, findnull((byte*)s));
}
// Very simple printf. Only for debugging prints.
if(*p != '%')
continue;
if(p > lp)
- write(1, lp, p-lp);
+ write(fd, lp, p-lp);
p++;
narg = nil;
switch(*p) {
lp = p+1;
}
if(p > lp)
- write(1, lp, p-lp);
+ write(fd, lp, p-lp);
// unlock(&debuglock);
}
sys·printbool(bool v)
{
if(v) {
- write(1, (byte*)"true", 4);
+ write(fd, (byte*)"true", 4);
return;
}
- write(1, (byte*)"false", 5);
+ write(fd, (byte*)"false", 5);
}
void
float64 h;
if(isNaN(v)) {
- write(1, "NaN", 3);
+ write(fd, "NaN", 3);
return;
}
if(isInf(v, 0)) {
- write(1, "+Inf", 4);
+ write(fd, "+Inf", 4);
return;
}
if(isInf(v, -1)) {
- write(1, "+Inf", 4);
+ write(fd, "+Inf", 4);
return;
}
buf[n+4] = (e/100) + '0';
buf[n+5] = (e/10)%10 + '0';
buf[n+6] = (e%10) + '0';
- write(1, buf, n+7);
+ write(fd, buf, n+7);
}
void
break;
v = v/10;
}
- write(1, buf+i, nelem(buf)-i);
+ write(fd, buf+i, nelem(buf)-i);
}
void
sys·printint(int64 v)
{
if(v < 0) {
- write(1, "-", 1);
+ write(fd, "-", 1);
v = -v;
}
sys·printuint(v);
buf[--i] = '0';
buf[--i] = 'x';
buf[--i] = '0';
- write(1, buf+i, nelem(buf)-i);
+ write(fd, buf+i, nelem(buf)-i);
}
void
extern int32 maxstring;
if(v.len > maxstring) {
- write(1, "[invalid string]", 16);
+ write(fd, "[invalid string]", 16);
return;
}
if(v.len > 0)
- write(1, v.str, v.len);
+ write(fd, v.str, v.len);
}
void
sys·printsp(void)
{
- write(1, " ", 1);
+ write(fd, " ", 1);
}
void
sys·printnl(void)
{
- write(1, "\n", 1);
+ write(fd, "\n", 1);
}
int32 panicking = 0;
int32 maxround = sizeof(uintptr);
+int32 fd = 1;
int32
gotraceback(void)
{
uint8 *sp;
+ fd = 2;
if(panicking) {
printf("double panic\n");
exit(3);
void
throw(int8 *s)
{
+ fd = 2;
printf("throw: %s\n", s);
sys·panicl(-1);
*(int32*)0 = 0; // not reached
extern int32 gomaxprocs;
extern int32 panicking;
extern int32 maxround;
+extern int32 fd; // usually 1; set to 2 when panicking
int8* goos;
/*
void unlock(Lock*);
/*
- * sleep and wakeup on one-time events.
+ * sleep and wakeup on one-time events, like
+ * Notification (but shorter to type).
* before any calls to notesleep or notewakeup,
* must call noteclear to initialize the Note.
* then, any number of threads can call notesleep
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
// 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.
RUNFILE=/tmp/gorun-$$-$USER
TMP1FILE=/tmp/gotest1-$$-$USER
TMP2FILE=/tmp/gotest2-$$-$USER
-TMP3FILE=/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.
export F=$(basename $i .go)
export D=$dir
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
- if ! /usr/bin/time -p sh -c "sh $RUNFILE >$TMP1FILE 2>$TMP2FILE" 2>$TMP3FILE
+ if ! /usr/bin/time -p sh -c "sh $RUNFILE >$TMP1FILE 2>&1" 2>$TMP2FILE
then
echo
echo "===========" $i
cat $TMP1FILE
- cat $TMP2FILE
echo >&2 fail: $i
- elif test -s $TMP1FILE || test -s $TMP2FILE
+ elif test -s $TMP1FILE
then
echo
echo "===========" $i
cat $TMP1FILE
- cat $TMP2FILE
elif [ $dir = "bugs" ]
then
echo $i succeeded with no output.
else
echo $i >>pass.out
fi
- echo $(awk 'NR==1{print $2}' $TMP3FILE) $D/$F >>times.out
+ 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' |
1)
echo FAIL
esac
-rm -f $RUNFILE $TMP1FILE $TMP2FILE $TMP3FILE *.$A $A.out
+rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
diffmsg=""
if ! diff run.out golden.out
then