Commit d4043604618eaaaac9e24f72177eb94640b6f1f4
Committed by
Jay Berkenbilt
1 parent
15502013
From qtest: add RM_WS_ONLY_LINES option
qutil.cc uses strerror to print some exceptions and adds a newline afterwards, but strerror in Windows already adds one newline at the end of the message and the additional one from std::endl breaks the output vs. the expected one.
Showing
1 changed file
with
19 additions
and
3 deletions
qtest/module/TestDriver.pm
| ... | ... | @@ -65,9 +65,10 @@ use constant TD_THREADS => 'TD_THREADS'; |
| 65 | 65 | use constant TD_SEQGROUPS => 'TD_SEQGROUPS'; |
| 66 | 66 | |
| 67 | 67 | # Flags |
| 68 | -use constant NORMALIZE_NEWLINES => 1 << 0; | |
| 68 | +use constant NORMALIZE_NEWLINES => 1 << 0; | |
| 69 | 69 | use constant NORMALIZE_WHITESPACE => 1 << 1; |
| 70 | -use constant EXPECT_FAILURE => 1 << 2; | |
| 70 | +use constant EXPECT_FAILURE => 1 << 2; | |
| 71 | +use constant RM_WS_ONLY_LINES => 1 << 3; | |
| 71 | 72 | |
| 72 | 73 | # Field names |
| 73 | 74 | use vars qw($f_socket $f_origdir $f_tempdir $f_testlog $f_testxml $f_suitename); |
| ... | ... | @@ -436,7 +437,7 @@ sub prompt |
| 436 | 437 | print "To avoid question, place answer in" . |
| 437 | 438 | " environment variable \$$env\n"; |
| 438 | 439 | # Note: ActiveState perl 5.10.1 gives the wrong answer for -t |
| 439 | - # STDIN. | |
| 440 | + # STDIN when NUL (http://bugs.activestate.com/show_bug.cgi?id=85614). | |
| 440 | 441 | if ((-t STDIN) && (-t STDOUT)) |
| 441 | 442 | { |
| 442 | 443 | print "$msg "; |
| ... | ... | @@ -551,6 +552,12 @@ sub get_start_dir |
| 551 | 552 | # place-holder test cases that exercise a known bug that cannot |
| 552 | 553 | # yet be fixed. |
| 553 | 554 | |
| 555 | +# RM_WS_ONLY_LINES: If specified, all lines only containing any | |
| 556 | +# whitespace character like newlines, spaces or tabs are removed | |
| 557 | +# from the input. This is done before writing through any filter | |
| 558 | +# and is especially useful if some tests output more newlines on | |
| 559 | +# some platforms than on others. | |
| 560 | + | |
| 554 | 561 | sub runtest |
| 555 | 562 | { |
| 556 | 563 | my $rep = shift; |
| ... | ... | @@ -818,6 +825,15 @@ sub runtest |
| 818 | 825 | { |
| 819 | 826 | &QTC::TC("testdriver", "TestDriver no normalize newlines"); |
| 820 | 827 | } |
| 828 | + if ($flags & $rep->RM_WS_ONLY_LINES) | |
| 829 | + { | |
| 830 | + &QTC::TC("testdriver", "TestDriver remove empty lines"); | |
| 831 | + $line =~ s/^\s+$//; | |
| 832 | + } | |
| 833 | + else | |
| 834 | + { | |
| 835 | + &QTC::TC("testdriver", "TestDriver no remove empty lines"); | |
| 836 | + } | |
| 821 | 837 | $actual->print($line); |
| 822 | 838 | $actual->flush(); |
| 823 | 839 | last if defined $exit_status; | ... | ... |