Commit 925454e9 authored by Russ Cox's avatar Russ Cox

make sure errchk only says BUG once,

so that run's count is correct

R=iant,r
DELTA=20  (12 added, 0 deleted, 8 changed)
OCL=17329
CL=17342
parent 61d9a3c3
...@@ -43,6 +43,15 @@ fi ...@@ -43,6 +43,15 @@ fi
cat $TMPOUT $TMPERR | grep -v '^ ' > $TMPALL cat $TMPOUT $TMPERR | grep -v '^ ' > $TMPALL
didbug=false
bug() {
if ! $didbug
then
echo 1>&2 -n BUG: ''
didbug=true
fi
}
header=0 header=0
echo 0 > $TMPSTAT echo 0 > $TMPSTAT
pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
...@@ -52,17 +61,20 @@ pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do ...@@ -52,17 +61,20 @@ pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
grep -v "$SOURCEFILE:$lineno" < $TMPALL > $TMPTMP grep -v "$SOURCEFILE:$lineno" < $TMPALL > $TMPTMP
mv -f $TMPTMP $TMPALL mv -f $TMPTMP $TMPALL
if test -z "$errmsg"; then if test -z "$errmsg"; then
echo 1>&2 "BUG: errchk: $SOURCEFILE: missing expected error message on line $lineno: '$regexp'" bug
echo 1>&2 "errchk: $SOURCEFILE: missing expected error message on line $lineno: '$regexp'"
echo 1 > $TMPSTAT echo 1 > $TMPSTAT
elif ! echo "$errmsg" | egrep -q "$regexp"; then elif ! echo "$errmsg" | egrep -q "$regexp"; then
echo 1>&2 "BUG: errchk: $SOURCEFILE: error message on line $lineno does not match '$regexp'" bug
echo 1>&2 "errchk: $SOURCEFILE: error message on line $lineno does not match '$regexp'"
echo 1>&2 $errmsg echo 1>&2 $errmsg
echo 1 > $TMPSTAT echo 1 > $TMPSTAT
fi fi
done done
if test -s $TMPALL; then if test -s $TMPALL; then
echo 1>&2 "BUG: errchk: $SOURCEFILE: unmatched error messages:" bug
echo 1>&2 "errchk: $SOURCEFILE: unmatched error messages:"
echo 1>&2 "==================================================" echo 1>&2 "=================================================="
cat 1>&2 $TMPALL cat 1>&2 $TMPALL
echo 1>&2 "==================================================" echo 1>&2 "=================================================="
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
=========== ./convlit.go =========== ./convlit.go
BUG: convlit.go fails BUG: convlit.go fails
BUG: errchk: ./convlit.go: missing expected error message on line 16: 'conver' BUG: errchk: ./convlit.go: missing expected error message on line 16: 'conver'
BUG: errchk: ./convlit.go: missing expected error message on line 17: 'conver' errchk: ./convlit.go: missing expected error message on line 17: 'conver'
BUG: errchk: ./convlit.go: missing expected error message on line 18: 'conver' errchk: ./convlit.go: missing expected error message on line 18: 'conver'
BUG: errchk: ./convlit.go: missing expected error message on line 22: 'convert' errchk: ./convlit.go: missing expected error message on line 22: 'convert'
BUG: errchk: ./convlit.go: missing expected error message on line 23: 'overflow' errchk: ./convlit.go: missing expected error message on line 23: 'overflow'
BUG: errchk: ./convlit.go: missing expected error message on line 24: 'overflow' errchk: ./convlit.go: missing expected error message on line 24: 'overflow'
BUG: errchk: ./convlit.go: unmatched error messages: BUG: errchk: ./convlit.go: unmatched error messages:
================================================== ==================================================
./convlit.go:8: cannot convert non-integer constant to int32 ./convlit.go:8: cannot convert non-integer constant to int32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment