From 47a22ba74687bf963bf797d72745e9f1e6f40dd9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 9 Oct 2015 02:07:12 +0200 Subject: [PATCH] [tesh] cosmetics on outputs when an error is detected --- tools/tesh/tesh.pl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/tesh/tesh.pl b/tools/tesh/tesh.pl index 34c4b8e106..d01ce83b85 100755 --- a/tools/tesh/tesh.pl +++ b/tools/tesh/tesh.pl @@ -243,7 +243,6 @@ my $diff_tool_tmp_fh = 0; my $diff_tool_tmp_filename = 0; my $sort_prefix = -1; my $tesh_file; -my $tesh_name; my $error = 0; my $exitcode = 0; my @bg_cmds; @@ -318,11 +317,9 @@ if ($diff_tool) { } if ( $tesh_file =~ m/(.*)\.tesh/ ) { - $tesh_name = $1; - print "Test suite `$tesh_name'\n"; + print "Test suite `$tesh_file'\n"; } else { $tesh_file = "(stdin)"; - $tesh_name = "(stdin)"; print "Test suite from stdin\n"; } @@ -357,7 +354,7 @@ sub exec_cmd { $cmd{'cmd'} =~ s/^\s+//; $cmd{'cmd'} =~ s/\s+$//; - print "[$tesh_name:$cmd{'line'}] $cmd{'cmd'}\n"; + print "[$cmd{'file'}:$cmd{'line'}] $cmd{'cmd'}\n"; $cmd{'return'} ||= 0; $cmd{'timeout'} ||= $opts{'timeout'}; @@ -530,6 +527,8 @@ if ( $tesh_file eq "(stdin)" ) { } my %cmd; # everything about the next command to run +my $tesh_name = $tesh_file; +$tesh_name =~ s|^.*?/([^/]*)$|$1|; my $line_num = 0; LINE: while ( not $error and defined( my $line = <$infh> )) { chomp $line; @@ -614,7 +613,7 @@ LINE: while ( not $error and defined( my $line = <$infh> )) { } else { # regular command $cmd{'cmd'} = $arg; - $cmd{'file'} = $tesh_file; + $cmd{'file'} = $tesh_name; $cmd{'line'} = $line_num; } @@ -626,7 +625,7 @@ LINE: while ( not $error and defined( my $line = <$infh> )) { $cmd{'background'} = 1; $cmd{'cmd'} = $arg; - $cmd{'file'} = $tesh_file; + $cmd{'file'} = $tesh_name; $cmd{'line'} = $line_num; # Deal with the meta-commands @@ -772,7 +771,7 @@ sub cd_cmd($) { print "Chdir to $directory failed: No such file or directory\n"; } if ( $failure == 1 ) { - print "Test suite `$tesh_file': NOK (system error)\n"; + print "Test suite `$cmd{'filefile'}': NOK (system error)\n"; exit 4; } } -- 2.20.1