From 56fb394e326f78f28466f696788c581515fbd1a2 Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Tue, 29 May 2018 17:15:11 +0200 Subject: [PATCH] Update prove2junit.pl to group tests into testsuites in jenkins --- sandbox/prove2junit.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sandbox/prove2junit.pl b/sandbox/prove2junit.pl index 86de1a88..a6874dbe 100755 --- a/sandbox/prove2junit.pl +++ b/sandbox/prove2junit.pl @@ -5,6 +5,7 @@ use warnings; my $file = $ARGV[0]; my $testcase = ""; +my $testsuite = ""; my $error_collect = ""; my $error_print = ""; @@ -14,12 +15,20 @@ if (not defined $file) { open (my $info, $file) or die "Could not open $file: $!"; -print "\n"; +print "\n"; while(my $line = <$info>) { - if ($line =~ /^(t\/\S+).* (\.*) (skipped:) (.*)$/) { print "Skip reason:\n"; } + if ($line =~ /^(t\/)(\S+)(\/)(\S+).* (\.*) (skipped:) (.*)$/) { print "Skip reason:\n"; } elsif ($line =~ /^ok (\d+) - (.*)$/) { print "Test description:\n"; } elsif ($line =~ /^not ok (\d+) - (.*)$/) { print "Test description:\n"; } - elsif ($line =~ /^(t\/\S+).* (\.*) $/) { $testcase = "$1"; $error_print = $error_collect; $error_collect = ""; } + elsif ($line =~ /^(t\/)(\S+)(\/)(\S+).* (\.*) $/) { + if ( "$2" eq "$testsuite" ) { + $testcase = "$4"; $error_print = $error_collect; $error_collect = ""; + } + else { + if ( "$testsuite" ne "" ) { print "\n"; } + $testsuite = "$2"; $testcase = "$4"; $error_print = $error_collect; $error_collect = ""; print "\n"; + } + } elsif ($line !~ /^ok$/ && $line !~ /^\d+..\d+$/) { $error_collect = $error_collect . $line; } } -print "\n" +print "\n\n";