dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch to allow file name argument to --xml


From: Tom Tromey
Subject: Re: patch to allow file name argument to --xml
Date: Mon, 11 Jun 2012 11:43:11 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

>>>>> "Ben" == Ben Elliston <address@hidden> writes:

Ben> You forgot to update the documentation. :-)

I would have, but --xml already isn't documented, and I don't feel that
I know enough about exactly what it does to document it very well.

Here's an updated patch that also touches the man page.
I suppose I can pull the text from this into the .xml if you want.

Tom

2012-06-11  Tom Tromey  <address@hidden>

        * doc/runtest.1: Update.
        * runtest.exp (xml_file_name): New global.
        (usage): Update.
        Handle optional argument to --xml.
        * lib/framework.exp (open_logs): Respect xml_file_name.

diff --git a/doc/runtest.1 b/doc/runtest.1
index cec1e45..d657652 100644
--- a/doc/runtest.1
+++ b/doc/runtest.1
@@ -92,8 +92,9 @@ Use more than once to increase output further.
 .B --version,\ -V
 Prints out the versions of DejaGnu, Expect and Tcl.
 .TP
-.B --xml,\ -x
-Generate XML output.
+.B --xml[=FILE],\ -x
+Generate XML output.  \fBFILE\fR is optional; if given it is the name of
+the output file.  If not given, the output file is named after the tool.
 .TP
 .B -D[number]
 Activate the Tcl debugger.  \fBnumber\fR can be either 1 or 0. If it
diff --git a/lib/framework.exp b/lib/framework.exp
index 5871ecc..8273882 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -1,5 +1,5 @@
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-# 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Free Software 
Foundation, Inc.
 #
 # This file is part of DejaGnu.
 #
@@ -65,6 +65,7 @@ proc open_logs { } {
     global tool
     global sum_file
     global xml_file
+    global xml_file_name
     global xml
 
     if { ${tool} ==  "" } {
@@ -74,7 +75,10 @@ proc open_logs { } {
     set sum_file [open [file join $outdir $tool.sum] w]
     if { $xml } {
        catch "file delete -force -- $outdir/$tool.xml"
-       set xml_file [open [file join $outdir $tool.xml] w]
+       if { ![string compare $xml_file_name ""] } {
+           set xml_file_name $tool.xml
+       }
+       set xml_file [open [file join $outdir $xml_file_name] w]
        xml_output "<?xml version=\"1.0\"?>"
        insertdtd
        xml_output "<testsuite>"
diff --git a/runtest.exp b/runtest.exp
index b32181a..a7ad7a0 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -1,6 +1,6 @@
 # runtest.exp -- Test framework driver
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-# 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2001, 2002, 2003, 2012 Free Software Foundation, Inc.
 #
 # This file is part of DejaGnu.
 #
@@ -55,7 +55,8 @@ set kfail_flag  0             ;# indicates that it is a known 
failure
 set kfail_prms 0               ;# bug id for the description of the known 
failure
 set sum_file   ""              ;# name of the file that contains the summary 
log
 set base_dir   ""              ;# the current working directory
-set xml_file    ""              ;# name of the xml output if requested
+set xml_file_name ""           ;# name of the xml output if requested
+set xml_file    ""              ;# handle on the xml file if requested
 set xml         0               ;# flag for requesting xml
 set logname     ""             ;# the users login name
 set prms_id    0               ;# GNATS prms id number
@@ -395,7 +396,7 @@ proc usage { } {
     send_user "\t--directory (-di) name\tRun only the tests in directory 
'name'\n"
     send_user "\t--verbose (-v)\t\tEmit verbose output\n"
     send_user "\t--version (-V)\t\tEmit all version numbers\n"
-    send_user "\t--xml (-x)\t\tTurn on XML output generation\n"
+    send_user "\t--xml\[=name\] (-x)\tTurn on XML output generation\n"
     send_user "\t--D\[0-1\]\t\tTcl debugger\n"
     send_user "\tscript.exp\[=arg(s)\]\tRun these tests only\n"
     if { [info exists tool] } {
@@ -1168,6 +1169,7 @@ for { set i 0 } { $i < $argc } { incr i } {
        }
 
        "--x*" {
+           set xml_file_name $optarg
            set xml 1
            verbose "XML logging turned on"
            continue



reply via email to

[Prev in Thread] Current Thread [Next in Thread]