[FFmpeg-devel] [FATESERVER/PATCH 5/8] Move $nfail calculation to FATE.pm

Timothy Gu timothygu99 at gmail.com
Wed Jun 11 03:07:51 CEST 2014


Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---
 FATE.pm   |  4 +++-
 index.cgi | 10 ++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/FATE.pm b/FATE.pm
index 0992c96..806168d 100644
--- a/FATE.pm
+++ b/FATE.pm
@@ -76,6 +76,7 @@ sub split_stats {
     return {
         ntests => int $st[1],
         npass  => int $st[2],
+        nfail  => int $st[1] - int $st[2],
         nwarn  =>     $st[3],
     };
 }
@@ -115,7 +116,8 @@ sub load_summary {
         $ntests++;
     }
     close R;
-    return { %$hdr, %$conf, ntests => $ntests, npass => $npass };
+    return { %$hdr, %$conf, ntests => $ntests, npass => $npass,
+             nfail => $ntests - $npass };
 }
 
 sub load_report {
diff --git a/index.cgi b/index.cgi
index 9157daa..9a59370 100755
--- a/index.cgi
+++ b/index.cgi
@@ -64,9 +64,8 @@ for my $slot (@slots) {
     }
 
     if (my $prev = load_summary $slot, 'previous') {
-        my $nfail = $$rep{ntests}  - $$rep{npass};
         my $pfail = $$prev{ntests} - $$prev{npass};
-        $$rep{alert} = $$rep{ntests} && $nfail <=> $pfail;
+        $$rep{alert} = $$rep{ntests} && $$rep{nfail} <=> $pfail;
         $$rep{dwarn} = $$rep{nwarn} <=> $$prev{nwarn};
         $$rep{pdate} = $$prev{date};
     }
@@ -309,7 +308,6 @@ for my $rep (sort repcmp @reps) {
     if ($npass < $ntest && $ntest - $npass < 100) {
         my $report = load_report $$rep{slot}, $$rep{date};
         my @fail = grep $$_{status} ne '0', @{$$report{recs}};
-        my $nfail = @fail;
         my $lastpass = load_lastpass $$rep{slot};
 
         start 'tr', id => $slotid, class => 'slotfail';
@@ -317,10 +315,10 @@ for my $rep (sort repcmp @reps) {
         start 'table', class => 'minirep';
         start 'thead';
         start 'tr';
-        if ($nfail eq 1) {
-            th "$nfail failed test";
+        if ($$rep{nfail} eq 1) {
+            th "1 failed test";
         } else {
-            th "$nfail failed tests";
+            th "$$rep{nfail} failed tests";
         }
         th 'Status', class => 'errcode';
         end 'tr';
-- 
1.9.1



More information about the ffmpeg-devel mailing list