Adjust self tests to cope with GDB built as a C++ program
authorPedro Alves <palves@redhat.com>
Wed, 22 Oct 2014 14:14:41 +0000 (15:14 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 27 Feb 2015 17:41:44 +0000 (17:41 +0000)
gdb/testsuite/
2015-02-27  Pedro Alves  <palves@redhat.com>

* gdb.gdb/complaints.exp (test_initial_complaints): Also accept
"true" for boolean result.
* gdb.gdb/selftest.exp (test_with_self): Also accept full
prototype of main.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.gdb/complaints.exp
gdb/testsuite/gdb.gdb/selftest.exp

index efc74f6d3275e0d366e363de9ce56d5963738ac7..60dbaa88a1458b1156b4ddb4bba854bef81a00fe 100644 (file)
@@ -1,3 +1,10 @@
+2015-02-27  Pedro Alves  <palves@redhat.com>
+
+       * gdb.gdb/complaints.exp (test_initial_complaints): Also accept
+       "true" for boolean result.
+       * gdb.gdb/selftest.exp (test_with_self): Also accept full
+       prototype of main.
+
 2015-02-27  Pedro Alves  <palves@redhat.com>
 
        * lib/unbuffer_output.c: New file.
index 500f4143b4ff41408bdbe2d8ebb33dcd6684ded3..707b2a57d4a260984d5aa3dcc3beee22f7a0c0f8 100644 (file)
@@ -43,9 +43,11 @@ proc test_initial_complaints { } {
     gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \
            "During symbol reading, Register a complaint."
 
-    # Check that there is only one thing in the list
+    # Check that there is only one thing in the list.  How the boolean
+    # result is output depends on whether GDB is built as a C or C++
+    # program.
     gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \
-           ".\[0-9\]+ = 1" "list has one entry"
+           ".\[0-9\]+ = \(1|true\)" "list has one entry"
 
     # Add a second complaint, expect it
     gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \
index b32e7995ac64d032aa5fc7e8f89762dfc6a0afe3..9f25a48bae2d7e4c8381d4fa8c471e4ac1aaa411 100644 (file)
@@ -288,9 +288,13 @@ proc test_with_self { executable } {
        return -1
     }
 
+    # When GDB is built as a C++ program, disassemble shows the full
+    # prototype.
+    set cxx_main_args_re [string_to_regexp "(int, char**)"]
+
     # disassemble yourself
     gdb_test "x/10i main" \
-           "x/10i.*main.*main.$decimal.*main.$decimal.*" \
+           "x/10i.*main.*main($cxx_main_args_re)?.$decimal.*main($cxx_main_args_re)?.$decimal.*" \
            "Disassemble main"
 
     # Set a breakpoint at main