This is the mail archive of the gdb-patches@sources.redhat.com 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]

DejaGnu PATCH to lib/dg.exp: enhance support for "exotic" dir-names



I'm sending this patch to gdb-patches@sources.redhat.com since the
"official" site (according to src/MAINTAINERS)

	http://dejagnu.sourceforge.net/ 

is down.

While developping a new style DejaGnu-based testsuite framework for
libstdc++-v3, I came across the fact that dg.exp is unable to properly
handle directory-names which contain characters having special meaning
for Tcl regexp machinery.  The patch below is intended to overcome
that problem.  It is working for me.  Is it OK? If so please install
it.  If not, please let me know as soon as possible.

Best,

-- Gaby
CodeSourcery, LLC            http://www.codesourcery.com
     http://www.codesourcery.com/gcc-compile.shtml

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/dejagnu/ChangeLog,v
retrieving revision 1.26
diff -p -r1.26 ChangeLog
*** ChangeLog	2001/01/15 04:09:15	1.26
--- ChangeLog	2001/01/18 22:34:28
***************
*** 1,3 ****
--- 1,8 ----
+ 2001-01-18  Gabriel Dos Reis  <gdr@codesourcery.com>
+ 
+ 	* lib/dg.exp (dg-trim-dirname): New function.
+ 	(dg-test): Use it to rip directory-name out of file name.
+ 
  2001-01-15  Ben Elliston  <bje@redhat.com>
  
  	* lib/framework.exp (record_test): Invoke a user-defined procedure
Index: lib/dg.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/dg.exp,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 dg.exp
*** dg.exp	1999/11/09 01:28:42	1.1.1.1
--- dg.exp	2001/01/18 22:34:29
*************** proc dg-runtest { testcases flags defaul
*** 586,591 ****
--- 586,604 ----
      }
  }
  
+ # dg-trim-dirname -- rip DIR_NAME out of FILE_NAME
+ # 
+ # Syntax: dg-trim-dirname dir_name file_name
+ # We need to go through this contorsion in order to properly support
+ # directory-names which might have embedded regexp special characters.
+ 
+ proc dg-trim-dirname { dir_name file_name } {
+     set special_character "\[\?\+\-\*\.\$\|\(\)\]"
+     regsub -all $special_character $dir_name "\\\\&" dir_name
+     regsub "^$dir_name/?" $file_name "" file_name
+     return $file_name
+ }
+ 
  # dg-test -- runs a new style DejaGnu test
  #
  # Syntax: dg-test [-keep-output] prog tool_flags default_extra_tool_flags
*************** proc dg-test { args } {
*** 631,637 ****
  
      set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]*"
  
!     regsub "^$srcdir/?" $prog "" name
      # If we couldn't rip $srcdir out of `prog' then just do the best we can.
      # The point is to reduce the unnecessary noise in the logs.  Don't strip
      # out too much because different testcases with the same name can confuse
--- 644,650 ----
  
      set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]*"
  
!     set name [dg-trim-dirname $srcdir $prog]
      # If we couldn't rip $srcdir out of `prog' then just do the best we can.
      # The point is to reduce the unnecessary noise in the logs.  Don't strip
      # out too much because different testcases with the same name can confuse

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