public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Fix the statistical number of results in the html
@ 2021-09-07 23:57 songkai
  2021-09-07 23:57 ` songkai
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: songkai @ 2021-09-07 23:57 UTC (permalink / raw)
  To: ltp

From: wangkaiyuan <wangkaiyuan@inspur.com>

According to the statistical method of ltp-pan on TFAIL TBROK TCONF
TPASS..., the statistical method of the ltp test result type in 
genhtml.pl is modified to ensure that the .log format of the ltp 
result is consistent with the test result in the .html format.

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> 
               Chunsing.dey <daichx@inspur.com>
---
 tools/genhtml.pl | 52 ++++++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)
 mode change 100644 => 100755 tools/genhtml.pl

diff --git a/tools/genhtml.pl b/tools/genhtml.pl
old mode 100644
new mode 100755
index 7e9bdd471..1f440b4fa
--- 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,39 +176,31 @@ foreach my $file (@ARGV) {
                              $flag2 = 0;
                              $flag3 = 1;
                              $flag4 = 1;
+			     $flag5 = 1;
                              $row_line = $row_line . "</strong></pre></td>";
                         }
-                        if ( $flag2 == 1 ) {
+			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 {
+			}
+                        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/ ) {
+			if ( $line =~ /$output_tag/ ) {
                              $flag2 = 1;
                              $row_line = $row_line . "<td><pre><strong>";
                         }
@@ -233,7 +226,6 @@ print "<tr><td><strong>Output/Failed Result</strong></td><td><a href=\"file://$E
 print "<tr><td><strong>Total Tests</strong></td><td><strong>";
 $test_counter--;
 print "$test_counter                         </strong></td></tr>\n";
-$test_passed=$test_counter-$failed_test_counter-$brok_test_counter-$warn_test_counter-$retr_test_counter-$conf_test_counter;
 print "<tr><td><strong>Total Test TPASS:</strong></td><td><strong> $test_passed </strong></td></tr>\n";
 print "<tr><td><strong>Total Test TFAIL:</strong></td><td><strong> $failed_test_counter </strong></td></tr>\n";
 print "<tr><td><strong>Total Test TBROK</strong></td><td><strong> $brok_test_counter </strong></td></tr>\n";
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] Fix the statistical number of results in the html
@ 2021-09-26  1:23 Kane Wong (王楷元)
  0 siblings, 0 replies; 8+ messages in thread
From: Kane Wong (王楷元) @ 2021-09-26  1:23 UTC (permalink / raw)
  To: pvorel@suse.cz
  Cc: Harris song (宋凯)-浪潮信息,
	ltp@lists.linux.it


[-- Attachment #1.1: Type: text/plain, Size: 1812 bytes --]

Hi,

> Hi,
> 
> > From: wangkaiyuan <wangkaiyuan@inspur.com>
> 
> > According to the statistical method of ltp-pan on TFAIL TBROK TCONF
> > TPASS..., the statistical method of the ltp test result type in
> > genhtml.pl is modified to ensure that the .log format of the ltp
> > result is consistent with the test result in the .html format.
> 
> > 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
> This could be fixed with :?, right?
First of all, the regular expression matching error causes the html result
to be inconsistent with the log result. If only the regular expression is 
modified, it will cause multiple test results for one test item.For example,
if TPSS/TCONF appears in the same test item, the test item will be
counted twice, TPSS&TCONF, this is unreasonable, and the statistical 
logic in genhtml.pl is flawed

Kind regards,
wangkaiyuan
> > 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.
> That's a valid input.
> 
> > Signed-off-by: wangkaiyuan <wangkaiyuan@inspur.com>
> >                Chunsing.dey <daichx@inspur.com>
> nit: both should have Signed-off-by:, you can also use Co-developed-by:
> for the second developer.
> 
> nit: there are whitespace errors in the patch.
> 
> I do not dare to review it as I've never used the tool.
> FYI ltp-pan is deprecated, you can try to use runltp-ng [1] which we'd
like to
> bring to LTP upstream (to replace ltp-pan and runltp).
> 
> Kind regards,
> Petr
> 
> [1] https://github.com/metan-ucw/runltp-ng


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3783 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [LTP] [PATCH] Fix the statistical number of results in the html
@ 2022-06-28  5:41 wangkaiyuan
  2022-10-10 11:15 ` Richard Palethorpe
  0 siblings, 1 reply; 8+ messages in thread
From: wangkaiyuan @ 2022-06-28  5:41 UTC (permalink / raw)
  To: ltp; +Cc: wangkaiyuan

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(-)

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>";
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-10-10 11:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-07 23:57 [LTP] [PATCH] Fix the statistical number of results in the html songkai
2021-09-07 23:57 ` songkai
2021-09-24 10:04 ` Petr Vorel
2022-06-10 11:46 ` Cyril Hrubis
     [not found]   ` <6d6f7ae3098648018781effd62b2f6e5@inspur.com>
2022-06-21 13:22     ` [LTP] ????: " Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2021-09-26  1:23 [LTP] " Kane Wong (王楷元)
2022-06-28  5:41 wangkaiyuan
2022-10-10 11:15 ` Richard Palethorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox