Mercurial > octave
annotate test/fntests.m @ 15196:017f0b2e6933
rename gui directory to libgu
* libgui: Rename from gui.
* .hgsub (libgui/qterminal): Rename from gui/qterminal.
* Makefile.am (GUIDIR): Set to libgui instead of gui if
AMCOND_BUILD_GUI is true.
* configure.ac (AC_CONFIG_FILES): Update list for directory renaming.
* Makefile.am (.NOTPARALLEL): Delete.
List octave.html/index.html as the primary HTML target, not
octave.html.
(octave.html): New target for making the octave.html directory.
(octave.pdf): Depend on octave.dvi.
* images.awk: In generated rules for png files, depend on octave.html,
not octave.html/index.html.
* src/Makefile.am (OCTAVE_GUI_CPPFLAGS, OCTAVE_GUI_LIBS): Update for
directory renaming.
(CLEANFILES): Fix typo.
* fntests.m (src_tree): Use libinterp, not src.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 18 Aug 2012 18:10:09 -0400 |
parents | 460a3c6d8bf1 |
children | 5b2126a8c84f |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13833
diff
changeset
|
1 ## Copyright (C) 2005-2012 David Bateman |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
5590 | 19 clear all; |
20 | |
5840 | 21 global files_with_no_tests = {}; |
5845 | 22 global files_with_tests = {}; |
5590 | 23 global topsrcdir; |
6257 | 24 global topbuilddir; |
5590 | 25 |
26 currdir = canonicalize_file_name ("."); | |
27 | |
28 if (nargin == 1) | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14696
diff
changeset
|
29 xdir = argv (){1}; |
5590 | 30 else |
31 xdir = "."; | |
32 endif | |
33 | |
34 srcdir = canonicalize_file_name (xdir); | |
35 topsrcdir = canonicalize_file_name (fullfile (xdir, "..")); | |
6257 | 36 topbuilddir = canonicalize_file_name (fullfile (currdir, "..")); |
5590 | 37 |
38 if (strcmp (currdir, srcdir)) | |
39 testdirs = {srcdir}; | |
40 else | |
41 testdirs = {currdir, srcdir}; | |
42 endif | |
43 | |
15196
017f0b2e6933
rename gui directory to libgu
John W. Eaton <jwe@octave.org>
parents:
14846
diff
changeset
|
44 src_tree = canonicalize_file_name (fullfile (topsrcdir, "libinterp")); |
6257 | 45 liboctave_tree = canonicalize_file_name (fullfile (topsrcdir, "liboctave")); |
5590 | 46 script_tree = canonicalize_file_name (fullfile (topsrcdir, "scripts")); |
6257 | 47 local_script_tree = canonicalize_file_name (fullfile (currdir, "../scripts")); |
48 | |
6162 | 49 fundirs = {src_tree, liboctave_tree, script_tree}; |
5590 | 50 |
6257 | 51 if (! strcmp (currdir, srcdir)) |
52 fundirs{end+1} = local_script_tree; | |
53 endif | |
54 | |
5836 | 55 function print_test_file_name (nm) |
56 filler = repmat (".", 1, 55-length (nm)); | |
57 printf (" %s %s", nm, filler); | |
58 endfunction | |
59 | |
60 function print_pass_fail (n, p) | |
61 if (n > 0) | |
62 printf (" PASS %4d/%-4d", p, n); | |
63 nfail = n - p; | |
64 if (nfail > 0) | |
65 printf (" FAIL %d", nfail); | |
66 endif | |
67 endif | |
7762 | 68 puts ("\n"); |
5836 | 69 endfunction |
70 | |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
71 function retval = has_functions (f) |
10220
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
72 n = length (f); |
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
73 if (n > 3 && strcmp (f((end-2):end), ".cc")) |
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
74 fid = fopen (f); |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
75 if (fid >= 0) |
10220
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
76 str = fread (fid, "*char")'; |
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
77 fclose (fid); |
12462
e4dbfe3019b1
Use PCRE regular expressions throughout Octave.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
78 retval = ! isempty (regexp (str,'^(DEFUN|DEFUN_DLD)\b', 'lineanchors')); |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
79 else |
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
80 error ("fopen failed: %s", f); |
10220
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
81 endif |
04f2b4d68eba
test/fntests.m (hasfunctions): assume .m files have functions
John W. Eaton <jwe@octave.org>
parents:
10112
diff
changeset
|
82 elseif (n > 2 && strcmp (f((end-1):end), ".m")) |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
83 retval = true; |
9742
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
84 else |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
85 retval = false; |
9742
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
86 endif |
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
87 endfunction |
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
88 |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
89 function retval = has_tests (f) |
5840 | 90 fid = fopen (f); |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
91 if (fid >= 0) |
8699
6e764b7317bd
test/fntests.m, scripts/test/demo.m: error on fopen failures
John W. Eaton <jwe@octave.org>
parents:
8423
diff
changeset
|
92 str = fread (fid, "*char")'; |
6e764b7317bd
test/fntests.m, scripts/test/demo.m: error on fopen failures
John W. Eaton <jwe@octave.org>
parents:
8423
diff
changeset
|
93 fclose (fid); |
13069
48c94e21b57f
codesprint: recognize "fail" as a test in fntests.m
John W. Eaton <jwe@octave.org>
parents:
13049
diff
changeset
|
94 retval = ! isempty (regexp (str, '^%!(assert|error|fail|test|warning)', "lineanchors")); |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
95 else |
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
96 error ("fopen failed: %s", f); |
8699
6e764b7317bd
test/fntests.m, scripts/test/demo.m: error on fopen failures
John W. Eaton <jwe@octave.org>
parents:
8423
diff
changeset
|
97 endif |
5840 | 98 endfunction |
99 | |
12589
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
100 function retval = has_demos (f) |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
101 fid = fopen (f); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
102 if (fid >= 0) |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
103 str = fread (fid, "*char")'; |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
104 fclose (fid); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
105 retval = ! isempty (regexp (str, '^%!demo', "lineanchors")); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
106 else |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
107 error ("fopen failed: %s", f); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
108 endif |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
109 endfunction |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
110 |
7243 | 111 function [dp, dn, dxf, dsk] = run_test_dir (fid, d); |
5845 | 112 global files_with_tests; |
5840 | 113 global files_with_no_tests; |
5836 | 114 lst = dir (d); |
7243 | 115 dp = dn = dxf = dsk = 0; |
5836 | 116 for i = 1:length (lst) |
5590 | 117 nm = lst(i).name; |
13192
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
118 if (lst(i).isdir |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
119 && ! strcmp (nm, ".") && ! strcmp (nm, "..") |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
120 && ! strcmp (nm, "private") && nm(1) != "@" |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
121 && ! strcmp (nm, "CVS")) |
13833
0a28c49cb477
Format test suite output correctly on Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13192
diff
changeset
|
122 [p, n, xf, sk] = run_test_dir (fid, [d, filesep, nm]); |
5836 | 123 dp += p; |
5590 | 124 dn += n; |
6730 | 125 dxf += xf; |
7243 | 126 dsk += sk; |
5590 | 127 endif |
128 endfor | |
13192
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
129 saved_dir = pwd (); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
130 unwind_protect |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
131 chdir (d); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
132 for i = 1:length (lst) |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
133 nm = lst(i).name; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
134 if (length (nm) > 5 && strcmp (nm(1:5), "test_") |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
135 && strcmp (nm((end-1):end), ".m")) |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
136 p = n = xf = sk = 0; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
137 ffnm = fullfile (d, nm); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
138 if (has_tests (ffnm)) |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
139 print_test_file_name (nm); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
140 [p, n, xf, sk] = test (nm(1:(end-2)), "quiet", fid); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
141 print_pass_fail (n, p); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
142 files_with_tests(end+1) = ffnm; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
143 ##elseif (has_demos (ffnm)) |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
144 ## files_with_tests(end+1) = ffnm; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
145 else |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
146 files_with_no_tests(end+1) = ffnm; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
147 endif |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
148 dp += p; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
149 dn += n; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
150 dxf += xf; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
151 dsk += sk; |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
152 endif |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
153 endfor |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
154 unwind_protect_cleanup |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
155 chdir (saved_dir); |
968e89b45bbf
move tests for classes into subdirectories
John W. Eaton <jwe@octave.org>
parents:
13069
diff
changeset
|
156 end_unwind_protect |
5590 | 157 endfunction |
158 | |
7243 | 159 function [dp, dn, dxf, dsk] = run_test_script (fid, d); |
5845 | 160 global files_with_tests; |
5840 | 161 global files_with_no_tests; |
5781 | 162 global topsrcdir; |
6257 | 163 global topbuilddir; |
5836 | 164 lst = dir (d); |
7243 | 165 dp = dn = dxf = dsk = 0; |
5836 | 166 for i = 1:length (lst) |
5590 | 167 nm = lst(i).name; |
5836 | 168 if (lst(i).isdir && ! strcmp (nm, ".") && ! strcmp (nm, "..") |
11227
84846912f3c1
test/fntests.m: run tests for deprecated functions
John W. Eaton <jwe@octave.org>
parents:
11054
diff
changeset
|
169 && ! strcmp (nm, "CVS")) |
13833
0a28c49cb477
Format test suite output correctly on Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13192
diff
changeset
|
170 [p, n, xf, sk] = run_test_script (fid, [d, filesep, nm]); |
5590 | 171 dp += p; |
172 dn += n; | |
6730 | 173 dxf += xf; |
7243 | 174 dsk += sk; |
5590 | 175 endif |
176 endfor | |
5836 | 177 for i = 1:length (lst) |
5590 | 178 nm = lst(i).name; |
10112
fddfebeeb33a
Run tests in all *.cc files.
David Grundberg <davidg@cs.umu.se>
parents:
10026
diff
changeset
|
179 ## Ignore hidden files |
fddfebeeb33a
Run tests in all *.cc files.
David Grundberg <davidg@cs.umu.se>
parents:
10026
diff
changeset
|
180 if (nm(1) == '.') |
fddfebeeb33a
Run tests in all *.cc files.
David Grundberg <davidg@cs.umu.se>
parents:
10026
diff
changeset
|
181 continue |
fddfebeeb33a
Run tests in all *.cc files.
David Grundberg <davidg@cs.umu.se>
parents:
10026
diff
changeset
|
182 endif |
9742
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
183 f = fullfile (d, nm); |
9f8ff01abc65
.cc files are now included in the list of files requiring
Rik <rdrider0-list@yahoo.com>
parents:
9741
diff
changeset
|
184 if ((length (nm) > 2 && strcmp (nm((end-1):end), ".m")) || |
10112
fddfebeeb33a
Run tests in all *.cc files.
David Grundberg <davidg@cs.umu.se>
parents:
10026
diff
changeset
|
185 (length (nm) > 3 && strcmp (nm((end-2):end), ".cc"))) |
6730 | 186 p = n = xf = 0; |
5590 | 187 ## Only run if it contains %!test, %!assert %!error or %!warning |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
188 if (has_tests (f)) |
13833
0a28c49cb477
Format test suite output correctly on Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13192
diff
changeset
|
189 tmp = strrep (f, [topsrcdir, filesep], ""); |
0a28c49cb477
Format test suite output correctly on Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13192
diff
changeset
|
190 tmp = strrep (tmp, [topbuilddir, filesep], ["..", filesep]); |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
191 print_test_file_name (tmp); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
192 [p, n, xf, sk] = test (f, "quiet", fid); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
193 print_pass_fail (n, p); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
194 dp += p; |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
195 dn += n; |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
196 dxf += xf; |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
197 dsk += sk; |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
198 files_with_tests(end+1) = f; |
13043
098c8e696236
fntests.m: No longer count file with demos as being tested
Rik <octave@nomad.inbox5.com>
parents:
12589
diff
changeset
|
199 ##elseif (has_demos (f)) |
098c8e696236
fntests.m: No longer count file with demos as being tested
Rik <octave@nomad.inbox5.com>
parents:
12589
diff
changeset
|
200 ## files_with_tests(end+1) = f; |
11024
fa56fd98c0c5
Remove requirement for PCRE in Octave. (Bug #31025)
Rik <octave@nomad.inbox5.com>
parents:
11019
diff
changeset
|
201 elseif (has_functions (f)) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
202 ## To reduce the list length, only mark .cc files that contain |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
203 ## DEFUN definitions. |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
204 files_with_no_tests(end+1) = f; |
5590 | 205 endif |
206 endif | |
207 endfor | |
5667 | 208 ## printf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn); |
5590 | 209 endfunction |
210 | |
5836 | 211 function printf_assert (varargin) |
5590 | 212 global _assert_printf; |
5836 | 213 _assert_printf = cat (2, _assert_printf, sprintf (varargin{:})); |
5590 | 214 endfunction |
215 | |
5836 | 216 function ret = prog_output_assert (str) |
5590 | 217 global _assert_printf; |
5836 | 218 if (isempty (_assert_printf)) |
219 ret = isempty (str); | |
5590 | 220 elseif (_assert_printf(end) == "\n") |
5836 | 221 ret = strcmp (_assert_printf(1:(end-1)), str); |
5590 | 222 else |
5836 | 223 ret = strcmp (_assert_printf, str); |
5590 | 224 endif |
225 _assert_printf = ""; | |
226 endfunction | |
227 | |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
228 function n = num_elts_matching_pattern (lst, pat) |
12589
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
229 n = sum (cellfun (@(x) !isempty (x), regexp (lst, pat, 'once'))); |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
230 endfunction |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
231 |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
232 function report_files_with_no_tests (with, without, typ) |
12589
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
233 pat = cstrcat ('\', typ, "$"); |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
234 n_with = num_elts_matching_pattern (with, pat); |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
235 n_without = num_elts_matching_pattern (without, pat); |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
236 n_tot = n_with + n_without; |
13049
b37d8e5aedf3
fntests.m: Remove statement about demos from "No Tests" message
Rik <octave@nomad.inbox5.com>
parents:
13043
diff
changeset
|
237 printf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ); |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
238 endfunction |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
239 |
5836 | 240 pso = page_screen_output (); |
241 warn_state = warning ("query", "quiet"); | |
242 warning ("on", "quiet"); | |
5590 | 243 try |
5836 | 244 page_screen_output (0); |
14696
775fed9ed47d
test: Turn off 'deprecated-function' warning when running fntests.m
Rik <octave@nomad.inbox5.com>
parents:
14351
diff
changeset
|
245 warning ("off", "Octave:deprecated-function"); |
5836 | 246 fid = fopen ("fntests.log", "wt"); |
5590 | 247 if (fid < 0) |
5836 | 248 error ("could not open fntests.log for writing"); |
5590 | 249 endif |
5836 | 250 test ("", "explain", fid); |
7243 | 251 dp = dn = dxf = dsk = 0; |
7762 | 252 puts ("\nIntegrated test scripts:\n\n"); |
5836 | 253 for i = 1:length (fundirs) |
7243 | 254 [p, n, xf, sk] = run_test_script (fid, fundirs{i}); |
5836 | 255 dp += p; |
256 dn += n; | |
6730 | 257 dxf += xf; |
7243 | 258 dsk += sk; |
5590 | 259 endfor |
7762 | 260 puts ("\nFixed test scripts:\n\n"); |
5836 | 261 for i = 1:length (testdirs) |
7243 | 262 [p, n, xf, sk] = run_test_dir (fid, testdirs{i}); |
5836 | 263 dp += p; |
264 dn += n; | |
6730 | 265 dxf += xf; |
7243 | 266 dsk += sk; |
5590 | 267 endfor |
14351
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
268 puts ("\nSummary:\n\n"); |
5667 | 269 nfail = dn - dp; |
14351
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
270 printf (" PASS %6d\n", dp); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
271 printf (" FAIL %6d\n", nfail); |
6730 | 272 if (dxf > 0) |
14351
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
273 printf (" XFAIL %6d\n", dxf); |
6730 | 274 endif |
7243 | 275 if (dsk > 0) |
14351
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
276 printf (" SKIPPED %6d\n", dsk); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
277 endif |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
278 puts ("\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
279 puts ("See the file test/fntests.log for additional details.\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
280 if (dxf > 0) |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
281 puts ("\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
282 puts ("Expected failures (listed as XFAIL above) are known bugs.\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
283 puts ("Please help improve Octave by contributing fixes for them.\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
284 endif |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
285 if (dsk > 0) |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
286 puts ("\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
287 puts ("Tests are most often skipped because the features they require\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
288 puts ("have been disabled. Features are most often disabled because\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
289 puts ("they require dependencies that were not present when Octave\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
290 puts ("was built. The configure script should have printed a summary\n"); |
e257d7363133
improve test summary message
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
291 puts ("at the end of its run indicating which dependencies were not found.\n"); |
7243 | 292 endif |
293 | |
12589
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
294 ## Weed out deprecated and private functions |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
295 weed_idx = cellfun (@isempty, regexp (files_with_tests, '\bdeprecated\b|\bprivate\b', 'once')); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
296 files_with_tests = files_with_tests(weed_idx); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
297 weed_idx = cellfun (@isempty, regexp (files_with_no_tests, '\bdeprecated\b|\bprivate\b', 'once')); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
298 files_with_no_tests = files_with_no_tests(weed_idx); |
890af1cf0a86
Remove deprecated and private functions from list of functions requiring tests.
Rik <octave@nomad.inbox5.com>
parents:
12469
diff
changeset
|
299 |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
300 report_files_with_no_tests (files_with_tests, files_with_no_tests, ".m"); |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
301 report_files_with_no_tests (files_with_tests, files_with_no_tests, ".cc"); |
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
302 |
9710
519e164dde1e
Fix typo of an extra space in instructions to user
Rik <rdrider0-list@yahoo.com>
parents:
9696
diff
changeset
|
303 puts ("\nPlease help improve Octave by contributing tests for\n"); |
10899
686e3bc432a2
fntests.m: Add extra newline for more readable output during make.
Rik <octave@nomad.inbox5.com>
parents:
10220
diff
changeset
|
304 puts ("these files (see the list in the file fntests.log).\n\n"); |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
305 |
5840 | 306 fprintf (fid, "\nFiles with no tests:\n\n%s", |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
11032
diff
changeset
|
307 list_in_columns (files_with_no_tests, 80)); |
5836 | 308 fclose (fid); |
7645
734854f21c94
fntests.m: report number .m and .cc files without tests separately
John W. Eaton <jwe@octave.org>
parents:
7300
diff
changeset
|
309 |
5836 | 310 page_screen_output (pso); |
311 warning (warn_state.state, "quiet"); | |
5590 | 312 catch |
5836 | 313 page_screen_output (pso); |
314 warning (warn_state.state, "quiet"); | |
315 disp (lasterr ()); | |
5590 | 316 end_try_catch |