From 1a2aa48b9d5e2e8d21cd1802e4fd799ca0e39b4f Mon Sep 17 00:00:00 2001 From: Will Budic Date: Fri, 5 Jul 2024 23:01:44 +1000 Subject: [PATCH] Upd. Failed test outputs listed last now. To easier find them. --- tests/testAll.pl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/testAll.pl b/tests/testAll.pl index 1ee895b..07fa954 100644 --- a/tests/testAll.pl +++ b/tests/testAll.pl @@ -9,7 +9,6 @@ use Syntax::Keyword::Try; use Date::Manip; use Term::ANSIColor qw(:constants); use IPC::Run qw( run timeout ); -use File::Spec; use Cwd qw(getcwd); my $CWD = getcwd; @@ -44,7 +43,7 @@ try{ my @files = grep { !/^\./ && /^test.*?\.pl$/ && $0 !~ m/$_$/ && -f "./tests/$_" } readdir($dh); closedir $dh; - my ($test_pass, $test_fail, $test_cases, @OUT, %WARN)=(0,0,0,(),()); + my ($test_pass, $test_fail, $test_cases, @OUT, @ERR, %WARN)=(0,0,0,(),(),()); foreach my $file(sort @files) { @@ -56,28 +55,33 @@ try{ run (\@perl, \$in, \$output, '2>>', \$warnings); ### my @test_ret = $output=~m/(\d*)\|(\w*)\|($CWD\/$file)$/g; - $output=~s/\d*\|.*\|$file\s$//g; - push @OUT, $output; - if ($warnings){ - for(split "\n", $warnings){ - $WARN{$file} = $warnings; - } + $output=~s/\d*\|\w*\|($CWD\/$file)\s$//g; + + if ($warnings){ + for(split "\n", $warnings){ + $WARN{$CWD."/$file"} = $warnings; } + } if(@test_ret && $test_ret[1] eq 'SUCCESS'){ $test_pass++; #This is actually global test cases pass before sequently hitting an fail. $test_cases+= $test_ret[0]; + push @OUT, $output; }else{ $test_fail++; - my $failed = BOLD. RED. "Failed Test File -> ". RESET. File::Spec->rel2abs($file) ."\n". RESET; + my $failed = BOLD. RED. "Failed Test File -> ". RESET. $CWD."/$file".RESET."\n"; print $failed; - print RED, "\t", $warnings, RESET; + print RED, "\t", $warnings, RESET if $warnings; $failed[@failed] = $failed; + push @ERR, $output; } } - foreach(@OUT){ - print $_; + foreach (@OUT){ + print $_ + } + foreach (@ERR){ + print $_ } print '-'x100, "\n"; -- 2.34.1