]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
Upd. Failed test outputs listed last now. To easier find them.
authorWill Budic <redacted>
Fri, 5 Jul 2024 13:01:44 +0000 (23:01 +1000)
committerWill Budic <redacted>
Fri, 5 Jul 2024 13:01:44 +0000 (23:01 +1000)
tests/testAll.pl

index 1ee895b93ddcc5eb583076ae0fd793c4a94fbd36..07fa95496374c29be74d2581dd4ce54d2aba814b 100644 (file)
@@ -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";