From c2376c7b6d372ddc6b0d12bd6d62ab12345ad35e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 25 Jul 2015 20:45:46 +0200 Subject: [PATCH] tesh: be much more verbose when sorted output don't match --- tools/tesh/tesh.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/tesh/tesh.pl b/tools/tesh/tesh.pl index 4ae67a0b11..8dfadbe6fb 100755 --- a/tools/tesh/tesh.pl +++ b/tools/tesh/tesh.pl @@ -332,6 +332,9 @@ sub parse_out { } if ($cmd{'sort'}){ + # Save the unsorted observed output to report it on error. + map { push @{$cmd{'unsorted got'}}, $_ } @got; + sub mysort{ substr($a, 0, $sort_prefix) cmp substr($b, 0, $sort_prefix) } @@ -395,11 +398,14 @@ sub parse_out { print "(ignoring the output of <$cmd{'file'}:$cmd{'line'}> as requested)\n" } if (length $diff) { - print "Output of <$cmd{'file'}:$cmd{'line'}> mismatch:\n"; + print "Output of <$cmd{'file'}:$cmd{'line'}> mismatch".($cmd{'sort'}?" (even after sorting)":"")."\n"; + map { print "$_\n" } split(/\n/,$diff); if ($cmd{'sort'}) { - print "WARNING: both the observed output and expected output were sorted as requested\n"; + print "WARNING: both the observed output and expected output were sorted as requested.\n"; + print "----8<--------------- Begin of unprocessed observed output (as it should appear in file):\n"; + map {print "> $_\n"} @{$cmd{'unsorted got'}}; + print "--------------->8---- End of the unprocessed observed output.\n"; } - map { print "$_\n" } split(/\n/,$diff); print "Test suite `$cmd{'file'}': NOK (<$cmd{'file'}:$cmd{'line'}> output mismatch)\n"; $error=1; -- 2.20.1