diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-11-08 16:39:57 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-11-18 11:23:10 -0500 |
commit | d1e2f22ad718c83ab19297e7717679c5ed17c020 (patch) | |
tree | da71ebe95dfd8ec61e8a1359ae3f1971472ad2f8 /tools | |
parent | 9386c6ab7a33044d9907b00fc80976292bb02c2d (diff) |
ktest: Write to stdout if no log file is given
If no LOG_FILE option is set, then write what would be logged to
that file to standard output.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x[-rw-r--r--] | tools/testing/ktest/ktest.pl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 5bd00755727c..0a5ed0db4ff3 100644..100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -230,7 +230,7 @@ sub read_config { | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | sub logit { | 233 | sub _logit { |
234 | if (defined($opt{"LOG_FILE"})) { | 234 | if (defined($opt{"LOG_FILE"})) { |
235 | open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; | 235 | open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; |
236 | print OUT @_; | 236 | print OUT @_; |
@@ -238,9 +238,17 @@ sub logit { | |||
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
241 | sub logit { | ||
242 | if (defined($opt{"LOG_FILE"})) { | ||
243 | _logit @_; | ||
244 | } else { | ||
245 | print @_; | ||
246 | } | ||
247 | } | ||
248 | |||
241 | sub doprint { | 249 | sub doprint { |
242 | print @_; | 250 | print @_; |
243 | logit @_; | 251 | _logit @_; |
244 | } | 252 | } |
245 | 253 | ||
246 | sub run_command; | 254 | sub run_command; |