public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] testsuite: Introduce dejagnu_version
@ 2017-03-13 21:28 Simon Marchi
  2017-03-13 21:28 ` [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus Simon Marchi
  2017-03-13 21:54 ` [PATCH 1/2] testsuite: Introduce dejagnu_version Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Marchi @ 2017-03-13 21:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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.
---
 .../attach-many-short-lived-threads.exp            |  8 +------
 gdb/testsuite/lib/gdb.exp                          | 26 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 7 deletions(-)

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 cd752ca496..edc96132e3 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 188484f792..c773d41bae 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
-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus
  2017-03-13 21:28 [PATCH 1/2] testsuite: Introduce dejagnu_version Simon Marchi
@ 2017-03-13 21:28 ` Simon Marchi
  2017-03-13 21:55   ` Pedro Alves
  2017-03-13 21:54 ` [PATCH 1/2] testsuite: Introduce dejagnu_version Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2017-03-13 21:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

I noticed that backslash_in_multi_line_command_test in
gdb.base/commands.exp failed on our RHEL6 servers.  I traced it to the
old version of DejaGnu (1.4.4).  I have found that instead of receiving
the expected:

  "print \\\nargc\n"

gdb received:

  "print  argc\n"

thus breaking the test and its purpose.  Versionof DejaGnu < 1.5 mess
up sending "\\\n", it somehow gets replaced with a space.  I found that
the following commit in DejaGnu fixed the issue:

http://git.savannah.gnu.org/cgit/dejagnu.git/commit/lib/remote.exp?id=3f39294f5cd6802858838d3bcc0ccce847ae17f2

Even though the commit is almost 10 years old, the following release of
DejaGnu was only in 2013, which is why we still have systems with the
old code.

If the DejaGnu version is < 1.5, we just skip the test.

gdb/testsuite/ChangeLog:

	* gdb.base/commands.exp (backslash_in_multi_line_command_test):
	Skip for versions of DejaGnu < 1.5.
---
 gdb/testsuite/gdb.base/commands.exp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 6d3c398c6e..4963743d2b 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -1007,6 +1007,17 @@ proc_with_prefix redefine_backtrace_test {} {
 # while entering a multi-line command (in a secondary prompt).
 
 proc_with_prefix backslash_in_multi_line_command_test {} {
+    set dg_ver [dejagnu_version]
+    set dg_major [lindex $dg_ver 0]
+    set dg_minor [lindex $dg_ver 1]
+
+    # With older versions of DejaGnu, the "\\\n" we send gets replaced with a
+    # space, thus breaking the test.  Just skip it in that case.
+    if { $dg_major == 1 && $dg_minor < 5 } {
+	untested "dejagnu version is too old"
+	return
+    }
+
     gdb_breakpoint "main"
 
     gdb_test_multiple "commands" "commands" {
-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] testsuite: Introduce dejagnu_version
  2017-03-13 21:28 [PATCH 1/2] testsuite: Introduce dejagnu_version Simon Marchi
  2017-03-13 21:28 ` [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus Simon Marchi
@ 2017-03-13 21:54 ` Pedro Alves
  2017-03-13 22:03   ` Simon Marchi
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2017-03-13 21:54 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

OK.

Thanks,
Pedro Alves

On 03/13/2017 09:27 PM, Simon Marchi wrote:
> 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.
> ---
>  .../attach-many-short-lived-threads.exp            |  8 +------
>  gdb/testsuite/lib/gdb.exp                          | 26 ++++++++++++++++++++++
>  2 files changed, 27 insertions(+), 7 deletions(-)
> 
> 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 cd752ca496..edc96132e3 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 188484f792..c773d41bae 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
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus
  2017-03-13 21:28 ` [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus Simon Marchi
@ 2017-03-13 21:55   ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2017-03-13 21:55 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

OK.

Thanks,
Pedro Alves

On 03/13/2017 09:27 PM, Simon Marchi wrote:
> I noticed that backslash_in_multi_line_command_test in
> gdb.base/commands.exp failed on our RHEL6 servers.  I traced it to the
> old version of DejaGnu (1.4.4).  I have found that instead of receiving
> the expected:
> 
>   "print \\\nargc\n"
> 
> gdb received:
> 
>   "print  argc\n"
> 
> thus breaking the test and its purpose.  Versionof DejaGnu < 1.5 mess
> up sending "\\\n", it somehow gets replaced with a space.  I found that
> the following commit in DejaGnu fixed the issue:
> 
> http://git.savannah.gnu.org/cgit/dejagnu.git/commit/lib/remote.exp?id=3f39294f5cd6802858838d3bcc0ccce847ae17f2
> 
> Even though the commit is almost 10 years old, the following release of
> DejaGnu was only in 2013, which is why we still have systems with the
> old code.
> 
> If the DejaGnu version is < 1.5, we just skip the test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] testsuite: Introduce dejagnu_version
  2017-03-13 21:54 ` [PATCH 1/2] testsuite: Introduce dejagnu_version Pedro Alves
@ 2017-03-13 22:03   ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2017-03-13 22:03 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Simon Marchi, gdb-patches

On 2017-03-13 17:54, Pedro Alves wrote:
> OK.
> 
> Thanks,
> Pedro Alves

Both patches pushed.

Thanks,

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-13 22:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 21:28 [PATCH 1/2] testsuite: Introduce dejagnu_version Simon Marchi
2017-03-13 21:28 ` [PATCH 2/2] testsuite: Disable backslash_in_multi_line_command_test for old DejaGnus Simon Marchi
2017-03-13 21:55   ` Pedro Alves
2017-03-13 21:54 ` [PATCH 1/2] testsuite: Introduce dejagnu_version Pedro Alves
2017-03-13 22:03   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).