This is the mail archive of the gdb-patches@sourceware.org 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]

[PATCH 1/2] gdb/testsuite: New skip_tui_tests predicate.


Add a new predicate procedure to the gdb.exp library 'skip_tui_tests',
which returns true if the tui is not compiled into gdb.

I've made use of this predicate in the gdb.base/tui-layout.exp test as
an example.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (skip_tui_tests): New proc.
	* gdb.base/tui-layout.exp: Check skip_tui_tests.
---
 gdb/testsuite/ChangeLog               |  5 +++++
 gdb/testsuite/gdb.base/tui-layout.exp |  7 +++++++
 gdb/testsuite/lib/gdb.exp             | 15 +++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e501b11..6abb62f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-27  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* lib/gdb.exp (skip_tui_tests): New proc.
+	* gdb.base/tui-layout.exp: Check skip_tui_tests.
+
 2015-03-25  Markus Metzger  <markus.t.metzger@intel.com>
 
 	* gdb.btrace/next.exp: Merged into step.exp.
diff --git a/gdb/testsuite/gdb.base/tui-layout.exp b/gdb/testsuite/gdb.base/tui-layout.exp
index 0dcf1ca..cac2bc9 100644
--- a/gdb/testsuite/gdb.base/tui-layout.exp
+++ b/gdb/testsuite/gdb.base/tui-layout.exp
@@ -19,4 +19,11 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
     return -1
 }
 
+if {[skip_tui_tests]} {
+    # TUI support is disabled.  Check for error message.
+    gdb_test "layout asm" "Undefined command: \"layout\".  Try \"help\"."
+    return
+}
+
+# Just check the command does not cause gdb to crash.
 gdb_test "layout asm"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f274b64..5a59a48 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1688,6 +1688,21 @@ proc skip_shlib_tests {} {
     return 1
 }
 
+# Return 1 if we should skip tui related tests.
+
+proc skip_tui_tests {} {
+    global gdb_prompt
+
+    gdb_test_multiple "help layout" "verify tui support" {
+	-re "Undefined command: \"layout\".*$gdb_prompt $" {
+	    return 1
+	}
+	-re "$gdb_prompt $"	{}
+    }
+
+    return 0
+}
+
 # Test files shall make sure all the test result lines in gdb.sum are
 # unique in a test run, so that comparing the gdb.sum files of two
 # test runs gives correct results.  Test files that exercise
-- 
2.2.2


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