diff --git a/src/all-nacl.bash b/src/all-nacl.bash new file mode 100644 index 00000000000..6a1a206c110 --- /dev/null +++ b/src/all-nacl.bash @@ -0,0 +1,19 @@ +#!/bin/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. + +# TODO(rsc): delete in favor of all.bash once nacl support is complete + +set -e +bash make.bash + +xcd() { + echo + echo --- cd $1 + builtin cd $1 +} + +(xcd ../test +./run-nacl +) || exit $? diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest index 5ee3eb0a868..c4c8e1a9e05 100755 --- a/src/cmd/gotest/gotest +++ b/src/cmd/gotest/gotest @@ -16,6 +16,12 @@ if [ -z "$O" ]; then exit 1 fi +E="" +case "$GOOS" in +nacl) + E="nacl" +esac + # Allow overrides GC=${_GC:-$GC} GL=${GL:-$LD} @@ -124,4 +130,4 @@ importpath=$(make -s importpath) $GC _testmain.go $GL _testmain.$O _test/$importpath.a $xofile -./$O.out "$@" +$E ./$O.out "$@" diff --git a/src/pkg/syscall/asm_nacl_386.s b/src/pkg/syscall/asm_nacl_386.s index 976effb5e9b..6bd69e07109 100644 --- a/src/pkg/syscall/asm_nacl_386.s +++ b/src/pkg/syscall/asm_nacl_386.s @@ -85,8 +85,7 @@ ok6: RET // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr); -TEXT syscall·RawSyscall(SB),7,$0 -TEXT syscall·Syscall(SB),7,$20 +TEXT syscall·RawSyscall(SB),7,$20 MOVL trap+0(FP), AX // syscall entry MOVL a1+4(FP), BX MOVL a2+8(FP), CX diff --git a/src/pkg/syscall/syscall_nacl.go b/src/pkg/syscall/syscall_nacl.go index 4466f028a15..ae3ed850e11 100644 --- a/src/pkg/syscall/syscall_nacl.go +++ b/src/pkg/syscall/syscall_nacl.go @@ -219,6 +219,8 @@ const ( SO_REUSEADDR; SO_SNDBUF; TCP_NODELAY; + WNOHANG; + WSTOPPED; _PTRACE_TRACEME; ) diff --git a/test/nacl-pass.txt b/test/nacl-pass.txt new file mode 100644 index 00000000000..bd9654eb4ba --- /dev/null +++ b/test/nacl-pass.txt @@ -0,0 +1,287 @@ +./64bit.go +./args.go +./assign.go +./bigalg.go +./blank.go +./blank1.go +./chancap.go +./char_lit.go +./closedchan.go +./cmp1.go +./complit.go +./compos.go +./const.go +./const1.go +./const2.go +./const3.go +./convert.go +./convert3.go +./convlit.go +./convlit1.go +./decl.go +./declbad.go +./empty.go +./escape.go +./escape1.go +./float_lit.go +./for.go +./func.go +./func1.go +./func2.go +./func3.go +./func4.go +./gc.go +./gc1.go +./hashmap.go +./hilbert.go +./if.go +./if1.go +./import.go +./import1.go +./indirect.go +./indirect1.go +./initcomma.go +./initialize.go +./initializerr.go +./initsyscall.go +./int_lit.go +./intcvt.go +./iota.go +./literal.go +./map.go +./method.go +./method1.go +./method2.go +./method3.go +./named.go +./nil.go +./parentype.go +./range.go +./rename.go +./rename1.go +./sieve.go +./simassign.go +./string_lit.go +./stringrange.go +./switch.go +./switch1.go +./test0.go +./typeswitch.go +./typeswitch1.go +./utf.go +./varinit.go +./vectors.go +ken/array.go +ken/chan.go +ken/chan1.go +ken/complit.go +ken/divconst.go +ken/divmod.go +ken/embed.go +ken/for.go +ken/interbasic.go +ken/interfun.go +ken/mfunc.go +ken/modconst.go +ken/ptrfun.go +ken/ptrvar.go +ken/range.go +ken/robfor.go +ken/robfunc.go +ken/robif.go +ken/shift.go +ken/simparray.go +ken/simpbool.go +ken/simpconv.go +ken/simpfun.go +ken/simpvar.go +ken/slicearray.go +ken/sliceslice.go +ken/strvar.go +chan/fifo.go +chan/perm.go +chan/select.go +chan/sieve.go +interface/bigdata.go +interface/convert.go +interface/convert1.go +interface/convert2.go +interface/embed.go +interface/explicit.go +interface/fake.go +interface/pointer.go +interface/receiver.go +interface/receiver1.go +interface/recursive.go +interface/struct.go +fixedbugs/bug000.go +fixedbugs/bug001.go +fixedbugs/bug002.go +fixedbugs/bug003.go +fixedbugs/bug004.go +fixedbugs/bug005.go +fixedbugs/bug006.go +fixedbugs/bug007.go +fixedbugs/bug008.go +fixedbugs/bug009.go +fixedbugs/bug010.go +fixedbugs/bug011.go +fixedbugs/bug012.go +fixedbugs/bug013.go +fixedbugs/bug014.go +fixedbugs/bug015.go +fixedbugs/bug017.go +fixedbugs/bug020.go +fixedbugs/bug021.go +fixedbugs/bug022.go +fixedbugs/bug023.go +fixedbugs/bug024.go +fixedbugs/bug026.go +fixedbugs/bug028.go +fixedbugs/bug030.go +fixedbugs/bug031.go +fixedbugs/bug035.go +fixedbugs/bug036.go +fixedbugs/bug037.go +fixedbugs/bug038.go +fixedbugs/bug039.go +fixedbugs/bug040.go +fixedbugs/bug045.go +fixedbugs/bug046.go +fixedbugs/bug047.go +fixedbugs/bug048.go +fixedbugs/bug049.go +fixedbugs/bug050.go +fixedbugs/bug051.go +fixedbugs/bug052.go +fixedbugs/bug053.go +fixedbugs/bug054.go +fixedbugs/bug056.go +fixedbugs/bug057.go +fixedbugs/bug058.go +fixedbugs/bug059.go +fixedbugs/bug060.go +fixedbugs/bug061.go +fixedbugs/bug062.go +fixedbugs/bug063.go +fixedbugs/bug064.go +fixedbugs/bug065.go +fixedbugs/bug066.go +fixedbugs/bug068.go +fixedbugs/bug069.go +fixedbugs/bug071.go +fixedbugs/bug072.go +fixedbugs/bug073.go +fixedbugs/bug074.go +fixedbugs/bug075.go +fixedbugs/bug076.go +fixedbugs/bug077.go +fixedbugs/bug078.go +fixedbugs/bug080.go +fixedbugs/bug082.go +fixedbugs/bug083.go +fixedbugs/bug084.go +fixedbugs/bug085.go +fixedbugs/bug086.go +fixedbugs/bug087.go +fixedbugs/bug088.go +fixedbugs/bug089.go +fixedbugs/bug090.go +fixedbugs/bug091.go +fixedbugs/bug092.go +fixedbugs/bug094.go +fixedbugs/bug096.go +fixedbugs/bug097.go +fixedbugs/bug098.go +fixedbugs/bug099.go +fixedbugs/bug101.go +fixedbugs/bug102.go +fixedbugs/bug103.go +fixedbugs/bug104.go +fixedbugs/bug106.go +fixedbugs/bug107.go +fixedbugs/bug108.go +fixedbugs/bug109.go +fixedbugs/bug110.go +fixedbugs/bug111.go +fixedbugs/bug112.go +fixedbugs/bug114.go +fixedbugs/bug115.go +fixedbugs/bug116.go +fixedbugs/bug117.go +fixedbugs/bug118.go +fixedbugs/bug119.go +fixedbugs/bug120.go +fixedbugs/bug121.go +fixedbugs/bug122.go +fixedbugs/bug123.go +fixedbugs/bug125.go +fixedbugs/bug126.go +fixedbugs/bug127.go +fixedbugs/bug128.go +fixedbugs/bug129.go +fixedbugs/bug130.go +fixedbugs/bug131.go +fixedbugs/bug132.go +fixedbugs/bug133.go +fixedbugs/bug135.go +fixedbugs/bug137.go +fixedbugs/bug139.go +fixedbugs/bug140.go +fixedbugs/bug141.go +fixedbugs/bug142.go +fixedbugs/bug143.go +fixedbugs/bug144.go +fixedbugs/bug145.go +fixedbugs/bug146.go +fixedbugs/bug149.go +fixedbugs/bug150.go +fixedbugs/bug151.go +fixedbugs/bug152.go +fixedbugs/bug153.go +fixedbugs/bug154.go +fixedbugs/bug155.go +fixedbugs/bug156.go +fixedbugs/bug157.go +fixedbugs/bug158.go +fixedbugs/bug160.go +fixedbugs/bug161.go +fixedbugs/bug163.go +fixedbugs/bug164.go +fixedbugs/bug165.go +fixedbugs/bug166.go +fixedbugs/bug167.go +fixedbugs/bug168.go +fixedbugs/bug170.go +fixedbugs/bug171.go +fixedbugs/bug172.go +fixedbugs/bug173.go +fixedbugs/bug174.go +fixedbugs/bug175.go +fixedbugs/bug176.go +fixedbugs/bug177.go +fixedbugs/bug178.go +fixedbugs/bug179.go +fixedbugs/bug180.go +fixedbugs/bug181.go +fixedbugs/bug182.go +fixedbugs/bug183.go +fixedbugs/bug184.go +fixedbugs/bug185.go +fixedbugs/bug186.go +fixedbugs/bug187.go +fixedbugs/bug188.go +fixedbugs/bug189.go +fixedbugs/bug191.go +fixedbugs/bug192.go +fixedbugs/bug194.go +fixedbugs/bug195.go +fixedbugs/bug197.go +fixedbugs/bug199.go +fixedbugs/bug200.go +fixedbugs/bug201.go +fixedbugs/bug202.go +fixedbugs/bug203.go +fixedbugs/bug204.go +fixedbugs/bug205.go +fixedbugs/bug206.go diff --git a/test/run b/test/run index 56de68aa3a7..f8500547ade 100755 --- a/test/run +++ b/test/run @@ -20,6 +20,11 @@ Xarm) exit 1 esac +case X"$GOOS" in +Xnacl) + export E="nacl" +esac + export G=${A}g export L=${A}l export GOTRACEBACK=0 @@ -36,6 +41,8 @@ TMP2FILE=/tmp/gotest2-$$-$USER # on thresher, 3GB suffices to run the tests; with 2GB, peano fails. ulimit -v 4000000 +true >pass.out + for dir in . ken chan interface fixedbugs bugs do echo @@ -44,7 +51,7 @@ do do export F=$(basename $i .go) export D=$dir - sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE + sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE then echo @@ -61,6 +68,8 @@ do elif [ $dir = "bugs" ] then echo $i succeeded with no output. + else + echo $i >>pass.out fi done done | # clean up some stack noise diff --git a/test/run-nacl b/test/run-nacl new file mode 100755 index 00000000000..69afbce8faf --- /dev/null +++ b/test/run-nacl @@ -0,0 +1,76 @@ +#!/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. + +case X"$GOARCH" in +X386) + export A=8 + export E=nacl + ;; +*) + echo 1>&2 run: unsupported '$GOARCH' + exit 1 +esac + +export G=${A}g +export L=${A}l +export GOTRACEBACK=0 + +failed=0 + +PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/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. +ulimit -v 4000000 + +for i in $(cat nacl-pass.txt) +do + export F=$(basename $i .go) + dir=$(dirname $i) + export D=$dir + sed '/^\/\//!q; s|//||g; s|./\$A.out|$E &|' $i >$RUNFILE + if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE + then + echo + echo "===========" $i + cat $TMP1FILE + cat $TMP2FILE + echo >&2 fail: $i + 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 + +case $failed in +0) + echo PASS + ;; +1) + echo FAIL +esac +rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out + +exit $failed