public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [fixincludes] Fix pthread.h failure (PR other/52626)
@ 2012-03-21 16:26 Rainer Orth
  2012-03-21 17:16 ` Bruce Korb
  0 siblings, 1 reply; 6+ messages in thread
From: Rainer Orth @ 2012-03-21 16:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bruce Korb

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

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.

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

Ok for mainline?

	Rainer


2012-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR other/52626
	* tests/base/pthread.h [SOLARIS_MUTEX_INIT_2_CHECK]
	(PTHREAD_COND_INITIALIZER): Adapt for solaris_cond_init removal.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fixincludes-pthread_cond_init.patch --]
[-- Type: text/x-patch, Size: 844 bytes --]

# HG changeset patch
# Parent aa297e98c9489d9734c7a503fc3275455c33985e
Fix pthread.h failure (PR other/52626)

diff --git a/fixincludes/tests/base/pthread.h b/fixincludes/tests/base/pthread.h
--- a/fixincludes/tests/base/pthread.h
+++ b/fixincludes/tests/base/pthread.h
@@ -83,9 +83,9 @@ extern int __sigsetjmp (struct __jmp_buf
 #define PTHREAD_MUTEX_INITIALIZER	{{{0},0}, {{{0}}}, {0}}
 #endif
 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
-#define PTHREAD_COND_INITIALIZER	{{{0}, 0, 0x4356}, 0}	/* DEFAULTCV */
+#define PTHREAD_COND_INITIALIZER	{{{0}, 0}, 0}	/* DEFAULTCV */
 #else
-#define PTHREAD_COND_INITIALIZER	{{{0}, 0, 0x4356}, {0}}	/* DEFAULTCV */
+#define PTHREAD_COND_INITIALIZER	{{{0}, 0}, {0}}	/* DEFAULTCV */
 #endif
 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
 #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [fixincludes] Fix pthread.h failure (PR other/52626)
  2012-03-21 16:26 [fixincludes] Fix pthread.h failure (PR other/52626) Rainer Orth
@ 2012-03-21 17:16 ` Bruce Korb
  2012-03-21 21:46   ` Mike Stump
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Korb @ 2012-03-21 17:16 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

Hi Rainer,

On Wed, Mar 21, 2012 at 9:25 AM, Rainer Orth
<ro@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [fixincludes] Fix pthread.h failure (PR other/52626)
  2012-03-21 17:16 ` Bruce Korb
@ 2012-03-21 21:46   ` Mike Stump
  2012-03-21 21:52     ` Mike Stump
  2012-03-22 22:40     ` Bruce Korb
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Stump @ 2012-03-21 21:46 UTC (permalink / raw)
  To: Bruce Korb; +Cc: Rainer Orth, gcc-patches

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [fixincludes] Fix pthread.h failure (PR other/52626)
  2012-03-21 21:46   ` Mike Stump
@ 2012-03-21 21:52     ` Mike Stump
  2012-03-22 22:40     ` Bruce Korb
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Stump @ 2012-03-21 21:52 UTC (permalink / raw)
  To: Mike Stump; +Cc: Bruce Korb, Rainer Orth, gcc-patches

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [fixincludes] Fix pthread.h failure (PR other/52626)
  2012-03-21 21:46   ` Mike Stump
  2012-03-21 21:52     ` Mike Stump
@ 2012-03-22 22:40     ` Bruce Korb
  2012-03-23  0:23       ` Mike Stump
  1 sibling, 1 reply; 6+ messages in thread
From: Bruce Korb @ 2012-03-22 22:40 UTC (permalink / raw)
  To: Mike Stump; +Cc: Rainer Orth, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]


> 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 passes            1
+# of expected failures          0
+# of unexpected failures        %s\n'

Do I get the bonus points? :D

[-- Attachment #2: check.diff --]
[-- Type: text/x-patch, Size: 2474 bytes --]

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 passes            1
+# 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 2>&1 || :
-  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 2>&1 || :
+echo All fixinclude tests pass >&2[=
 
 (if (defined? 'set-writable) (set-writable))
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [fixincludes] Fix pthread.h failure (PR other/52626)
  2012-03-22 22:40     ` Bruce Korb
@ 2012-03-23  0:23       ` Mike Stump
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 2012-03-23  0:23 UTC (permalink / raw)
  To: bkorb; +Cc: Rainer Orth, gcc-patches

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-23  0:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-21 16:26 [fixincludes] Fix pthread.h failure (PR other/52626) Rainer Orth
2012-03-21 17:16 ` Bruce Korb
2012-03-21 21:46   ` Mike Stump
2012-03-21 21:52     ` Mike Stump
2012-03-22 22:40     ` Bruce Korb
2012-03-23  0:23       ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).