* runtest.exp (runtest): Introduce new --log_user option. This option is useful when running dejagnu tests on an automated environment where only test stdout is accessible after a test run.
The expect output (usually saved in *.log files) is useful to debug test failures which often are not apparent from the *.sum contents which are the only ones orinarily included in the output. There is already a way to include the useful expect log_user output, but that is only accomplished by increasing verbosity to at least 3, which then creates quite a bit of noise in the output related to debugging runtest itself (looking for *.exp files, etc.) and is not that useful for troubleshooting failure of tests themselves. In order to fix this, introduce a new --log_user option (derived from the expect log_user command used to enable it) which allows enabling expect output without having to increase runtest verbosity. Tested by running `make check RUNTESTFLAGS="--all --log_user"` in procps-ng package while troubleshooting an issue with a broken regexp in one of the test cases. v2: Update man page and docbook/texinfo documentation. Tested `man doc/runtest.1` and `info doc/dejagnu.info` and confirmed that the documentation for the --log_user option is now present in both. Signed-off-by: Filipe Brandenburger <filbran...@google.com> --- doc/dejagnu.texi | 7 +++++++ doc/runtest.1 | 3 +++ doc/user.xml | 9 +++++++++ runtest.exp | 11 ++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index fc788d5111db..ec216aa1082c 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -1488,6 +1488,13 @@ and the detailed log files log @file{dbg.log} always appears (when requested) in the local directory. +@item @code{--log_user} +Also emit test log output to stdout. +These @emph{expect} logs usually only end up in +@file{tool.log}, by enabling this option they will also +be printed in stdout of the @emph{runtest} +invocation. + @item @code{--reboot [name]} Reboot the target board when @emph{runtest} initializes. Usually, when running tests diff --git a/doc/runtest.1 b/doc/runtest.1 index 5b87096649c1..5e83dcc5faa4 100644 --- a/doc/runtest.1 +++ b/doc/runtest.1 @@ -53,6 +53,9 @@ The network HOSTNAME of the target board. .BI --outdir \ DIRECTORY The name of a DIRECTORY for test log output. .TP +.B --log_user +Also emit test log output to stdout. +.TP .B --reboot Reboot the target board when \fBruntest\fR initializes (if supported). diff --git a/doc/user.xml b/doc/user.xml index f7e55c02ed7c..7527bbd41f80 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -1041,6 +1041,15 @@ powerpc-linux-gcc -g -O2 -o calc calc.o </varlistentry> <varlistentry> + <term><option>--log_user</option></term> + <listitem><para>Also emit test log output to stdout. + These <emphasis>expect</emphasis> logs usually only end up in + <filename>tool.log</filename>, by enabling this option they will also + be printed in stdout of the <emphasis>runtest</emphasis> + invocation.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>--reboot [name]</option></term> <listitem><para>Reboot the target board when <emphasis>runtest</emphasis> initializes. Usually, when running tests diff --git a/runtest.exp b/runtest.exp index ad4db193cfdc..927e5e03f119 100644 --- a/runtest.exp +++ b/runtest.exp @@ -133,6 +133,9 @@ if {![info exists tracelevel]} { if {![info exists verbose]} { set verbose 0 } +if {![info exists log_user]} { + set log_user 0 +} # # verbose [-n] [-log] [--] message [level] @@ -385,6 +388,7 @@ proc usage { } { send_user "\t--ignore \[name(s)\]\tThe names of specific tests to ignore\n" send_user "\t--objdir \[name\]\t\tThe test suite binary directory\n" send_user "\t--outdir \[name\]\t\tThe directory to put logs in\n" + send_user "\t--log_user\t\tAlso emit log output to stdout\n" send_user "\t--reboot \[name\]\t\tReboot the target (if supported)\n" send_user "\t--srcdir \[name\]\t\tThe test suite source code directory\n" send_user "\t--strace \[number\]\tSet expect tracing ON\n" @@ -1111,6 +1115,11 @@ for { set i 0 } { $i < $argc } { incr i } { continue } + "--log_user*" { + incr log_user + continue + } + "*.exp" { # specify test names to run set all_runtests($option) "" verbose "Running only tests $option" @@ -1214,7 +1223,7 @@ if {![info exists tool]} { # # initialize a few Tcl variables to something other than their default # -if { $verbose > 2 } { +if { $verbose > 2 || $log_user } { log_user 1 } else { log_user 0 -- 2.2.0.rc0.207.ga3a616c _______________________________________________ DejaGnu mailing list DejaGnu@gnu.org https://lists.gnu.org/mailman/listinfo/dejagnu