summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-08-18 09:20:43 +0100
committerYao Qi <yao.qi@linaro.org>2017-08-18 09:20:43 +0100
commit6d580b635f8963183540b816b20bb9c240154497 (patch)
tree4f5c35be79f4293a8c716415ba104debe1a27160 /gdb/testsuite
parent86dcbf50fe5f59fbc35f38f02ab6c1803c29f383 (diff)
downloadbinutils-gdb-6d580b635f8963183540b816b20bb9c240154497.tar.gz
GDBserver self tests
This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-08-18 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. gdb/testsuite: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest".
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.server/unittest.exp41
2 files changed, 45 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 39c49b8d0ea..d188f83cca4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-18 Yao Qi <yao.qi@linaro.org>
+
+ * gdb.server/unittest.exp: New.
+
2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21954
diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp
new file mode 100644
index 00000000000..584a23d51c1
--- /dev/null
+++ b/gdb/testsuite/gdb.server/unittest.exp
@@ -0,0 +1,41 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+if { [skip_gdbserver_tests] } {
+ return 0
+}
+
+global server_spawn_id
+
+set gdbserver [find_gdbserver]
+set gdbserver_command "$gdbserver --selftest"
+
+set server_spawn_id [remote_spawn target $gdbserver_command]
+
+gdb_expect {
+ -i $server_spawn_id
+ -re "Ran $decimal unit tests, 0 failed" {
+ pass "unit tests"
+ }
+ default {
+ fail "unit tests"
+ }
+}