# HG changeset patch # User jwe # Date 1149199680 0 # Node ID 257643fc806be0f83fdbe1b44375628b915e5347 # Parent 0bc78d9ddcd4434a6f9f59fbea7af7c7e6f443ca [project @ 2006-06-01 22:08:00 by jwe] diff -r 0bc78d9ddcd4 -r 257643fc806b octMakefile.in --- a/octMakefile.in Thu Jun 01 21:23:35 2006 +0000 +++ b/octMakefile.in Thu Jun 01 22:08:00 2006 +0000 @@ -90,7 +90,7 @@ $(do-subst-script-vals) check: - $(MAKE) -C test check + $(MAKE) -C test $@ .PHONY: check octave.info: diff -r 0bc78d9ddcd4 -r 257643fc806b test/ChangeLog --- a/test/ChangeLog Thu Jun 01 21:23:35 2006 +0000 +++ b/test/ChangeLog Thu Jun 01 22:08:00 2006 +0000 @@ -1,10 +1,11 @@ 2006-06-01 John W. Eaton * fntests.m (print_test_file_name, print_pass_fail): New functions. - (runtestdir, runtestscript): Use them. Print info for each file. + (runtestdir, runtestscript): Use them. Print info for each file + with tests. Print info about files without tests to log file. (run_test_dir): Rename from runtestdir. Change all uses. (run_test_script): Rename from runtestscript. Change all uses. - Handle page_screen_output as a fucntion instead of a built-in + Handle page_screen_output as a function instead of a built-in variable. 2006-05-04 John W. Eaton diff -r 0bc78d9ddcd4 -r 257643fc806b test/fntests.m --- a/test/fntests.m Thu Jun 01 21:23:35 2006 +0000 +++ b/test/fntests.m Thu Jun 01 22:08:00 2006 +0000 @@ -1,5 +1,6 @@ clear all; +global files_with_no_tests = {}; global topsrcdir; currdir = canonicalize_file_name ("."); @@ -35,41 +36,42 @@ if (nfail > 0) printf (" FAIL %d", nfail); endif - else - printf (" no tests"); endif printf ("\n"); endfunction +function y = hastests (f) + fid = fopen (f); + str = fscanf (fid, "%s"); + fclose (fid); + y = (findstr (str, "%!test") || findstr (str, "%!assert") + || findstr (str, "%!error") || findstr (str, "%!warning")); +endfunction + function [dp, dn] = run_test_dir (fid, d); + global files_with_no_tests; lst = dir (d); dp = dn = 0; for i = 1:length (lst) nm = lst(i).name; if (length (nm) > 5 && strcmp (nm(1:5), "test_") && strcmp (nm((end-1):end), ".m")) - print_test_file_name (nm); - [p, n] = test (nm(1:(end-2)), "quiet", fid); - print_pass_fail (n, p); + p = n = 0; + if (hastests (fullfile (d, nm))) + print_test_file_name (nm); + [p, n] = test (nm(1:(end-2)), "quiet", fid); + print_pass_fail (n, p); + else + files_with_no_tests(end+1) = fullfile (d, nm); + endif dp += p; dn += n; endif endfor endfunction -function y = hastests (f) - fid = fopen (f); - str = fscanf (fid, "%s"); - if (findstr (str, "%!test") || findstr (str, "%!assert") - || findstr (str, "%!error") || findstr (str, "%!warning")) - y = 1; - else - y = 0; - endif - fclose (fid); -endfunction - function [dp, dn] = run_test_script (fid, d); + global files_with_no_tests; global topsrcdir; lst = dir (d); dp = dn = 0; @@ -87,15 +89,17 @@ if ((length (nm) > 3 && strcmp (nm((end-2):end), ".cc")) || (length (nm) > 2 && strcmp (nm((end-1):end), ".m"))) f = fullfile (d, nm); - print_test_file_name (strrep (f, [topsrcdir, "/"], "")); p = n = 0; ## Only run if it contains %!test, %!assert %!error or %!warning if (hastests (f)) + print_test_file_name (strrep (f, [topsrcdir, "/"], "")); [p, n] = test (f, "quiet", fid); + print_pass_fail (n, p); dp += p; dn += n; + else + files_with_no_tests(end+1) = f; endif - print_pass_fail (n, p); endif endfor ## printf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn); @@ -144,7 +148,9 @@ printf ("\nSummary:\n\n PASS %6d\n", dp); nfail = dn - dp; printf (" FAIL %6d\n", nfail); - printf ("\nSee fntests.log for details.\n"); + printf ("\n%d files have no tests\n", length (files_with_no_tests)); + fprintf (fid, "\nFiles with no tests:\n\n%s", + list_in_columns (files_with_no_tests, 80)); fclose (fid); page_screen_output (pso); warning (warn_state.state, "quiet");