[binutils-gdb] testsuite: Introduce dejagnu_version

Simon Marchi simark@sourceware.org
Mon Mar 13 22:02:00 GMT 2017


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=896c0c1edee117ea333c66b1adac8c6f4def3f2b

commit 896c0c1edee117ea333c66b1adac8c6f4def3f2b
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Mar 13 18:02:07 2017 -0400

    testsuite: Introduce dejagnu_version
    
    The next patch will require checking the DejaGnu version.  There is
    already a test that does this,
    gdb.threads/attach-many-short-lived-threads.exp.  This patch introduces
    a new procedure, dejagnu_version, and makes that test use it.
    
    The version number is "right-padded" with zeroes, to make sure that we
    always return a triplet (major, minor, patch).
    
    The procedure does not consider the DejaGnu versions from git.  For
    example, if you used DejaGnu from its current master branch, the version
    would be "1.6.1-git", meaning that 1.6.1 will be the next release.  I
    figured we'll cross that bridge when (and if) we get there.
    
    gdb/testsuite/ChangeLog:
    
    	* lib/gdb.exp (dejagnu_version): New proc.
    	* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
    	Use dejagnu_version.

Diff:
---
 gdb/testsuite/ChangeLog                            |  6 +++++
 .../attach-many-short-lived-threads.exp            |  8 +------
 gdb/testsuite/lib/gdb.exp                          | 26 ++++++++++++++++++++++
 3 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0718d76..5f2624d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-13  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* lib/gdb.exp (dejagnu_version): New proc.
+	* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
+	Use dejagnu_version.
+
 2017-03-10  Keith Seitz  <keiths@redhat.com>
 
 	PR c++/8128
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index cd752ca..edc9613 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -24,13 +24,7 @@
 # Return true if the running version of DejaGnu is known to not be
 # able to run this test.
 proc bad_dejagnu {} {
-    global frame_version
-
-    verbose -log "DejaGnu version: $frame_version"
-    verbose -log "Expect version: [exp_version]"
-    verbose -log "Tcl version: [info tclversion]"
-
-    set dj_ver [split $frame_version .]
+    set dj_ver [dejagnu_version]
     set dj_ver_major [lindex $dj_ver 0]
     set dj_ver_minor [lindex $dj_ver 1]
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 188484f..c773d41 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6023,6 +6023,32 @@ proc multi_line_input { args } {
     return [join $args "\n"]
 }
 
+# Return the version of the DejaGnu framework.
+#
+# The return value is a list containing the major, minor and patch version
+# numbers.  If the version does not contain a minor or patch number, they will
+# be set to 0.  For example:
+#
+#   1.6   -> {1 6 0}
+#   1.6.1 -> {1 6 1}
+#   2     -> {2 0 0}
+
+proc dejagnu_version { } {
+    # The frame_version variable is defined by DejaGnu, in runtest.exp.
+    global frame_version
+
+    verbose -log "DejaGnu version: $frame_version"
+    verbose -log "Expect version: [exp_version]"
+    verbose -log "Tcl version: [info tclversion]"
+
+    set dg_ver [split $frame_version .]
+
+    while { [llength $dg_ver] < 3 } {
+	lappend dg_ver 0
+    }
+
+    return $dg_ver
+}
 
 # Always load compatibility stuff.
 load_lib future.exp



More information about the Gdb-cvs mailing list