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]
Other format: [Raw text]

[RFA] testsuite/gdb.base/attach.exp: Fix some Cygwin problems


Hi,

on Cygwin, some of the attach tests are simply failing because the
corresponding output string isn't correctly checked for.  The below
patch fixes that partly.  Some of the tests will need changes in GDB
so I didn't care for them as part of this testsuite fix.

Ok to check in?


Corinna


	* gdb.base/attach.exp: Set testpid to Windows PID for Cygwin.
	(do_attach_tests): Add Cygwin specific strings to check for
	in the nonsense test, the boguspid test and the attach1 test.

Index: gdb.base/attach.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/attach.exp,v
retrieving revision 1.12
diff -u -p -r1.12 attach.exp
--- gdb.base/attach.exp	7 Aug 2003 17:55:41 -0000	1.12
+++ gdb.base/attach.exp	25 Jun 2004 13:09:39 -0000
@@ -88,6 +88,11 @@ proc do_attach_tests {} {
    # that it can be attached to.
    #
    set testpid [eval exec $binfile &]
+   if { [istarget "*-*-cygwin*"] } {
+       # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+       # different due to the way fork/exec works.
+       set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+   }
    exec sleep 2
 
    # Verify that we cannot attach to nonsense.
@@ -101,6 +106,11 @@ proc do_attach_tests {} {
                         # Response expected from /proc-based systems.
                         pass "attach to nonsense is prohibited" 
                       }
+      -re ".*Can't attach to process..*$gdb_prompt $"\
+                      {
+                        # Response expected on Cygwin
+                        pass "attach to nonsense is prohibited"
+                      }
       -re "Attaching to.*$gdb_prompt $"\
                       {fail "attach to nonsense is prohibited (bogus pid allowed)"}
       -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"}
@@ -140,6 +150,11 @@ proc do_attach_tests {} {
 	   # Response expected from /proc-based systems.
 	   pass "attach to nonexistent process is prohibited"
        }
+       -re ".*Can't attach to process..*$gdb_prompt $"\
+               {
+           # Response expected on Cygwin
+           pass "attach to nonexistent process is prohibited"
+       }
        -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"}
        timeout {
 	   fail "(timeout) attach to nonexistent process is prohibited"
@@ -175,6 +190,11 @@ proc do_attach_tests {} {
    gdb_expect {
       -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
                       {pass "attach1, after setting file"}
+      -re "Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $"\
+                      {
+                         # Response expected on Cygwin
+                         pass "attach1, after setting file"
+                      }
       -re "$gdb_prompt $" {fail "attach1, after setting file"}
       timeout         {fail "(timeout) attach1, after setting file"}
    }
@@ -288,6 +308,11 @@ proc do_attach_tests {} {
    # that it can be attached to.
    #
    set testpid [eval exec $binfile &]
+   if { [istarget "*-*-cygwin*"] } {
+       # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+       # different due to the way fork/exec works.
+       set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+   }
    exec sleep 2
 
    # Verify that we can attach to the process, and find its a.out
@@ -365,6 +393,11 @@ proc do_call_attach_tests {} {
    # that it can be attached to.
    #
    set testpid [eval exec $binfile2 &]
+   if { [istarget "*-*-cygwin*"] } {
+       # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+       # different due to the way fork/exec works.
+       set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+   }
    exec sleep 2
 
    # Attach

-- 
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.


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