Mercurial > hg > octave-avbm
changeset 5840:257643fc806b
[project @ 2006-06-01 22:08:00 by jwe]
author | jwe |
---|---|
date | Thu, 01 Jun 2006 22:08:00 +0000 |
parents | 0bc78d9ddcd4 |
children | fb4dea2184bf |
files | octMakefile.in test/ChangeLog test/fntests.m |
diffstat | 3 files changed, 30 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/octMakefile.in +++ b/octMakefile.in @@ -90,7 +90,7 @@ $(do-subst-script-vals) check: - $(MAKE) -C test check + $(MAKE) -C test $@ .PHONY: check octave.info:
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,10 +1,11 @@ 2006-06-01 John W. Eaton <jwe@octave.org> * 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 <jwe@octave.org>
--- a/test/fntests.m +++ b/test/fntests.m @@ -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");