9fans.net/go@v0.0.7/cmd/sam/test.sh (about)

     1  #!/usr/local/plan9/bin/rc
     2  
     3  sam=./sam
     4  if(~ $1 -std) {
     5  	sam=$PLAN9/bin/sam
     6  	shift
     7  }
     8  if(~ $#* 0)
     9  	*=(testdata/*.txt)
    10  if(~ $sam(1) ./sam)
    11  	go build -race || exit 1
    12  fail=()
    13  for(i) {
    14  	rm -f tmp tmp2
    15  	echo '#' $i
    16  	sed -n '/^-- out --$/,$p' $i | sed 1d >test.want
    17  	sed '/^-- out --$/q' $i | sed '/^-- out --$/d' |
    18  		$sam -d >[2=1] | sed '
    19  			s/ *$//
    20  			s/No such file/no such file/
    21  		' > test.have
    22  	if (! 9 diff -c test.want test.have >test.diff) {
    23  		echo FAIL with diff:
    24  		cat test.diff
    25  		fail=($fail $i)
    26  		exit 1
    27  	}
    28  }
    29  if(! ~ $#fail 0) {
    30  	echo FAILED: $fail
    31  	exit 1
    32  }
    33  rm -f test.have test.want test.err test.diff
    34  exit 0