Re: [PATCH v2 1/1] Introduce new --log_user option to also send expect logs to stdout

Filipe Brandenburger <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <CADU+-uCORpqANRx7m1juy7J7kGaqv4wWGUgSqvr--N9K3oHEuw@mail.gmail.com>
Ping?

The latest e-mail on the thread contains the change with the updates
to man page and docs.

Let me know if you think there is a better name for the --log_user
option or if there is some other issue with the proposed patch.

Cheers,
Filipe


On Thu, May 7, 2015 at 10:35 AM, Filipe Brandenburger
<[email protected]> wrote:
>     * 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 <[email protected]>
> ---
>  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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.