[RFA] testsuite cleanups (part 1)

Elena Zannoni ezannoni@redhat.com
Tue Jul 29 19:19:00 GMT 2003


I have found other cases in which, if the full path name that expect
tries to match contains weird characters llike '+', things fail. I
have escaped these paths.
OK?

elena

2003-07-28  Elena Zannoni  <ezannoni@redhat.com>

        * gdb.base/attach.exp, gdb.base/detach.exp, gdb.base/gcore.exp,
        gdb.mi/mi-basics.exp, gdb.threads/gcore-thread.exp,
        gdb.trace/save-trace.exp: Make sure that full pathnames are
        escaped correctly.


Index: gdb.base/attach.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/attach.exp,v
retrieving revision 1.11
diff -u -p -r1.11 attach.exp
--- gdb.base/attach.exp	15 Jun 2003 13:10:38 -0000	1.11
+++ gdb.base/attach.exp	29 Jul 2003 19:10:34 -0000
@@ -45,6 +45,7 @@ set srcfile  ${testfile}.c
 set srcfile2 ${testfile}2.c
 set binfile  ${objdir}/${subdir}/${testfile}
 set binfile2 ${objdir}/${subdir}/${testfile}2
+set escapedbinfile  [string_to_regexp ${objdir}/${subdir}/${testfile}]
 set cleanupfile ${objdir}/${subdir}/${testfile}.awk
 
 #execute_anywhere "rm -f ${binfile} ${binfile2}"
@@ -76,6 +77,7 @@ if [get_compiler_info ${binfile}] {
 proc do_attach_tests {} {
    global gdb_prompt
    global binfile
+   global escapedbinfile
    global srcfile
    global testfile
    global objdir
@@ -157,13 +159,13 @@ proc do_attach_tests {} {
       -re "Load new symbol table from.*y or n.*$" {
          send_gdb "y\n"
          gdb_expect {
-            -re "Reading symbols from $binfile\.\.\.*done.*$gdb_prompt $"\
+            -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
                             {pass "(re)set file, before attach1"}
             -re "$gdb_prompt $" {fail "(re)set file, before attach1"}
             timeout         {fail "(timeout) (re)set file, before attach1"}
          }
       }
-      -re "Reading symbols from $binfile\.\.\.*done.*$gdb_prompt $"\
+      -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
                       {pass "set file, before attach1"}
       -re "$gdb_prompt $" {fail "set file, before attach1"}
       timeout         {fail "(timeout) set file, before attach1"}
@@ -171,7 +173,7 @@ proc do_attach_tests {} {
 
    send_gdb "attach $testpid\n"
    gdb_expect {
-      -re "Attaching to program.*`?$binfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
+      -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
                       {pass "attach1, after setting file"}
       -re "$gdb_prompt $" {fail "attach1, after setting file"}
       timeout         {fail "(timeout) attach1, after setting file"}
@@ -192,7 +194,7 @@ proc do_attach_tests {} {
    #
    send_gdb "detach\n"
    gdb_expect {
-      -re "Detaching from program: .*$binfile.*$gdb_prompt $"\
+      -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\
                       {pass "attach1 detach"}
       -re "$gdb_prompt $" {fail "attach1 detach"}
       timeout         {fail "(timeout) attach1 detach"}
@@ -234,7 +236,7 @@ proc do_attach_tests {} {
    #
    send_gdb "attach $testpid\n"
    gdb_expect {
-      -re "Attaching to process $testpid.*Reading symbols from $binfile.*main.*at .*$gdb_prompt $"\
+      -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
                       {pass "attach2"}
       -re "$gdb_prompt $" {fail "attach2"}
       timeout         {fail "(timeout) attach2"}
@@ -335,7 +337,7 @@ proc do_attach_tests {} {
 
    send_gdb "attach $testpid\n"
    gdb_expect {
-      -re "Attaching to process $testpid.*Reading symbols from $binfile.*main.*at .*$gdb_prompt $"\
+      -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
                       {pass "attach when process' a.out not in cwd"}
       -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"}
       timeout         {fail "(timeout) attach when process' a.out not in cwd"}
Index: gdb.base/detach.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/detach.exp,v
retrieving revision 1.1
diff -u -p -r1.1 detach.exp
--- gdb.base/detach.exp	9 Jan 2003 19:18:04 -0000	1.1
+++ gdb.base/detach.exp	29 Jul 2003 19:10:36 -0000
@@ -40,6 +40,7 @@ if [is_remote target] then {
 set testfile "attach"
 set srcfile  ${testfile}.c
 set binfile  ${objdir}/${subdir}/${testfile}
+set escapedbinfile  [string_to_regexp ${objdir}/${subdir}/${testfile}]
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
@@ -48,12 +49,13 @@ if  { [gdb_compile "${srcdir}/${subdir}/
 proc do_detach_tests {} {
   global srcdir
   global binfile
+  global escapedbinfile
   global subdir
   global pass
 
   runto_main
   gdb_test "set should_exit = 1" "" "set should_exit, $pass"
-  gdb_test "detach" "Detaching from program: .*$binfile, .*" "detach, $pass"
+  gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" "detach, $pass"
 }
 
 # Start with a fresh gdb
Index: gdb.base/gcore.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/gcore.exp,v
retrieving revision 1.3
diff -u -p -r1.3 gcore.exp
--- gdb.base/gcore.exp	11 Apr 2002 18:24:08 -0000	1.3
+++ gdb.base/gcore.exp	29 Jul 2003 19:10:36 -0000
@@ -104,8 +104,10 @@ set pre_corefile_local_array \
 set pre_corefile_extern_array \
 	[capture_command_output "print extern_array" "$print_prefix"]
 
+set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
+
 gdb_test "gcore ${objdir}/${subdir}/gcore.test" \
-	"Saved corefile ${objdir}/${subdir}/gcore.test" \
+	"Saved corefile ${escapedfilename}" \
 	"save a corefile"
 
 # Now restart gdb and load the corefile.
Index: gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-basics.exp
--- gdb.mi/mi-basics.exp	13 Dec 2002 17:57:38 -0000	1.7
+++ gdb.mi/mi-basics.exp	29 Jul 2003 19:10:37 -0000
@@ -40,6 +40,9 @@ if [mi_gdb_start] {
 set testfile "basics"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
+set escapedobjdir [string_to_regexp ${objdir}]
+set escapedsrcdir [string_to_regexp ${srcdir}]
+
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
@@ -154,25 +157,25 @@ proc test_dir_specification {} {
     # -environment-directory 
     # -environment-directory -r
 
-#exp_internal 1
+    set envirodir [string_to_regexp ${srcdir}/${subdir}]
+
     mi_gdb_test "202-environment-directory ${srcdir}/${subdir}" \
-             "\\\^done,source-path=\"${srcdir}/${subdir}.\\\$cdir.\\\$cwd\"" \
+             "\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \
              "environment-directory arg operation"
 
     mi_gdb_test "203-environment-directory" \
-             "\\\^done,source-path=\"${srcdir}/${subdir}.\\\$cdir.\\\$cwd\"" \
+             "\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \
              "environment-directory empty-string operation"
 
     mi_gdb_test "204-environment-directory -r" \
              "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
              "environment-directory operation"
-
-#exp_internal 0
 }
 
 proc test_cwd_specification {} {
     global mi_gdb_prompt
     global objdir
+    global escapedobjdir
     global subdir
 
     # Change the working directory, then print the current working directory
@@ -185,7 +188,7 @@ proc test_cwd_specification {} {
              "environment-cd arg operation"
 
     mi_gdb_test "206-environment-pwd" \
-             "\\\^done,cwd=\"${objdir}\"" \
+             "\\\^done,cwd=\"${escapedobjdir}\"" \
              "environment-pwd operation"
 }
 
@@ -194,6 +197,8 @@ proc test_path_specification {} {
     global orig_path
     global objdir
     global srcdir
+    global escapedobjdir
+    global escapedsrcdir
 
     # Add to the path, display, then reset 
     # Tests:
@@ -202,8 +207,6 @@ proc test_path_specification {} {
     # -environment-path -r dir
     # -environment-path -r
 
-#exp_internal 1
-
     send_gdb "-environment-path\n"
     gdb_expect 20 {
 	-re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" { 
@@ -220,18 +223,17 @@ proc test_path_specification {} {
              "environment-path no-args operation"
 
     mi_gdb_test "208-environment-path $srcdir $objdir" \
-             "\\\^done,path=\"$srcdir.$objdir.$orig_path\"" \
+             "\\\^done,path=\"$escapedsrcdir.$escapedobjdir.$orig_path\"" \
              "environment-path dir1 dir2 operation"
 
     mi_gdb_test "209-environment-path -r $objdir" \
-             "\\\^done,path=\"$objdir.$orig_path\"" \
+             "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
              "environment-path -r dir operation"
 
     mi_gdb_test "210-environment-path -r" \
              "\\\^done,path=\"$orig_path\"" \
              "environment-path -r operation"
 
-#exp_internal 0
 } 
 
 if [test_mi_interpreter_selection] {
Index: gdb.threads/gcore-thread.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.threads/gcore-thread.exp,v
retrieving revision 1.3
diff -u -p -r1.3 gcore-thread.exp
--- gdb.threads/gcore-thread.exp	4 Jan 2003 23:05:05 -0000	1.3
+++ gdb.threads/gcore-thread.exp	29 Jul 2003 19:10:37 -0000
@@ -103,9 +103,10 @@ delete_breakpoints
 gdb_breakpoint "thread2"
 gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
 
+set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
 # Drop corefile
 gdb_test "gcore ${objdir}/${subdir}/gcore.test" \
-	"Saved corefile ${objdir}/${subdir}/gcore.test" \
+	"Saved corefile ${escapedfilename}" \
 	"save a corefile"
 
 # Now restart gdb and load the corefile.
Index: gdb.trace/save-trace.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.trace/save-trace.exp,v
retrieving revision 1.2
diff -u -p -r1.2 save-trace.exp
--- gdb.trace/save-trace.exp	6 Mar 2001 08:22:00 -0000	1.2
+++ gdb.trace/save-trace.exp	29 Jul 2003 19:10:37 -0000
@@ -145,9 +145,10 @@ remote_file host delete savetrace.tr
 
 # 10.3 repeat with a path to the file
 
+set escapedfilename [string_to_regexp $objdir/savetrace.tr]
 remote_file host delete $objdir/savetrace.tr
 gdb_test "save-tracepoints $objdir/savetrace.tr" \
-	"Tracepoints saved to file '$objdir/savetrace.tr'." \
+	"Tracepoints saved to file '${escapedfilename}'." \
 	"10.3: save tracepoint definitions, full path"
 
 gdb_delete_tracepoints



More information about the Gdb-patches mailing list