diff mbox series

Fix the statistical number of results in the html

Message ID 20220628054107.45405-1-wangkaiyuan@inspur.com
State Accepted
Headers show
Series Fix the statistical number of results in the html | expand

Commit Message

wangkaiyuan June 28, 2022, 5:41 a.m. UTC
The original statistical method policy expression "/\ TFAIL\ /" in
the original genhtml.pl for the test result type cannot match the 
"TFAIL:" in the normal test result, causing problems in the calculation
result. At the same time, the statistical method in genhtml.pl cannot
guarantee that each test item has only one test result, because the
output of a test item may include TFAIL, TCONF, and TPASS at the same time.

Signed-off-by: wangkaiyuan <wangkaiyuan@inspur.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
---
 tools/genhtml.pl | 49 +++++++++++++++++++++---------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

Comments

Richard Palethorpe Oct. 10, 2022, 11:15 a.m. UTC | #1
Hello,

Merged with minor whitespace fix. This is redundant now though, please
see https://github.com/acerv/runltp-ng.
diff mbox series

Patch

diff --git a/tools/genhtml.pl b/tools/genhtml.pl
index 7e9bdd471..5f6016c47 100644
--- a/tools/genhtml.pl
+++ b/tools/genhtml.pl
@@ -50,6 +50,7 @@  my $retr_test_counter       = 0;
 my $retr_test_counter_flag  = 0;
 my $conf_test_counter       = 0;
 my $conf_test_counter_flag  = 0;
+my $test_passed             = 0;
 
 my $detected_fail = 0;
 my $detected_pass = 0;
@@ -115,7 +116,7 @@  foreach my $file (@ARGV) {
 		if ($line =~ /$end_tag/) {
                         print "$row_line";
 			$process_line  = 0;
-                        $flag  = 0;             $flag2 = 0;            $flag3 = 0;            $flag4 = 0;
+                        $flag  = 0;             $flag2 = 0;            $flag3 = 0;            $flag4 = 0;            $flag5 = 0;
                         $detected_fail = 0;     $detected_pass = 0;    $detected_warn = 0;    $detected_brok = 0;    $detected_retr = 0;    $detected_conf = 0;
                         $background_colour = 0; $failed_test_counter_flag = 0; $brok_test_counter_flag = 0; $warn_test_counter_flag = 0; $retr_test_counter_flag = 0; $conf_test_counter_flag = 0;  $row_line= "";
 		}
@@ -175,38 +176,30 @@  foreach my $file (@ARGV) {
                              $flag2 = 0;
                              $flag3 = 1;
                              $flag4 = 1;
+                             $flag5 = 1;
                              $row_line = $row_line . "</strong></pre></td>";
                         }
                         if ( $flag2 == 1 ) {
 			    $row_line = $row_line . "$line \n";
-			    if ($line =~ /\ TFAIL\ / ) {
-				$detected_fail = 1;
-				if ( $failed_test_counter_flag == 0 ) {
-				    $failed_test_counter++;
-				    $failed_test_counter_flag=1;
-				}
-			    } elsif ($line =~ /\ TBROK\ / ) {
-				$detected_brok = 1;
-				if ( $brok_test_counter_flag == 0 ) {
-				    $brok_test_counter++;
-				    $brok_test_counter_flag=1;
-				}
-			    } elsif ($line =~ /\ TWARN\ / ) {
-				$detected_warn = 1;
-				if ( $warn_test_counter_flag == 0 ) {
-				    $warn_test_counter++;
-				    $warn_test_counter_flag=1;
-				}
-			    } elsif ($line =~ /\ TCONF\ / ) {
-				$detected_conf = 1;
-				if ( $conf_test_counter_flag == 0 ) {
-				    $conf_test_counter++;
-				    $conf_test_counter_flag=1;
-				}
-                             } else {
-                                 $detected_pass = 1;
-                             }
                         }
+			 if ( $flag5 == 1 ) {
+			 	 if ($line =~  "termination_id=1" ) {
+					 $detected_fail = 1;
+					 $failed_test_counter++;
+				 } elsif ($line =~ "termination_id=2" ) {
+					 $detected_brok = 1;
+					 $brok_test_counter++;
+				 } elsif ($line =~ "termination_id=4" ) {
+					 $detected_warn = 1;
+					 $warn_test_counter++;
+				 } elsif ($line =~ "termination_id=32" ) {
+					 $detected_conf = 1;
+					 $conf_test_counter++;
+				 } elsif ($line =~ "termination_id=0" ) {
+					 $detected_pass = 1;
+					 $test_passed++;
+				 }
+			 }
                         if ( $line =~ /$output_tag/ ) {
                              $flag2 = 1;
                              $row_line = $row_line . "<td><pre><strong>";