[Top][All Lists]

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

[PATCH 1/1] Introduce new --log_user option to also send expect logs to

From: Filipe Brandenburger
Subject: [PATCH 1/1] Introduce new --log_user option to also send expect logs to stdout
Date: Wed, 6 May 2015 15:04:10 -0700

    * 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.

Signed-off-by: Filipe Brandenburger <address@hidden>
 runtest.exp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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 } {
+       "--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

reply via email to

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