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]

[commit] Clean up sizeof.exp


Especially where gdb_test{,_multiple} works best. Also fixes some of the test messages which contained system dependant output.

Tested on amd64.

committed,
Andrew
2004-07-13  Andrew Cagney  <cagney@gnu.org>

	* gdb.base/sizeof.exp: Skip test when no inferior I/O.
	(check_sizeof, check_valueof): Do not include the output in the
	test name.  Use gdb_test.
	(get_valueof): Use gdb_test_multiple.

Index: gdb.base/sizeof.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sizeof.exp,v
retrieving revision 1.6
diff -p -u -r1.6 sizeof.exp
--- gdb.base/sizeof.exp	15 Jun 2004 00:16:42 -0000	1.6
+++ gdb.base/sizeof.exp	13 Jul 2004 17:07:26 -0000
@@ -16,6 +16,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
+if [target_info exists gdb,noinferiorio] {
+    verbose "Skipping fileio.exp because of no fileio capabilities."
+    continue
+}
+
 if $tracelevel {
     strace $tracelevel
 }
@@ -57,15 +62,13 @@ if ![runto_main] then {
 
 proc get_valueof { fmt exp default } {
     global gdb_prompt
-    send_gdb "print${fmt} ${exp}\n"
-    gdb_expect {
+
+    set test "get valueof \"${exp}\""
+    set val ${default}
+    gdb_test_multiple "print${fmt} ${exp}" "$test" {
 	-re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
 	    set val $expect_out(1,string)
-	    pass "get value of ${exp} ($val)"
-	}
-	timeout {
-	    set size ${default}
-	    fail "get value of ${exp} (timeout)"
+	    pass "$test ($val)"
 	}
     }
     return ${val}
@@ -97,17 +100,8 @@ set sizeof_long_double [get_sizeof "long
 proc check_sizeof { type size } {
     global gdb_prompt
 
-    if [gdb_skip_stdio_test "check sizeof $type == $size"] {
-	return;
-    }
-
     set pat [string_to_regexp "sizeof (${type}) == ${size}"]
-    set test "check sizeof ${type}"
-    gdb_test_multiple "next" "$test" {
-	-re "${pat}\[\r\n\].*$gdb_prompt $" {
-	    pass "$test"
-	}
-    }
+    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*"  "check sizeof \"$type\""
 }
 
 check_sizeof "char" ${sizeof_char}
@@ -126,23 +120,8 @@ check_sizeof "long double" ${sizeof_long
 proc check_valueof { exp val } {
     global gdb_prompt
 
-    if [gdb_skip_stdio_test "check valueof $exp == $val"] {
-	return;
-    }
-
     set pat [string_to_regexp "valueof (${exp}) == ${val}"]
-    send_gdb "next\n"
-    gdb_expect {
-	-re "${pat}\[\r\n\].*$gdb_prompt $" {
-	    pass "check valueof ${exp} == ${val}"
-	}
-	-re ".*$gdb_prompt $" {
-	    fail "check valueof ${exp} == ${val}"
-	}
-	timeout {
-	    fail "check valueof ${exp} == ${val} (timeout)"
-	}
-    }
+    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check valueof \"$exp\""
 }
 
 # Check that GDB and the target agree over the sign of a character.

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