Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: valgrind -vs- the testsuite
@ 2009-07-09 18:02 Tom Tromey
  2009-07-09 19:29 ` Eli Zaretskii
  2009-07-10  6:35 ` Doug Evans
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2009-07-09 18:02 UTC (permalink / raw)
  To: gdb-patches

I've often found it useful to run gdb under valgrind in the
testsuite.  I keep this patch around to make this very easy; but I
figured I'd submit this in case other people find it useful.

With this patch you can set a dejagnu variable and have each gdb
invocation in the test suite automatically run using valgrind.  The
valgrind output is sent to a separate file per gdb invocation, so it
doesn't mess up the test suite results.

This needs a documentation review.

Tom

2009-07-09  Tom Tromey  <tromey@redhat.com>

	* gdbint.texinfo (Testsuite): Document valgrind usage.

2009-07-09  Tom Tromey  <tromey@redhat.com>

	* lib/gdb.exp: Recognize VALGRIND variable.

diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index a51f077..e15af88 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -7560,6 +7560,19 @@ will give a result of ``UNRESOLVED'', like this:
 UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host.
 @end smallexample
 
+You can instruct the testsuite to run @value{GDBN} under
+@code{valgrind}.  You can do this by setting the DejaGNU variable
+@code{VALGRIND} on the @code{runtest} command line.  The testsuite
+will use the contents of this variable as arguments to pass to
+@code{valgrind}.  The testsuite also automatically adds a
+@code{--log-file} option to put the logs in files named
+@file{valgrind.@var{pid}} in DejaGNU's output directory.  Here,
+@var{pid} is the process id of the @value{GDBN} process.
+
+@smallexample
+make check RUNTESTFLAGS='VALGRIND=--leak-check=full'
+@end smallexample
+
 @section Testsuite Organization
 
 @cindex test suite organization
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 200ab35..25ccacb 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -42,6 +42,13 @@ if ![info exists GDB] {
 }
 verbose "using GDB = $GDB" 2
 
+# If VALGRIND is set, we run gdb under valgrind and use $VALGRIND as
+# arguments to valgrind.
+if {[info exists VALGRIND]} {
+  global outdir
+  set GDB "valgrind $VALGRIND --log-file=$outdir/valgrind.%p $GDB"
+}
+
 # GDBFLAGS is available for the user to set on the command line.
 # E.g. make check RUNTESTFLAGS=GDBFLAGS=mumble
 # Testcases may use it to add additional flags, but they must:


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-09 18:02 RFA: valgrind -vs- the testsuite Tom Tromey
@ 2009-07-09 19:29 ` Eli Zaretskii
  2009-07-10  6:35 ` Doug Evans
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2009-07-09 19:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Date: Thu, 09 Jul 2009 11:19:39 -0600
> 
> This needs a documentation review.

Thanks.  Approved, with the same comments about markup as in the
previous two patches.  In addition, whenever you use a name of a
program or a script, please give them the @command markup.


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-09 18:02 RFA: valgrind -vs- the testsuite Tom Tromey
  2009-07-09 19:29 ` Eli Zaretskii
@ 2009-07-10  6:35 ` Doug Evans
  2009-07-10 18:02   ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Doug Evans @ 2009-07-10  6:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thu, Jul 9, 2009 at 10:19 AM, Tom Tromey<tromey@redhat.com> wrote:
> I've often found it useful to run gdb under valgrind in the
> testsuite.  I keep this patch around to make this very easy; but I
> figured I'd submit this in case other people find it useful.
>
> With this patch you can set a dejagnu variable and have each gdb
> invocation in the test suite automatically run using valgrind.  The
> valgrind output is sent to a separate file per gdb invocation, so it
> doesn't mess up the test suite results.
>
> This needs a documentation review.
>
> Tom
>
> 2009-07-09  Tom Tromey  <tromey@redhat.com>
>
>        * gdbint.texinfo (Testsuite): Document valgrind usage.
>
> 2009-07-09  Tom Tromey  <tromey@redhat.com>
>
>        * lib/gdb.exp: Recognize VALGRIND variable.
>
> diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
> index a51f077..e15af88 100644
> --- a/gdb/doc/gdbint.texinfo
> +++ b/gdb/doc/gdbint.texinfo
> @@ -7560,6 +7560,19 @@ will give a result of ``UNRESOLVED'', like this:
>  UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host.
>  @end smallexample
>
> +You can instruct the testsuite to run @value{GDBN} under
> +@code{valgrind}.  You can do this by setting the DejaGNU variable
> +@code{VALGRIND} on the @code{runtest} command line.  The testsuite
> +will use the contents of this variable as arguments to pass to
> +@code{valgrind}.  The testsuite also automatically adds a
> +@code{--log-file} option to put the logs in files named
> +@file{valgrind.@var{pid}} in DejaGNU's output directory.  Here,
> +@var{pid} is the process id of the @value{GDBN} process.
> +
> +@smallexample
> +make check RUNTESTFLAGS='VALGRIND=--leak-check=full'
> +@end smallexample
> +
>  @section Testsuite Organization
>
>  @cindex test suite organization
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 200ab35..25ccacb 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -42,6 +42,13 @@ if ![info exists GDB] {
>  }
>  verbose "using GDB = $GDB" 2
>
> +# If VALGRIND is set, we run gdb under valgrind and use $VALGRIND as
> +# arguments to valgrind.
> +if {[info exists VALGRIND]} {
> +  global outdir
> +  set GDB "valgrind $VALGRIND --log-file=$outdir/valgrind.%p $GDB"
> +}
> +
>  # GDBFLAGS is available for the user to set on the command line.
>  # E.g. make check RUNTESTFLAGS=GDBFLAGS=mumble
>  # Testcases may use it to add additional flags, but they must:
>


I always just use:
cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
or make check RUNTESTFLAGS='"valgrind ../gdb"'
(suitably augmented as desired),

[not that I'm complaining about the option, valgrind is used often enough]


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-10  6:35 ` Doug Evans
@ 2009-07-10 18:02   ` Tom Tromey
  2009-07-16 20:38     ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2009-07-10 18:02 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> I always just use:
Doug> cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
Doug> or make check RUNTESTFLAGS='"valgrind ../gdb"'
Doug> (suitably augmented as desired),

Good point.  I'm dropping this one.

Tom


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-10 18:02   ` Tom Tromey
@ 2009-07-16 20:38     ` Joel Brobecker
  2009-07-17  0:24       ` Tom Tromey
  2009-07-20  5:18       ` Thiago Jung Bauermann
  0 siblings, 2 replies; 8+ messages in thread
From: Joel Brobecker @ 2009-07-16 20:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Doug Evans, gdb-patches

> Doug> I always just use:
> Doug> cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
> Doug> or make check RUNTESTFLAGS='"valgrind ../gdb"'
> Doug> (suitably augmented as desired),
> 
> Good point.  I'm dropping this one.

Would this be worth an entry in the Wiki?

-- 
Joel


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-16 20:38     ` Joel Brobecker
@ 2009-07-17  0:24       ` Tom Tromey
  2009-07-20  1:17         ` Samuel Bronson
  2009-07-20  5:18       ` Thiago Jung Bauermann
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2009-07-17  0:24 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Doug Evans, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Doug> I always just use:
Doug> cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
Doug> or make check RUNTESTFLAGS='"valgrind ../gdb"'
Doug> (suitably augmented as desired),
>> 
>> Good point.  I'm dropping this one.

Joel> Would this be worth an entry in the Wiki?

Yeah, or perhaps a note in gdbint.texinfo.
I will try to get to this.

Tom


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-17  0:24       ` Tom Tromey
@ 2009-07-20  1:17         ` Samuel Bronson
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Bronson @ 2009-07-20  1:17 UTC (permalink / raw)
  To: tromey; +Cc: Joel Brobecker, Doug Evans, gdb-patches

At Thu, 16 Jul 2009 15:16:26 -0600,
Tom Tromey wrote:
> 
> >>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
> 
> Doug> I always just use:
> Doug> cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
> Doug> or make check RUNTESTFLAGS='"valgrind ../gdb"'
> Doug> (suitably augmented as desired),
> >> 
> >> Good point.  I'm dropping this one.
> 
> Joel> Would this be worth an entry in the Wiki?
> 
> Yeah, or perhaps a note in gdbint.texinfo.
> I will try to get to this.
> 
> Tom

Maybe this should be filed in bugzilla?


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

* Re: RFA: valgrind -vs- the testsuite
  2009-07-16 20:38     ` Joel Brobecker
  2009-07-17  0:24       ` Tom Tromey
@ 2009-07-20  5:18       ` Thiago Jung Bauermann
  1 sibling, 0 replies; 8+ messages in thread
From: Thiago Jung Bauermann @ 2009-07-20  5:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker, Tom Tromey, Doug Evans

Em Quinta-feira 16 Julho 2009 16:28:19 Joel Brobecker escreveu:
> > Doug> I always just use:
> > Doug> cd testsuite && runtest --tool gdb GDB="valgrind ../gdb"
> > Doug> or make check RUNTESTFLAGS='"valgrind ../gdb"'
> > Doug> (suitably augmented as desired),
> >
> > Good point.  I'm dropping this one.
>
> Would this be worth an entry in the Wiki?

I just added Doug's tip to the TestingGDB wiki page.
I also took the opportunity to overhaul said page, and move two sections 
(about massif and about ARI) from DeveloperTips.

Feel free to revert any changes I made, or improve upon them.
-- 
[]'s
Thiago Jung Bauermann


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

end of thread, other threads:[~2009-07-20  1:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 18:02 RFA: valgrind -vs- the testsuite Tom Tromey
2009-07-09 19:29 ` Eli Zaretskii
2009-07-10  6:35 ` Doug Evans
2009-07-10 18:02   ` Tom Tromey
2009-07-16 20:38     ` Joel Brobecker
2009-07-17  0:24       ` Tom Tromey
2009-07-20  1:17         ` Samuel Bronson
2009-07-20  5:18       ` Thiago Jung Bauermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox