annotate __py_tests__.m @ 388:ce61206a61f8

build: make distcheck pass again * Makefile.am (EXTRA_DIST): Include $(M_FILES). (PKG_ADD, PKG_DEL): Use $(srcdir) as needed. (check-local): Use $(srcdir) to run the test script. * __py_tests__.m: Suppress warnings about opening files on the load path.
author Mike Miller <mtmiller@octave.org>
date Mon, 03 Apr 2017 11:51:01 -0700
parents c6e93e7dcfba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
383
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
1 ## Copyright (C) 2017 Mike Miller
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
2 ## Copyright (C) 2005-2017 David Bateman
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
3 ##
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
4 ## This file is part of Pytave.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
5 ##
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
6 ## Pytave is free software; you can redistribute it and/or modify it
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
9 ## (at your option) any later version.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
10 ##
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
11 ## Pytave is distributed in the hope that it will be useful, but
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
14 ## GNU General Public License for more details.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
15 ##
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
17 ## along with Pytave; see the file COPYING. If not, see
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
19
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
20 ## This is a script file, derived from Octave's __run_test_suite__.m
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
21 true;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
22
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
23 function retval = __run_py_tests__ (varargin)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
24
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
25 files_with_no_tests = {};
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
26 files_with_tests = {};
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
27
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28 pso = page_screen_output ();
388
ce61206a61f8 build: make distcheck pass again
Mike Miller <mtmiller@octave.org>
parents: 384
diff changeset
29 orig_wstate = warning ();
383
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
30
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
31 logfile = make_absolute_filename ("fntests.log");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
32 unwind_protect
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
33 page_screen_output (false);
388
ce61206a61f8 build: make distcheck pass again
Mike Miller <mtmiller@octave.org>
parents: 384
diff changeset
34 warning ("off", "Octave:data-file-in-path");
383
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
35 try
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
36 fid = fopen (logfile, "wt");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
37 if (fid < 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
38 error ("__run_test_suite__: could not open %s for writing", logfile);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
39 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
40 test ("", "explain", fid);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
41 dp = dn = dxf = dsk = drtsk = 0;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
42 puts ("\nIntegrated test scripts:\n\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
43 for i = 1:length (varargin)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
44 f = varargin{i};
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
45 if (has_tests (f))
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
46 print_test_file_name (f);
384
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
47 if (nargout ("test") < 5)
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
48 rtsk = 0;
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
49 [p, n, xf, sk] = test (f, "quiet", fid);
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
50 else
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
51 [p, n, xf, sk, rtsk] = test (f, "quiet", fid);
c6e93e7dcfba Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents: 383
diff changeset
52 endif
383
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
53 print_pass_fail (p, n, xf, sk, rtsk);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
54 dp += p;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
55 dn += n;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
56 dxf += xf;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
57 dsk += sk;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
58 drtsk += rtsk;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
59 files_with_tests(end+1) = f;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
60 else
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
61 ## To reduce the list length, only mark .cc files that contain
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
62 ## DEFUN definitions.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
63 files_with_no_tests(end+1) = f;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
64 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
65 endfor
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
66
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
67 puts ("\nSummary:\n\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
68 nfail = dn - dp - dxf;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
69 printf (" PASS %6d\n", dp);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
70 printf (" FAIL %6d\n", nfail);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
71 if (dxf > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
72 printf (" XFAIL %6d\n", dxf);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
73 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
74 if (dsk > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
75 printf (" SKIPPED (feature) %6d\n", dsk);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
76 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
77 if (drtsk > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
78 printf (" SKIPPED (run-time condition) %6d\n", drtsk);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
79 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
80 puts ("\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
81 printf ("See the file %s for additional details.\n", logfile);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
82 if (dxf > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
83 puts ("\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
84 puts ("Items listed as XFAIL above are known bugs.\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
85 puts ("Bug report numbers for them may be found in the log file:\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
86 puts (logfile);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
87 puts ("\nPlease help improve Pytave by contributing fixes for them.\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
88 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
89 if (dsk > 0 || drtsk > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
90 puts ("\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
91 puts ("Tests are most often skipped because the features they require\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
92 puts ("have been disabled. Features are most often disabled because\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
93 puts ("they require dependencies that were not present when Octave or\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
94 puts ("Pytave was built.\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
95 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
96
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
97 report_files_with_no_tests (files_with_tests, files_with_no_tests, ".m");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
98
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
99 puts ("\nPlease help improve Pytave by contributing tests for these files\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
100 printf ("(see the list in the file %s).\n\n", logfile);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
101
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
102 fprintf (fid, "\nFiles with no tests:\n\n%s",
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
103 list_in_columns (files_with_no_tests, 80));
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
104 fclose (fid);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
105 catch
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
106 disp (lasterr ());
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
107 end_try_catch
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
108 unwind_protect_cleanup
388
ce61206a61f8 build: make distcheck pass again
Mike Miller <mtmiller@octave.org>
parents: 384
diff changeset
109 warning ("off", "all");
ce61206a61f8 build: make distcheck pass again
Mike Miller <mtmiller@octave.org>
parents: 384
diff changeset
110 warning (orig_wstate);
383
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
111 page_screen_output (pso);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
112 end_unwind_protect
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
113 retval = (nfail != 0);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
114 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
115
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
116 function print_test_file_name (nm)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
117 filler = repmat (".", 1, 60-length (nm));
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
118 printf (" %s %s", nm, filler);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
119 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
120
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
121 function print_pass_fail (p, n, xf, sk, rtsk)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
122
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
123 if ((n + sk + rtsk) > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
124 printf (" PASS %4d/%-4d", p, n);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
125 nfail = n - p - xf;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
126 if (nfail > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
127 printf ("\n%71s %3d", "FAIL ", nfail);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
128 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
129 if (sk > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
130 printf ("\n%71s %3d", "(missing feature) SKIP ", sk);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
131 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
132 if (rtsk > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
133 printf ("\n%71s %3d", "(run-time condition) SKIP ", rtsk);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
134 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
135 if (xf > 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
136 printf ("\n%71s %3d", "XFAIL", xf);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
137 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
138 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
139 puts ("\n");
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
140
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
141 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
142
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
143 function retval = has_tests (f)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
144
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
145 fid = fopen (f);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
146 if (fid < 0)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
147 error ("__run_test_suite__: fopen failed: %s", f);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
148 endif
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
149
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
150 str = fread (fid, "*char")';
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
151 fclose (fid);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
152 retval = ! isempty (regexp (str,
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
153 '^%!(assert|error|fail|test|xtest|warning)',
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
154 'lineanchors', 'once'));
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
155
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
156 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
157
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
158 function n = num_elts_matching_pattern (lst, pat)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
159 n = sum (! cellfun ("isempty", regexp (lst, pat, 'once')));
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
160 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
161
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
162 function report_files_with_no_tests (with, without, typ)
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
163 pat = ['\' typ "$"];
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
164 n_with = num_elts_matching_pattern (with, pat);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
165 n_without = num_elts_matching_pattern (without, pat);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
166 n_tot = n_with + n_without;
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
167 printf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ);
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
168 endfunction
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
169
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
170 exit (__run_py_tests__ (argv (){:}));
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
171
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
172 ## Mark this file as fully tested.
d18843ff4dfd Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
173 %!assert (1)