X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/76ae11e09dec419fb20f7c1bb4778a612a2d5bce..94cda16e4fc2e8ba569b26cdad27de5bf1425835:/tools/tesh/tesh.pl diff --git a/tools/tesh/tesh.pl b/tools/tesh/tesh.pl index 9f218e9101..0bb11384c4 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) } @@ -341,7 +344,7 @@ sub parse_out { shift @got; } - #also resort the other one, as perl sort is not the same as the C one used to generate teshes + # Sort the expected output to make it easier to write for humans if(defined($cmd{'out'})){ @{$cmd{'out'}}=sort mysort @{$cmd{'out'}}; while (@{$cmd{'out'}} and ${$cmd{'out'}}[0] eq "") { @@ -350,7 +353,7 @@ sub parse_out { } } - #Did we timeout ? If yes, handle it. If not, kill the forked process. + # Did we timeout ? If yes, handle it. If not, kill the forked process. if($timeout==-1 and $gotret eq "got signal SIGKILL"){ $gotret="return code 0"; @@ -395,8 +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 "----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"; + } print "Test suite `$cmd{'file'}': NOK (<$cmd{'file'}:$cmd{'line'}> output mismatch)\n"; $error=1;