comparison scripts/testfun/__run_test_suite__.m @ 33100:71bbf3d89efe stable

display total time to execute test suite * __run_test_suite__.m (__run_test_suite__): Also track and display total CPU and wall-clock time. (print_pass_fail): Use ID to pair tic and toc calls.
author John W. Eaton <jwe@octave.org>
date Tue, 27 Feb 2024 23:48:37 -0500
parents 4d24afc1d32b
children
comparison
equal deleted inserted replaced
33096:55c8c338aaeb 33100:71bbf3d89efe
66 try 66 try
67 fid = fopen (logfile, "wt"); 67 fid = fopen (logfile, "wt");
68 if (fid < 0) 68 if (fid < 0)
69 error ("__run_test_suite__: could not open %s for writing", logfile); 69 error ("__run_test_suite__: could not open %s for writing", logfile);
70 endif 70 endif
71 tot_cpu_tm = cputime ();
72 tot_tic_tag = tic ();
71 test ("", "explain", fid); 73 test ("", "explain", fid);
72 puts ("\nIntegrated test scripts:\n\n"); 74 puts ("\nIntegrated test scripts:\n\n");
73 printf ("%101s\n", "[ CPU / CLOCK ]"); 75 printf ("%101s\n", "[ CPU / CLOCK ]");
74 for i = 1:length (fcndirs) 76 for i = 1:length (fcndirs)
75 [p, n, xf, xb, sk, rtsk, rgrs] = run_test_dir (fid, fcndirs{i}, false); 77 [p, n, xf, xb, sk, rtsk, rgrs] = run_test_dir (fid, fcndirs{i}, false);
90 dxb += xb; 92 dxb += xb;
91 dsk += sk; 93 dsk += sk;
92 drtsk += rtsk; 94 drtsk += rtsk;
93 drgrs += rgrs; 95 drgrs += rgrs;
94 endfor 96 endfor
97 tot_clock_tm = toc (tot_tic_tag);
98 tot_cpu_tm = cputime () - tot_cpu_tm;
99 printf ("%80s [%6.1fs / %6.1fs]", "total time (CPU / CLOCK)", tot_cpu_tm, tot_clock_tm);
95 if (! isempty (summary_failure_info)) 100 if (! isempty (summary_failure_info))
96 puts ("\nFailure Summary:\n\n"); 101 puts ("\nFailure Summary:\n\n");
97 for i = 1:numel (summary_failure_info) 102 for i = 1:numel (summary_failure_info)
98 info = summary_failure_info(i); 103 info = summary_failure_info(i);
99 print_test_file_name (info.name); 104 print_test_file_name (info.name);
213 ## Only run if contains %!test, %!assert, %!error, %!fail, or %!warning 218 ## Only run if contains %!test, %!assert, %!error, %!fail, or %!warning
214 if (has_tests (ffnm)) 219 if (has_tests (ffnm))
215 tmp = reduce_test_file_name (ffnm, topbuilddir, topsrcdir); 220 tmp = reduce_test_file_name (ffnm, topbuilddir, topsrcdir);
216 print_test_file_name (tmp); 221 print_test_file_name (tmp);
217 cpu_tm = cputime (); 222 cpu_tm = cputime ();
218 tic (); 223 tic_tag = tic ();
219 [p, n, xf, xb, sk, rtsk, rgrs] = test (ffnm, "quiet", fid); 224 [p, n, xf, xb, sk, rtsk, rgrs] = test (ffnm, "quiet", fid);
220 clock_tm = toc (); 225 clock_tm = toc (tic_tag);
221 cpu_tm = cputime () - cpu_tm; 226 cpu_tm = cputime () - cpu_tm;
222 print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs, cpu_tm, clock_tm); 227 print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs, cpu_tm, clock_tm);
223 dp += p; 228 dp += p;
224 dn += n; 229 dn += n;
225 dxf += xf; 230 dxf += xf;