RFA/testsuite/c++: Overhaul userdef.exp

Daniel Jacobowitz
2002-02-16T22:30:20Z

Userdef.exp was set to PASS tests if GDB's output contained FIXME, xfail
all other output, and contained a pile of HPPA xfail markers. It hasn't
been substantively checked since the HP merge.

I've removed the xfails; I'm not sure if the tests work on HP aCC, but they
ought to. If not and someone kindly gives me enough information, I'll fix
them. I've also made the tests actually check for output, and thus pass
(and highlight the bugs in my last message).

Michael, OK to commit these?

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2002-02-16 Daniel Jacobowitz <drow@mvista.com>

* gdb.c++/userdef.exp: Test overloaded operators properly.
Remove xfails.

Index: testsuite/gdb.c++/userdef.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/userdef.exp,v
retrieving revision 1.4
diff -u -p -r1.4 userdef.exp
--- userdef.exp 2001/12/07 22:02:23 1.4
+++ userdef.exp 2002/02/16 22:20:02
@@ -64,279 +64,64 @@ send_gdb "break marker1\n" ; gdb_expect
}

-setup_xfail "hppa*-*-*"
-send_gdb "print one+two\n"
-gdb_expect {
- -re "FIXME.*$gdb_prompt $" {
- pass "print value of one + two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one two" }
- timeout { fail "(timeout) print value of one two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one-two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one - two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one - two" }
- timeout { fail "(timeout) print value of one - two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one*two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one * two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one * two" }
- timeout { fail "(timeout) print value of one * two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one/two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one / two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one / two" }
- timeout { fail "(timeout) print value of one / two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one%two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one % two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one % two" }
- timeout { fail "(timeout) print value of one % two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one&&two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one && two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one && two" }
- timeout { fail "(timeout) print value of one && two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one||two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one|| two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one|| two" }
- timeout { fail "(timeout) print value of one|| two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one&two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one & two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one & two" }
- timeout { fail "(timeout) print value of one & two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one|two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one | two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one | two" }
- timeout { fail "(timeout) print value of one | two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one ^ two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one ^ two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one ^ two" }
- timeout { fail "(timeout) print value of one ^ two" }
- }
-
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one < two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one < two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one < two" }
- timeout { fail "(timeout) print value of one < two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one <= two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one <= two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one <= two" }
- timeout { fail "(timeout) print value of one <= two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one > two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one > two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one > two" }
- timeout { fail "(timeout) print value of one > two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one >= two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one >= two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one >= two" }
- timeout { fail "(timeout) print value of one >= two" }
- }
-
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one==two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one == two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one == two" }
- timeout { fail "(timeout) print value of one == two" }
- }
-
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one!=two\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one != two"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one != two" }
- timeout { fail "(timeout) print value of one != two" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one<<31\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one<<31"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one<<31" }
- timeout { fail "(timeout) print value of one<<31" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one>>31\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one>>31"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one>>31" }
- timeout { fail "(timeout) print value of one>>31" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print !one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of !one"
- }
- -re ".*$gdb_prompt $" { xfail "print value of !one" }
- timeout { fail "(timeout) print value of !one" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print ~one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of ~one"
- }
- -re ".*$gdb_prompt $" { xfail "print value of ~one" }
- timeout { fail "(timeout) print value of ~one" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print -one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of -one"
- }
- -re ".*$gdb_prompt $" { xfail "print value of -one" }
- timeout { fail "(timeout) print value of -one" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one++\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one++"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one++" }
- timeout { fail "(timeout) print value of one++" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print ++one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of ++one>>31"
- }
- -re ".*$gdb_prompt $" { xfail "print value of ++one" }
- timeout { fail "(timeout) print value of ++one" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one--\n"
-gdb_expect {
- -re ".*.FIXME*$gdb_prompt $" {
- pass "print value of one-->>31"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one-->>31" }
- timeout { fail "(timeout) print value of one-->>31" }
- }
-
-
-setup_xfail "hppa*-*-*"
-send_gdb "print --one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of --one"
- }
- -re ".*$gdb_prompt $" { xfail "print value of --one" }
- timeout { fail "(timeout) print value of --one" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print one+=7\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of one+=7"
- }
- -re ".*$gdb_prompt $" { xfail "print value of one+=7" }
- timeout { fail "(timeout) print value of one+=7" }
- }
-
-setup_xfail "hppa*-*-*"
-send_gdb "print two=one\n"
-gdb_expect {
- -re ".*FIXME.*$gdb_prompt $" {
- pass "print value of two=one"
- }
- -re ".*$gdb_prompt $" { xfail "print value of two=one" }
- timeout { fail "(timeout) print value of two=one" }
- }
+gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}"
+
+gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}"
+
+gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}"
+
+gdb_test "print one / two" "\\\$\[0-9\]* = {x = 0, y = 0}"
+
+gdb_test "print one % two" "\\\$\[0-9\]* = {x = 2, y = 3}"
+
+gdb_test "print one && two" "\\\$\[0-9\]* = 1\[\r\n\]"
+
+gdb_test "print one || two" "\\\$\[0-9\]* = 1\[\r\n\]"
+
+gdb_test "print one & two" "\\\$\[0-9\]* = {x = 0, y = 1}"
+
+gdb_test "print one | two" "\\\$\[0-9\]* = {x = 6, y = 7}"
+
+gdb_test "print one ^ two" "\\\$\[0-9\]* = {x = 6, y = 6}"
+
+gdb_test "print one < two" "\\\$\[0-9\]* = 1\[\r\n\]"
+
+gdb_test "print one <= two" "\\\$\[0-9\]* = 1\[\r\n\]"
+
+gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]"
+
+gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]"
+
+gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]"
+
+gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]"
+
+# Can't really check the output of this one without knowing
+# target integer width. Make sure we don't try to call
+# the iostreams operator instead, though.
+gdb_test "print one << 31" "\\\$\[0-9\]* = {x = -?\[0-9\]*, y = -?\[0-9\]*}"
+
+# Should be fine even on < 32-bit targets.
+gdb_test "print one >> 31" "\\\$\[0-9\]* = {x = 0, y = 0}"
+
+gdb_test "print !one" "\\\$\[0-9\]* = 0\[\r\n\]"
+
+# Assumes 2's complement. So does everything...
+gdb_test "print ~one" "\\\$\[0-9\]* = {x = -3, y = -4}"
+
+gdb_test "print -one" "\\\$\[0-9\]* = {x = -2, y = -3}"
+
+gdb_test "print one++" "\\\$\[0-9\]* = {x = 2, y = 4}"
+
+gdb_test "print ++one" "\\\$\[0-9\]* = {x = 3, y = 4}"
+
+gdb_test "print one--" "\\\$\[0-9\]* = {x = 3, y = 3}"
+
+gdb_test "print --one" "\\\$\[0-9\]* = {x = 2, y = 3}"
+
+gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}"
+
+gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}"

# Check that GDB tolerates whitespace in operator names.
gdb_test "break A1::'operator+'" ".*Breakpoint $decimal at.*"