changeset 30112:4fa7200f230a

* __run_test_suite__.m: Show summary of failed tests before final summary.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Sep 2021 11:17:45 -0400
parents b08749cb3261
children 3efce22b7350
files scripts/testfun/__run_test_suite__.m
diffstat 1 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/__run_test_suite__.m	Wed Sep 01 23:53:27 2021 -0400
+++ b/scripts/testfun/__run_test_suite__.m	Thu Sep 02 11:17:45 2021 -0400
@@ -42,6 +42,7 @@
   endif
   files_with_no_tests = {};
   files_with_tests = {};
+  summary_failure_info = struct ([]);
   ## FIXME: These names don't really make sense if we are running
   ##        tests for an installed copy of Octave.
   if (isempty (topsrcdir))
@@ -90,6 +91,14 @@
         drtsk += rtsk;
         drgrs += rgrs;
       endfor
+      if (! isempty (summary_failure_info))
+        puts ("\nFailure Summary:\n\n");
+        for i = 1:numel (summary_failure_info)
+          info = summary_failure_info(i);
+          print_test_file_name (info.name);
+          print_pass_fail (info);
+        endfor
+      endif
       puts ("\nSummary:\n\n");
       nfail = dn - dp - dxf - dxb - drgrs;
       printf ("  %-30s %6d\n", "PASS", dp);
@@ -214,6 +223,13 @@
             drtsk += rtsk;
             drgrs += rgrs;
             files_with_tests(end+1) = ffnm;
+            if (n - p > 0)
+              ## Save info for summary if there were any failed
+              ## tests for this file.
+              failure_info = struct ("name", tmp, "pass", p, "ntst", n,
+                                     "xf", xf, "xb", xb, "rgrs", rgrs);
+              summary_failure_info(end+1) = failure_info;
+            endif
           else
             ## To reduce the list length, only mark .cc files that contain
             ## DEFUN definitions.
@@ -238,7 +254,20 @@
   printf ("  %s %s", nm, filler);
 endfunction
 
-function print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs)
+function fail_info = print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs)
+
+  if (nargin == 1)
+    ## The summary info struct just contains info about failures, not
+    ## skipped tests.
+    info = p;
+    p = info.pass;
+    n = info.ntst;
+    xf = info.xf;
+    xb = info.xb;
+    sk = 0;
+    rtsk = 0;
+    rgrs = info.rgrs;
+  endif
 
   if ((n + sk + rtsk + rgrs) > 0)
     printf (" pass %4d/%-4d", p, n);