From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2361 invoked by alias); 10 Jul 2009 17:22:50 -0000 Received: (qmail 2349 invoked by uid 22791); 10 Jul 2009 17:22:49 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_33,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jul 2009 17:22:43 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6AHMehv008755; Fri, 10 Jul 2009 13:22:40 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6AHMd5u022537; Fri, 10 Jul 2009 13:22:39 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6AHMc8H029924; Fri, 10 Jul 2009 13:22:38 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 48A0C888148; Fri, 10 Jul 2009 11:22:38 -0600 (MDT) To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: RFA: make test suite transcripts References: <83ws6hy83d.fsf@gnu.org> From: Tom Tromey Reply-To: Tom Tromey Date: Fri, 10 Jul 2009 19:37:00 -0000 In-Reply-To: <83ws6hy83d.fsf@gnu.org> (Eli Zaretskii's message of "Thu\, 09 Jul 2009 22\:22\:46 +0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00312.txt.bz2 >>>>> "Eli" == Eli Zaretskii writes: >> The documentation needs a review. Eli> Thanks. The documentation patch is approved subject to the same Eli> comments as for your previous patch to gdbint.texinfo. Thanks. BTW, this sort of detail work would be simpler if the manuals were internally consistent. I mostly copied existing texinfo usage from elsewhere in gdbint.texinfo. Anyway, later I decided that it is preferable to use a DejaGNU variable, instead of an environment variable. So, the text changed. Let me know what you think. Tom 2009-07-09 Tom Tromey * gdbint.texinfo (Testsuite): Document test transcripts. 2009-07-09 Tom Tromey * lib/gdb.exp: Handle LOG_GDB_SCRIPT. (remote_spawn, remote_close, send_gdb): New procs. Index: doc/gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.307 diff -u -r1.307 gdbint.texinfo --- doc/gdbint.texinfo 2 Jul 2009 17:21:07 -0000 1.307 +++ doc/gdbint.texinfo 10 Jul 2009 17:22:10 -0000 @@ -7560,6 +7560,27 @@ UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host. @end smallexample +Sometimes it is convenient to get a transcript of the commands which +the testsuite sends to @value{GDBN}. For example, if @value{GDBN} +crashes during testing, a transcript can be used to more easily +reconstruct the failure when running @value{GDBN} under @value{GDBN}. + +You can instruct the @value{GDBN} testsuite to write transcripts by +setting the DejaGNU variable @code{TRANSCRIPT} (to any value) +before invoking @code{runtest} or @kbd{make check}. The transcripts +will be written into DejaGNU's output directory. One transcript will +be made for each invocation of @value{GDBN}; they will be named +@file{transcript.@var{n}}, where @var{n} is an integer. The first +line of the transcript file will show how @value{GDBN} was invoked; +each subsequent line is a command sent as input to @value{GDBN}. + +@smallexample +make check RUNTESTFLAGS=TRANSCRIPT=y +@end smallexample + +Note that the transcript is not always complete. In particular, tests +of completion can yield partial command lines. + @section Testsuite Organization @cindex test suite organization Index: testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.117 diff -u -r1.117 gdb.exp --- testsuite/lib/gdb.exp 28 Jun 2009 00:20:24 -0000 1.117 +++ testsuite/lib/gdb.exp 10 Jul 2009 17:22:12 -0000 @@ -2983,3 +2983,49 @@ return [get_integer_valueof "sizeof (${type})" $default] } +# Log gdb command line and script if requested. +if {[info exists TRANSCRIPT]} { + rename send_gdb real_send_gdb + rename remote_spawn real_remote_spawn + rename remote_close real_remote_close + + global gdb_transcript + set gdb_transcript "" + + global gdb_trans_count + set gdb_trans_count 1 + + proc remote_spawn {args} { + global gdb_transcript gdb_trans_count outdir + + if {$gdb_transcript != ""} { + close $gdb_transcript + } + set gdb_transcript [open [file join $outdir transcript.$gdb_trans_count] w] + puts $gdb_transcript [lindex $args 1] + incr gdb_trans_count + + return [uplevel real_remote_spawn $args] + } + + proc remote_close {args} { + global gdb_transcript + + if {$gdb_transcript != ""} { + close $gdb_transcript + set gdb_transcript "" + } + + return [uplevel real_remote_close $args] + } + + proc send_gdb {args} { + global gdb_transcript + + if {$gdb_transcript != ""} { + puts -nonewline $gdb_transcript [lindex $args 0] + } + + return [uplevel real_send_gdb $args] + } +}