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]

[testsuite] (checked in) fix filename handling in compat.exp


This patch fixes processing of file names for compatibility tests to
avoid changing directory paths containing "main".  Tested on
powerpc64-linux, checked in on mainline.

2007-03-27  Janis Johnson  <janis187@us.ibm.com>

	* lib/compat.exp (compat-execute): Fix processing of file names.

Index: gcc/testsuite/lib/compat.exp
===================================================================
--- gcc/testsuite/lib/compat.exp	(revision 123220)
+++ gcc/testsuite/lib/compat.exp	(working copy)
@@ -259,10 +259,13 @@
     }
 
     # Set up the names of the other source files.
-    regsub "_main.*" $src1 "" base
-    regsub ".*/" $base "" base
-    regsub "_main" $src1 "_x" src2
-    regsub "_main" $src1 "_y" src3
+    set dir [file dirname $src1]
+    set ext [file extension $src1]
+    set base [file rootname $src1]
+    set base [string range $base [string length $dir] end]
+    regsub "_main" $base "" base
+    set src2 "${dir}/${base}_x${ext}"
+    set src3 "${dir}/${base}_y${ext}"
 
     # Use the dg-options mechanism to specify extra flags for this test. 
     # The extra flags in each file are used to compile that file, and the


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