From fb8acdcc53c8a2a4f2399f64c0d768a4cddae011 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Mon, 18 Feb 2002 18:57:07 +0000 Subject: [PATCH] 2002-02-18 Daniel Jacobowitz * gdb.c++/userdef.exp: Test overloaded operators properly. Remove xfails. --- gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.c++/userdef.exp | 331 ++++++------------------------ 2 files changed, 63 insertions(+), 273 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 16966783fd7..afd11d8d619 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 Daniel Jacobowitz + + * gdb.c++/userdef.exp: Test overloaded operators properly. + Remove xfails. + 2002-02-14 Daniel Jacobowitz * gdb.base/a2-run.exp: Check for a remote target properly. diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp index 8e3d642b98f..df18e4adf0c 100644 --- a/gdb/testsuite/gdb.c++/userdef.exp +++ b/gdb/testsuite/gdb.c++/userdef.exp @@ -64,279 +64,64 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" } -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.*" -- 2.30.2