Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-22 Thread Bruce Korb



Rather simple...  In a file called fixinclude.sum, put

   PASS: unique string

or

   FAIL: unique string

one per line,

Bonus points if you can total passes and failures:


I think you just put it into the check template so it creates the result.
Since multiple fixes tweak the same file, there really isn't a way to
figure out what has passed.  You can only figure out what has failed.
So, let's just call it one test.

+fix_sum_fmt='%s: fixincludes
+
+# of expected passes1
+# of expected failures  0
+# of unexpected failures%s\n'

Do I get the bonus points? :D
Index: check.tpl
===
--- check.tpl	(revision 184997)
+++ check.tpl	(working copy)
@@ -25,7 +25,7 @@
 
 rm -rf ${DESTDIR} ${SRCDIR}
 mkdir ${DESTDIR} ${SRCDIR}
-(
+{
 [=
   (shellf
 for f in %s
@@ -36,7 +36,7 @@
  while read g
  do echo \  mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\
  done (join   (stack fix.files))  ) =]
-) 2 /dev/null[= # suppress 'No such file or directory' messages =]
+} 2 /dev/null[= # suppress 'No such file or directory' messages =]
 cd inc
 [=
 (define sfile )
@@ -114,29 +114,21 @@
 sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h  XX
 mv -f XX sys/types.h
 
-#  The following subshell weirdness is for saving an exit
-#  status from within a while loop that reads input.  If you can
-#  think of a cleaner way, suggest away, please...
-#
-exitok=`
 exec  ${TESTDIR}/LIST
 while read f
 do
   if [ ! -f ${TESTBASE}/$f ]
   then
-echo Newly fixed header:  $f 2
-exitok=false
+echo FAIL: Newly fixed header:  $f 2
 
-  elif cmp $f ${TESTBASE}/$f 2
+  elif cmp $f ${TESTBASE}/$f
   then
 :
 
   else
-${DIFF:-diff} -c $f ${TESTBASE}/$f 2 || :
-exitok=false
+${DIFF:-diff} -c $f ${TESTBASE}/$f
   fi
-done
-echo $exitok`
+done  FAILURES.txt
 
 cd $TESTBASE
 
@@ -144,30 +136,36 @@
 fgrep -v 'CVS/' | \
 fgrep -v '.svn/'  ${TESTDIR}/LIST
 
-exitok=`
 exec  ${TESTDIR}/LIST
 while read f
 do
   if [ -s $f ]  [ ! -f ${DESTDIR}/$f ]
   then
-echo Missing header fix:  $f 2
-exitok=false
+echo FAIL: Missing header fix:  $f
   fi
-done
-echo $exitok`
+done  ${DESTDIR}/FAILURES.txt
+
+fix_sum_fmt='%s: fixincludes
+
+# of expected passes1
+# of expected failures  0
+# of unexpected failures%s\n'
 
 echo
-if $exitok
+if test -s ${DESTDIR}/FAILURES.txt
 then
-  cd ${TESTDIR}
-  rm -rf inc res LIST
-  cd ..
-  rmdir ${TESTDIR}  /dev/null 21 || :
-  echo All fixinclude tests pass 2
-else
-  echo There were fixinclude test FAILURES  2
-fi
-$exitok[=
+  echo There were fixinclude test FAILURES
+  cat ${DESTDIR}/FAILURES.txt
+  printf $fix_sum_fmt FAIL 1  ${DESTDIR}/fixincludes.sum
+  exit 1
+fi  2
+
+printf $fix_sum_fmt PASS 0  ${DESTDIR}/fixincludes.sum
+cd ${TESTDIR}
+rm -rf inc res LIST
+cd ..
+rmdir ${TESTDIR}  /dev/null 21 || :
+echo All fixinclude tests pass 2[=
 
 (if (defined? 'set-writable) (set-writable))
 


Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-22 Thread Mike Stump
On Mar 22, 2012, at 3:40 PM, Bruce Korb wrote:
 You can only figure out what has failed.

Life goes on

 Do I get the bonus points?

make check

and cat fixincludes.sum

is necessary to get the bonus points.  :-)  Looks fine from what I can see.


Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-21 Thread Bruce Korb
Hi Rainer,

On Wed, Mar 21, 2012 at 9:25 AM, Rainer Orth
r...@cebitec.uni-bielefeld.de wrote:
 As reported in PR other/52626, make check in fixincludes is currently
 failing since I neglected to adapt the baseline for the Solaris 8
 removal ;-(  I always meant to run make check, but forgot.

 On the other hand, it would be really helpful if fixincludes make check
 could emit DejaGnu-style fixincludes.{sum, log} files which would
 automatically be picked up by make mail-report.log and make failures
 immediately obvious.

Patch welcome!  I, myself, don't know what emit DejaGnu-style
fixincludes.{sum, log} files would mean.

 The following patch fixes this, tested with make check in fixincludes on
 i386-pc-solaris2.11.

 Ok for mainline?

I'm sure you examined the difference by hand and confirmed that the change is
expected.  Then yes, please, by all means.  Thank you!  - Bruce


Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-21 Thread Mike Stump
On Mar 21, 2012, at 10:16 AM, Bruce Korb wrote:
 Patch welcome!  I, myself, don't know what emit DejaGnu-style
 fixincludes.{sum, log} files would mean.

Rather simple...  In a file called fixinclude.sum, put

  PASS: unique string

or

  FAIL: unique string

one per line, as many times as you want.  The unique strings should be 
meaningful to you in some way, and be stable over long periods of time (no 
`pwd` or `date` in them for example).  You can write a python script, a awk 
script, a bash script or a c program to generate this.  You can synthesize this 
from any source you can pull from, for example, the existing testing code or 
test report you might have.

Bonus points if you can total passes and failures:

exec $file
echo
echo # of expected passes$(cat $file | grep 'PASS:' | wc -l)
echo # of expected failures$(cat $file | grep 'FAIL:' | wc -l)

at the end of the file.  The above by the way, will add it (/bin/sh style), if 
you just create the $file.  That's it, done.  For example, if you just had a 
single, it all worked flawlessly thing, you could do:

if check-cmd; then
 echo PASS: fixinclude
else
 echo FAIL: fixinclude
fi

and then the code above, and viola, you're done.  To create the .log file, cp 
fixincludes.sum fixincludes.log, if you have nothing better to do.


Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-21 Thread Mike Stump
On Mar 21, 2012, at 2:46 PM, Mike Stump wrote:
 echo # of expected failures$(cat $file | grep 'FAIL:' | wc -l)

Oh, and if you expect perfection, you should use:

echo # of unexpected failures$(cat $file | grep 'FAIL:' | wc -l)

instead.