|
509 | 509 |
|
510 | 510 | sub _logit {
|
511 | 511 | if (defined($opt{"LOG_FILE"})) {
|
512 |
| - open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; |
513 |
| - print OUT @_; |
514 |
| - close(OUT); |
| 512 | + print LOG @_; |
515 | 513 | }
|
516 | 514 | }
|
517 | 515 |
|
@@ -1780,8 +1778,6 @@ sub run_command {
|
1780 | 1778 | (fail "unable to exec $command" and return 0);
|
1781 | 1779 |
|
1782 | 1780 | if (defined($opt{"LOG_FILE"})) {
|
1783 |
| - open(LOG, ">>$opt{LOG_FILE}") or |
1784 |
| - dodie "failed to write to log"; |
1785 | 1781 | $dolog = 1;
|
1786 | 1782 | }
|
1787 | 1783 |
|
@@ -1829,7 +1825,6 @@ sub run_command {
|
1829 | 1825 | }
|
1830 | 1826 |
|
1831 | 1827 | close(CMD);
|
1832 |
| - close(LOG) if ($dolog); |
1833 | 1828 | close(RD) if ($dord);
|
1834 | 1829 |
|
1835 | 1830 | $end_time = time;
|
@@ -4091,8 +4086,11 @@ sub make_warnings_file {
|
4091 | 4086 | }
|
4092 | 4087 | }
|
4093 | 4088 |
|
4094 |
| -if ($opt{"CLEAR_LOG"} && defined($opt{"LOG_FILE"})) { |
4095 |
| - unlink $opt{"LOG_FILE"}; |
| 4089 | +if (defined($opt{"LOG_FILE"})) { |
| 4090 | + if ($opt{"CLEAR_LOG"}) { |
| 4091 | + unlink $opt{"LOG_FILE"}; |
| 4092 | + } |
| 4093 | + open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; |
4096 | 4094 | }
|
4097 | 4095 |
|
4098 | 4096 | doprint "\n\nSTARTING AUTOMATED TESTS\n\n";
|
@@ -4453,14 +4451,16 @@ sub cancel_test {
|
4453 | 4451 | }
|
4454 | 4452 |
|
4455 | 4453 |
|
4456 |
| -if (defined($opt{"LOG_FILE"})) { |
4457 |
| - print "\n See $opt{LOG_FILE} for the record of results.\n"; |
4458 |
| -} |
4459 |
| - |
4460 | 4454 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n";
|
4461 | 4455 |
|
4462 | 4456 | if ($email_when_finished) {
|
4463 | 4457 | send_email("KTEST: Your test has finished!",
|
4464 | 4458 | "$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!");
|
4465 | 4459 | }
|
| 4460 | + |
| 4461 | +if (defined($opt{"LOG_FILE"})) { |
| 4462 | + print "\n See $opt{LOG_FILE} for the record of results.\n\n"; |
| 4463 | + close LOG; |
| 4464 | +} |
| 4465 | + |
4466 | 4466 | exit 0;
|
0 commit comments