This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[RFC] testsuite/lib/pascal.exp: Handle cygwin path to windows path conversion


I have a problem when I try to test
the Free Pascal compiler on Cygwin testsuite
because Free Pascal is a native win32 executable 
and as such, does not understand cygwin pathes.

  The cygpath command allows to generate
the win32 corresponding name of a cygwin path,
I tried to use that for pascal.exp file.

  The patch seems to work, but 
there are two things:
1) Is there an easier way to
get the result from cygpath?
2) The resulting source or dest variable may contain
spaces, as those are allowed on Windows OS,
how can I embrace those variables with single quotes or double
quotes? I tried several things but none really
worked out :(


Pierre Muller
Pascal language maintainer

PS: I think that we could use a similar scheme to
be able to use cygwin dejagnu to run the testsuite
on GDB compiler for MingW.


$ cvs diff -up pascal.exp
Index: pascal.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/pascal.exp,v
retrieving revision 1.2
diff -u -p -r1.2 pascal.exp
--- pascal.exp  1 Jan 2008 22:53:22 -0000       1.2
+++ pascal.exp  30 Jan 2008 14:00:42 -0000
@@ -100,6 +100,11 @@ proc gpc_compile {source dest type optio
 proc fpc_compile {source dest type options} {
     global fpc_compiler
     set add_flags ""
+    set use_cygpath "no"
+    if {[istarget *-*-cygwin*]} {
+       set use_cygpath "yes"
+    }
+
     if {$type == "object"} {
        append add_flags " -Cn"
     }
@@ -121,6 +126,16 @@ proc fpc_compile {source dest type optio
            }
        }
     }
+    if { $use_cygpath == "yes" } {
+      set resdest [remote_exec host cygpath "-m $dest"]
+      set dest [lindex $resdest 1]
+      regsub -all {(\r|\n)} $dest "" dest
+      set ressource [remote_exec host cygpath "-m $source"]
+      set source [lindex $ressource 1]
+      regsub -all {(\r|\n)} $source "" source
+    }
+    verbose "Compiling '$source' to '$dest' using $fpc_compiler"
+    verbose "Using '$add_flags' options"

     set result [remote_exec host $fpc_compiler "-o$dest $add_flags
$source"]
     return $result



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