This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pch] rework testsuite to avoid path miscompares


The last thing needed to get clean compares on dwarf2 is to
have the path names match when including or compiling the
regular header.

Before, we'd precompile the header in it's location in the
source tree, and place the result in the build tree.  Later,
hen compiling without the precompiled header, we'd copy the
header into the build tree and use it from there.

This meant that foo.h was in $srcdir/gcc/testsuite/gcc.dg/pch/
for the precompiled case and in $builddir/gcc/testsuite for the
non-precompiled case.  Which automatically fails.

Fixed by *always* copying the header to the build tree when
it's used.

This required renaming things, since we need to precompile with
the header named foo.h (so that we match the c-header rule).
If we were to include foo.hp, we'd fail again, since ".h" != ".hp".
We don't want the header named in the testsuite source tree
the same way that it is used in the test lest we accidentally
not use the precompiled header and not notice.


r~


        * gcc.dg/pch/pch.exp: Copy test header to the working directory
        before using it either for precompilation or direct use.
        * gcc.dg/pch/*.hs: Rename from gcc.dg/pch/*.h.
        * gcc.dg/pch/*.c: Include foo.h, not foo.hp.

Index: gcc.dg/pch/pch.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/pch.exp,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 pch.exp
--- gcc.dg/pch/pch.exp	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/pch.exp	17 Jan 2003 02:44:47 -0000
@@ -36,11 +36,10 @@ foreach test [lsort [glob -nocomplain $s
     set nshort [file tail [file dirname $test]]/[file tail $test]
     set bname "[file rootname [file tail $test]]"
 
-    catch { file delete "$bname.hp.pch" }
     catch { file delete "$bname.h.pch" }
+    catch { file delete "$bname.h" }
     catch { file delete "$bname.s" }
     catch { file delete "$bname.s-pch" }
-    catch { file delete "$bname.hp" }
 
     # We don't try to use the loop-optimizing options, since they are highly
     # unlikely to make any difference to PCH.
@@ -49,30 +48,22 @@ foreach test [lsort [glob -nocomplain $s
 
 	# For the header files, the default is to precompile.
 	set dg-do-what-default precompile
-	dg-test -keep-output "[file rootname $test].h" $flags ""
+	file copy "[file rootname $test].hs" "$bname.h"
+	dg-test -keep-output "$bname.h" $flags ""
 
 	# For the rest, the default is to compile to .s.
 	set dg-do-what-default compile
 
 	if { [ file exists "$bname.h.pch" ] } {
-	    # To ensure that the PCH is used, not the original header,
-	    # the actual PCH file is renamed to "<foo>.hp.pch".
-	    file rename "$bname.h.pch" "$bname.hp.pch"
-	    if { [ is_remote host ] } {
-		remote_download host "$bname.hp.pch"
-	    }
+	    # Ensure that the PCH file is used, not the original header.
+	    file delete "$bname.h"
 
 	    dg-test -keep-output $test $flags "-I."
-	    file delete "$bname.hp.pch"
+	    file delete "$bname.h.pch"
 	    if { [ file exists "$bname.s" ] } {
 		file rename "$bname.s" "$bname.s-pch"
-		if { [ is_remote host ] } {
-		    remote_upload host "[file rootname $test].h" "$bname.hp"
-		} else {
-		    file copy "[file rootname $test].h" "$bname.hp"
-		}
+		file copy "[file rootname $test].hs" "$bname.h"
 		dg-test -keep-output $test $flags "-I."
-		remote_file host delete "$bname.hp"
 		set tmp [ diff "$bname.s" "$bname.s-pch" ]
 		if { $tmp == 0 } {
 		    untested "$nshort $flags assembly comparison"
@@ -81,6 +72,7 @@ foreach test [lsort [glob -nocomplain $s
 		} else {
 		    fail "$nshort $flags assembly comparison"
 		}
+		file delete "$bname.h"
 		file delete "$bname.s"
 		file delete "$bname.s-pch"
 	    } else {
Index: gcc.dg/pch/common-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/common-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 common-1.c
--- gcc.dg/pch/common-1.c	10 Jan 2003 02:22:29 -0000	1.2
+++ gcc.dg/pch/common-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,3 +1,3 @@
-#include "common-1.hp"
+#include "common-1.h"
 int foo2 = 3;
 int zz = 2;
Index: gcc.dg/pch/cpp-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/cpp-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cpp-1.c
--- gcc.dg/pch/cpp-1.c	10 Jan 2003 02:22:29 -0000	1.2
+++ gcc.dg/pch/cpp-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "cpp-1.hp"
+#include "cpp-1.h"
 #if !defined(__GNUC__)
 panic! panic!
 #endif
Index: gcc.dg/pch/cpp-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/cpp-2.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cpp-2.c
--- gcc.dg/pch/cpp-2.c	10 Jan 2003 02:22:29 -0000	1.2
+++ gcc.dg/pch/cpp-2.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
 /* { dg-options "-Wunknown-pragmas -I." } */
-#include "cpp-2.hp"
+#include "cpp-2.h"
 #pragma GCC poison not_used
 
Index: gcc.dg/pch/decl-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/decl-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 decl-1.c
--- gcc.dg/pch/decl-1.c	10 Jan 2003 02:22:29 -0000	1.2
+++ gcc.dg/pch/decl-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,2 +1,2 @@
-#include "decl-1.hp"
+#include "decl-1.h"
 int main(void) { return foo; }
Index: gcc.dg/pch/decl-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/decl-2.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 decl-2.c
--- gcc.dg/pch/decl-2.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/decl-2.c	17 Jan 2003 02:44:47 -0000
@@ -1,2 +1,2 @@
-#include "decl-2.hp"
+#include "decl-2.h"
 int main(void) { return fun (1, 2); }
Index: gcc.dg/pch/decl-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/decl-3.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 decl-3.c
--- gcc.dg/pch/decl-3.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/decl-3.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "decl-3.hp"
+#include "decl-3.h"
 
 foo_p bar (void) 
 {
Index: gcc.dg/pch/decl-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/decl-4.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 decl-4.c
--- gcc.dg/pch/decl-4.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/decl-4.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "decl-4.hp"
+#include "decl-4.h"
 
 int bar (foo_p f)
 {
Index: gcc.dg/pch/decl-5.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/decl-5.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 decl-5.c
--- gcc.dg/pch/decl-5.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/decl-5.c	17 Jan 2003 02:44:47 -0000
@@ -1,2 +1,2 @@
-#include "decl-5.hp"
+#include "decl-5.h"
 static int (*t)(void) = foo;
Index: gcc.dg/pch/empty.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/empty.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 empty.c
--- gcc.dg/pch/empty.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/empty.c	17 Jan 2003 02:44:47 -0000
@@ -1,6 +1,6 @@
 /* Yes, it's called "empty" because it has no contents at all.  
    Even this comment goes here, rather than in empty.h.  */
-#include "empty.hp"
+#include "empty.h"
 
 int main(void) 
 {
Index: gcc.dg/pch/except-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/except-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 except-1.c
--- gcc.dg/pch/except-1.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/except-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,5 +1,5 @@
 /* { dg-options "-fexceptions -I." } */
-#include "except-1.hp"
+#include "except-1.h"
 
 int main(void) 
 {
Index: gcc.dg/pch/global-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/global-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 global-1.c
--- gcc.dg/pch/global-1.c	10 Jan 2003 02:22:30 -0000	1.2
+++ gcc.dg/pch/global-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,2 +1,2 @@
-#include "global-1.hp"
+#include "global-1.h"
 const int bar = 3;
Index: gcc.dg/pch/inline-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/inline-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 inline-1.c
--- gcc.dg/pch/inline-1.c	10 Jan 2003 02:22:31 -0000	1.2
+++ gcc.dg/pch/inline-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "inline-1.hp"
+#include "inline-1.h"
 int bar(int a, int b)
 {
   return foo(a) + b;
Index: gcc.dg/pch/inline-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/inline-2.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 inline-2.c
--- gcc.dg/pch/inline-2.c	10 Jan 2003 02:22:31 -0000	1.2
+++ gcc.dg/pch/inline-2.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "inline-2.hp"
+#include "inline-2.h"
 extern inline char
 bar(int a)
 {
Index: gcc.dg/pch/macro-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/macro-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 macro-1.c
--- gcc.dg/pch/macro-1.c	10 Jan 2003 02:22:32 -0000	1.2
+++ gcc.dg/pch/macro-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "macro-1.hp"
+#include "macro-1.h"
 
 int main(void) 
 {
Index: gcc.dg/pch/macro-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/macro-2.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 macro-2.c
--- gcc.dg/pch/macro-2.c	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/macro-2.c	17 Jan 2003 02:44:47 -0000
@@ -1,6 +1,6 @@
 #define DEFINED_VALUE_2 3
 
-#include "macro-2.hp"
+#include "macro-2.h"
 
 int main(void) 
 {
Index: gcc.dg/pch/macro-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/macro-3.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 macro-3.c
--- gcc.dg/pch/macro-3.c	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/macro-3.c	17 Jan 2003 02:44:47 -0000
@@ -1,6 +1,6 @@
 #define DEFINED_FUNC_2(x) (3 + (x))
 
-#include "macro-3.hp"
+#include "macro-3.h"
 
 int main(void) 
 {
Index: gcc.dg/pch/static-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/static-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 static-1.c
--- gcc.dg/pch/static-1.c	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/static-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "static-1.hp"
+#include "static-1.h"
 static int bar(void)
 {
   static int counter;
Index: gcc.dg/pch/static-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/static-2.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 static-2.c
--- gcc.dg/pch/static-2.c	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/static-2.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "static-2.hp"
+#include "static-2.h"
 int bar(void)
 {
   static int counter;
Index: gcc.dg/pch/system-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/system-1.c,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 system-1.c
--- gcc.dg/pch/system-1.c	10 Jan 2003 02:22:33 -0000	1.2
+++ gcc.dg/pch/system-1.c	17 Jan 2003 02:44:47 -0000
@@ -1,4 +1,4 @@
-#include "system-1.hp"
+#include "system-1.h"
 int main(void)
 {
   puts ("hello world!");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]