Merge lp:~lifeless/subunit/polish into lp:~subunit/subunit/trunk
- polish
- Merge into trunk
Proposed by
Robert Collins
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~lifeless/subunit/polish |
Merge into: | lp:~subunit/subunit/trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~lifeless/subunit/polish |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+5007@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote : | # |
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'SConstruct' |
2 | --- SConstruct 2008-12-07 23:29:06 +0000 |
3 | +++ SConstruct 2009-03-27 05:46:43 +0000 |
4 | @@ -16,10 +16,10 @@ |
5 | DESTDIR += '/' |
6 | include = os.path.join(DESTDIR, "include", "subunit") |
7 | lib = os.path.join(DESTDIR, "lib") |
8 | -# bin = "#export/$PLATFORM/bin" |
9 | +bin = os.path.join(DESTDIR, "bin") |
10 | env = Environment() |
11 | tests = [] |
12 | -Export('env', 'lib', 'include', 'DESTDIR', 'tests') |
13 | +Export('bin', 'env', 'lib', 'include', 'DESTDIR', 'tests') |
14 | |
15 | # support tools |
16 | def run_test_scripts(source, target, env, for_signature): |
17 | |
18 | === added file 'c/check-subunit-0.9.6.patch' |
19 | --- c/check-subunit-0.9.6.patch 1970-01-01 00:00:00 +0000 |
20 | +++ c/check-subunit-0.9.6.patch 2009-03-28 08:39:25 +0000 |
21 | @@ -0,0 +1,740 @@ |
22 | +=== modified file 'AUTHORS' |
23 | +--- AUTHORS 2009-02-03 12:38:12 +0000 |
24 | ++++ AUTHORS 2009-03-28 06:48:39 +0000 |
25 | +@@ -20,6 +20,7 @@ |
26 | + Daniel Gollub (pthreads support) |
27 | + Friedrich Beckmann (mingw and msvc port) |
28 | + Roy Merkel (specified test exit value) |
29 | ++ Robert Collins (subunit support) |
30 | + |
31 | + Anybody who has contributed code to Check or Check's build system is |
32 | + considered an author. Send patches to this file to |
33 | + |
34 | +=== modified file 'NEWS' |
35 | +--- NEWS 2008-12-29 14:46:39 +0000 |
36 | ++++ NEWS 2009-03-28 06:48:39 +0000 |
37 | +@@ -1,3 +1,9 @@ |
38 | ++In development: |
39 | ++ |
40 | ++* Added CK_SUBUNIT support for outputting test information in the subunit wire |
41 | ++ protocol. See the check manual for more information. (Contributed by Robert |
42 | ++ Collins). |
43 | ++ |
44 | + Mon, Dec 29, 2009: Released Check 0.9.6 |
45 | + based on r453 (2008-12-01 22:14:15). |
46 | + |
47 | + |
48 | +=== modified file 'configure.ac' |
49 | +--- configure.ac 2008-12-31 01:23:32 +0000 |
50 | ++++ configure.ac 2009-03-28 07:31:57 +0000 |
51 | +@@ -74,6 +74,26 @@ |
52 | + |
53 | + AM_CONDITIONAL(NO_TIMEOUT_TESTS, test x"$enable_timeout_tests" = "xfalse") |
54 | + |
55 | ++AC_ARG_ENABLE(subunit, |
56 | ++AC_HELP_STRING([--enable-subunit], |
57 | ++ [enable support for the subunit test protocol @<:@default=autodetect@:>@]), |
58 | ++[case "${enableval}" in |
59 | ++ yes) |
60 | ++ enable_subunit=true |
61 | ++ echo "Enabled subunit support" |
62 | ++ ;; |
63 | ++ no) |
64 | ++ enable_subunit=false |
65 | ++ echoo "Disabled subunit support" |
66 | ++ ;; |
67 | ++ autodetect) |
68 | ++ echo "Subunit support will enable automatically." |
69 | ++ ;; |
70 | ++ *) AC_MSG_ERROR(bad value ${enableval} for --enable-subunit) ;; |
71 | ++esac], |
72 | ++[echo "Subunit support will enable automatically." |
73 | ++ enable_subunit=autodetect]) |
74 | ++ |
75 | + # Checks for programs. |
76 | + AC_PROG_AWK |
77 | + AC_PROG_CC |
78 | +@@ -103,6 +123,42 @@ |
79 | + AC_HEADER_SYS_WAIT |
80 | + AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h]) |
81 | + |
82 | ++if test xfalse != x"$enable_subunit"; then |
83 | ++AC_CHECK_LIB(subunit, subunit_test_start, , |
84 | ++[case "$enable_subunit" in |
85 | ++ autodetect) |
86 | ++ enable_subunit=false |
87 | ++ ;; |
88 | ++ true) |
89 | ++ AC_MSG_ERROR([libsubunit is required for subunit protocol support. The homepage for subunit is https://launchpad.net/subunit/]) |
90 | ++ ;; |
91 | ++ esac |
92 | ++]) |
93 | ++fi |
94 | ++if test xfalse != x"$enable_subunit"; then |
95 | ++AC_CHECK_HEADER([subunit/child.h], , |
96 | ++[case "$enable_subunit" in |
97 | ++ autodetect) |
98 | ++ enable_subunit=false |
99 | ++ ;; |
100 | ++ true) |
101 | ++ AC_MSG_ERROR([The header subunit/child.h could not be succesfully included and is required for subunit protocol support. The homepage for subunit is https://launchpad.net/subunit/]) |
102 | ++ ;; |
103 | ++ esac |
104 | ++]) |
105 | ++fi |
106 | ++if test xfalse = x"$enable_subunit"; then |
107 | ++ENABLE_SUBUNIT="0" |
108 | ++else |
109 | ++ENABLE_SUBUNIT="1" |
110 | ++fi |
111 | ++AC_SUBST(ENABLE_SUBUNIT) |
112 | ++AC_DEFINE_UNQUOTED(ENABLE_SUBUNIT, $ENABLE_SUBUNIT, [Subunit protocol result output]) |
113 | ++ |
114 | ++AM_CONDITIONAL(SUBUNIT, test x"$enable_subunit" != "xfalse") |
115 | ++ |
116 | ++ |
117 | ++ |
118 | + # Checks for typedefs, structures, and compiler characteristics. |
119 | + AC_C_CONST |
120 | + AC_TYPE_PID_T |
121 | +@@ -133,6 +189,7 @@ |
122 | + lib/Makefile |
123 | + src/check.h |
124 | + src/Makefile |
125 | +- tests/Makefile]) |
126 | ++ tests/Makefile |
127 | ++ tests/test_vars]) |
128 | + |
129 | + AC_OUTPUT |
130 | + |
131 | +=== modified file 'doc/check.texi' |
132 | +--- doc/check.texi 2009-03-12 21:05:05 +0000 |
133 | ++++ doc/check.texi 2009-03-28 06:48:39 +0000 |
134 | +@@ -39,6 +39,7 @@ |
135 | + @author Chris Pickett |
136 | + @author Fredrik Hugosson |
137 | + @author Robert Lemmen |
138 | ++@author Robert Collins |
139 | + |
140 | + @c The following two commands start the copyright page. |
141 | + @page |
142 | +@@ -98,6 +99,7 @@ |
143 | + * Test Timeouts:: |
144 | + * Determining Test Coverage:: |
145 | + * Test Logging:: |
146 | ++* Subunit Support:: |
147 | + |
148 | + Test Fixtures |
149 | + |
150 | +@@ -689,6 +691,11 @@ |
151 | + which can have the values "silent", "minimal", "normal", "verbose". If |
152 | + the variable is not found or the value is not recognized, the print |
153 | + mode is set to @code{CK_NORMAL}. |
154 | ++ |
155 | ++@vindex CK_SUBUNIT |
156 | ++@item CK_SUBUNIT |
157 | ++Prints running progress through the @uref{https://launchpad.net/subunit/, |
158 | ++subunit} test runner protocol. See 'subunit support' under the Advanced Features section for more information. |
159 | + @end table |
160 | + |
161 | + With the @code{CK_NORMAL} flag specified in our @code{main()}, let's |
162 | +@@ -783,6 +790,7 @@ |
163 | + * Test Timeouts:: |
164 | + * Determining Test Coverage:: |
165 | + * Test Logging:: |
166 | ++* Subunit Support:: |
167 | + @end menu |
168 | + |
169 | + @node Running Multiple Cases, No Fork Mode, Advanced Features, Advanced Features |
170 | +@@ -1179,7 +1187,7 @@ |
171 | + you. For more information or help with other compilers, please refer |
172 | + to the relevant manuals. |
173 | + |
174 | +-@node Test Logging, , Determining Test Coverage, Advanced Features |
175 | ++@node Test Logging, Subunit Support, Determining Test Coverage, Advanced Features |
176 | + @section Test Logging |
177 | + |
178 | + @findex srunner_set_log() |
179 | +@@ -1282,6 +1290,50 @@ |
180 | + @end verbatim |
181 | + @end example |
182 | + |
183 | ++@node Subunit Support, , Test Logging, Advanced Features |
184 | ++@section Subunit Support |
185 | ++ |
186 | ++Check supports running test suites with subunit output. This can be useful to |
187 | ++combine test results from multiple languages, or to perform programmatic |
188 | ++analysis on the results of multiple check test suites or otherise handle test |
189 | ++results in a programmatic manner. Using subunit with check is very straight |
190 | ++forward. There are two steps: |
191 | ++1) In your check test suite driver pass 'CK_SUBUNIT' as the output mode |
192 | ++for your srunner. |
193 | ++@example |
194 | ++@verbatim |
195 | ++SRunner *sr; |
196 | ++sr = srunner_create (make_s1_suite ()); |
197 | ++srunner_add_suite (sr, make_s2_suite ()); |
198 | ++srunner_run_all (sr, CK_SUBUNIT); |
199 | ++@end verbatim |
200 | ++@end example |
201 | ++2) Setup your main language test runner to run your check based test |
202 | ++executable. For instance using python: |
203 | ++@example |
204 | ++@verbatim |
205 | ++ |
206 | ++import subunit |
207 | ++ |
208 | ++class ShellTests(subunit.ExecTestCase): |
209 | ++ """Run some tests from the C codebase.""" |
210 | ++ |
211 | ++ def test_group_one(self): |
212 | ++ """./foo/check_driver""" |
213 | ++ |
214 | ++ def test_group_two(self): |
215 | ++ """./foo/other_driver""" |
216 | ++@end verbatim |
217 | ++@end example |
218 | ++ |
219 | ++In this example, running the test suite ShellTests in python (using any test |
220 | ++runner - unittest.py, tribunal, trial, nose or others) will run |
221 | ++./foo/check_driver and ./foo/other_driver and report on their result. |
222 | ++ |
223 | ++Subunit is hosted on launchpad - the @uref{https://launchpad.net/subunit/, |
224 | ++subunit} project there contains bug tracker, future plans, and source code |
225 | ++control details. |
226 | ++ |
227 | + @node Conclusion and References, AM_PATH_CHECK, Advanced Features, Top |
228 | + @chapter Conclusion and References |
229 | + The tutorial and description of advanced features has provided an |
230 | + |
231 | +=== modified file 'src/check.h.in' |
232 | +--- src/check.h.in 2009-02-03 12:36:16 +0000 |
233 | ++++ src/check.h.in 2009-03-28 06:48:39 +0000 |
234 | +@@ -280,6 +280,9 @@ |
235 | + CK_NORMAL, /* All failed tests */ |
236 | + CK_VERBOSE, /* All tests */ |
237 | + CK_ENV, /* Look at environment var */ |
238 | ++#if @ENABLE_SUBUNIT@ |
239 | ++ CK_SUBUNIT, /* Run as a subunit child process */ |
240 | ++#endif |
241 | + CK_LAST |
242 | + }; |
243 | + |
244 | + |
245 | +=== modified file 'src/check_impl.h' |
246 | +--- src/check_impl.h 2009-02-03 12:36:16 +0000 |
247 | ++++ src/check_impl.h 2009-03-28 06:48:39 +0000 |
248 | +@@ -84,6 +84,7 @@ |
249 | + CLSTART_S, |
250 | + CLEND_SR, |
251 | + CLEND_S, |
252 | ++ CLSTART_T, /* A test case is about to run */ |
253 | + CLEND_T |
254 | + }; |
255 | + |
256 | + |
257 | +=== modified file 'src/check_log.c' |
258 | +--- src/check_log.c 2008-12-31 21:41:27 +0000 |
259 | ++++ src/check_log.c 2009-03-28 06:48:39 +0000 |
260 | +@@ -23,12 +23,16 @@ |
261 | + #include <stdlib.h> |
262 | + #include <stdio.h> |
263 | + #include <check.h> |
264 | ++#if HAVE_SUBUNIT_CHILD_H |
265 | ++#include <subunit/child.h> |
266 | ++#endif |
267 | + |
268 | + #include "check_error.h" |
269 | + #include "check_list.h" |
270 | + #include "check_impl.h" |
271 | + #include "check_log.h" |
272 | + #include "check_print.h" |
273 | ++#include "check_str.h" |
274 | + |
275 | + |
276 | + static void srunner_send_evt (SRunner *sr, void *obj, enum cl_event evt); |
277 | +@@ -105,6 +109,13 @@ |
278 | + srunner_send_evt (sr, s, CLEND_S); |
279 | + } |
280 | + |
281 | ++void log_test_start (SRunner *sr, TCase * tc, TF * tfun) |
282 | ++{ |
283 | ++ char buffer[100]; |
284 | ++ snprintf(buffer, 99, "%s:%s", tc->name, tfun->name); |
285 | ++ srunner_send_evt (sr, buffer, CLSTART_T); |
286 | ++} |
287 | ++ |
288 | + void log_test_end (SRunner *sr, TestResult *tr) |
289 | + { |
290 | + srunner_send_evt (sr, tr, CLEND_T); |
291 | +@@ -126,7 +137,6 @@ |
292 | + void stdout_lfun (SRunner *sr, FILE *file, enum print_output printmode, |
293 | + void *obj, enum cl_event evt) |
294 | + { |
295 | +- TestResult *tr; |
296 | + Suite *s; |
297 | + |
298 | + if (printmode == CK_ENV) { |
299 | +@@ -161,8 +171,9 @@ |
300 | + case CLEND_S: |
301 | + s = obj; |
302 | + break; |
303 | ++ case CLSTART_T: |
304 | ++ break; |
305 | + case CLEND_T: |
306 | +- tr = obj; |
307 | + break; |
308 | + default: |
309 | + eprintf("Bad event type received in stdout_lfun", __FILE__, __LINE__); |
310 | +@@ -195,12 +206,14 @@ |
311 | + case CLEND_S: |
312 | + s = obj; |
313 | + break; |
314 | ++ case CLSTART_T: |
315 | ++ break; |
316 | + case CLEND_T: |
317 | + tr = obj; |
318 | + tr_fprint(file, tr, CK_VERBOSE); |
319 | + break; |
320 | + default: |
321 | +- eprintf("Bad event type received in stdout_lfun", __FILE__, __LINE__); |
322 | ++ eprintf("Bad event type received in lfile_lfun", __FILE__, __LINE__); |
323 | + } |
324 | + |
325 | + |
326 | +@@ -248,6 +261,8 @@ |
327 | + fprintf(file, " </suite>\n"); |
328 | + s = obj; |
329 | + break; |
330 | ++ case CLSTART_T: |
331 | ++ break; |
332 | + case CLEND_T: |
333 | + tr = obj; |
334 | + tr_xmlprint(file, tr, CK_VERBOSE); |
335 | +@@ -258,6 +273,66 @@ |
336 | + |
337 | + } |
338 | + |
339 | ++#if ENABLE_SUBUNIT |
340 | ++void subunit_lfun (SRunner *sr, FILE *file, enum print_output printmode, |
341 | ++ void *obj, enum cl_event evt) |
342 | ++{ |
343 | ++ TestResult *tr; |
344 | ++ Suite *s; |
345 | ++ char const * name; |
346 | ++ |
347 | ++ /* assert(printmode == CK_SUBUNIT); */ |
348 | ++ |
349 | ++ switch (evt) { |
350 | ++ case CLINITLOG_SR: |
351 | ++ break; |
352 | ++ case CLENDLOG_SR: |
353 | ++ break; |
354 | ++ case CLSTART_SR: |
355 | ++ break; |
356 | ++ case CLSTART_S: |
357 | ++ s = obj; |
358 | ++ break; |
359 | ++ case CLEND_SR: |
360 | ++ if (printmode > CK_SILENT) { |
361 | ++ fprintf (file, "\n"); |
362 | ++ srunner_fprint (file, sr, printmode); |
363 | ++ } |
364 | ++ break; |
365 | ++ case CLEND_S: |
366 | ++ s = obj; |
367 | ++ break; |
368 | ++ case CLSTART_T: |
369 | ++ name = obj; |
370 | ++ subunit_test_start(name); |
371 | ++ break; |
372 | ++ case CLEND_T: |
373 | ++ tr = obj; |
374 | ++ { |
375 | ++ char *name = ck_strdup_printf ("%s:%s", tr->tcname, tr->tname); |
376 | ++ char *msg = tr_short_str (tr); |
377 | ++ switch (tr->rtype) { |
378 | ++ case CK_PASS: |
379 | ++ subunit_test_pass(name); |
380 | ++ break; |
381 | ++ case CK_FAILURE: |
382 | ++ subunit_test_fail(name, msg); |
383 | ++ break; |
384 | ++ case CK_ERROR: |
385 | ++ subunit_test_error(name, msg); |
386 | ++ break; |
387 | ++ default: |
388 | ++ eprintf("Bad result type in subunit_lfun", __FILE__, __LINE__); |
389 | ++ free(name); |
390 | ++ free(msg); |
391 | ++ } |
392 | ++ } |
393 | ++ break; |
394 | ++ default: |
395 | ++ eprintf("Bad event type received in subunit_lfun", __FILE__, __LINE__); |
396 | ++ } |
397 | ++} |
398 | ++#endif |
399 | + |
400 | + FILE *srunner_open_lfile (SRunner *sr) |
401 | + { |
402 | +@@ -287,7 +362,14 @@ |
403 | + { |
404 | + FILE *f; |
405 | + sr->loglst = check_list_create(); |
406 | +- srunner_register_lfun (sr, stdout, 0, stdout_lfun, print_mode); |
407 | ++#if ENABLE_SUBUNIT |
408 | ++ if (print_mode != CK_SUBUNIT) |
409 | ++#endif |
410 | ++ srunner_register_lfun (sr, stdout, 0, stdout_lfun, print_mode); |
411 | ++#if ENABLE_SUBUNIT |
412 | ++ else |
413 | ++ srunner_register_lfun (sr, stdout, 0, subunit_lfun, print_mode); |
414 | ++#endif |
415 | + f = srunner_open_lfile (sr); |
416 | + if (f) { |
417 | + srunner_register_lfun (sr, f, 1, lfile_lfun, print_mode); |
418 | + |
419 | +=== modified file 'src/check_log.h' |
420 | +--- src/check_log.h 2006-10-13 00:24:56 +0000 |
421 | ++++ src/check_log.h 2009-03-28 08:21:45 +0000 |
422 | +@@ -26,6 +26,7 @@ |
423 | + void log_suite_start (SRunner *sr, Suite *s); |
424 | + void log_suite_end (SRunner *sr, Suite *s); |
425 | + void log_test_end (SRunner *sr, TestResult *tr); |
426 | ++void log_test_start (SRunner *sr, TCase *tc, TF *tfun); |
427 | + |
428 | + void stdout_lfun (SRunner *sr, FILE *file, enum print_output, |
429 | + void *obj, enum cl_event evt); |
430 | +@@ -36,6 +37,9 @@ |
431 | + void xml_lfun (SRunner *sr, FILE *file, enum print_output, |
432 | + void *obj, enum cl_event evt); |
433 | + |
434 | ++void subunit_lfun (SRunner *sr, FILE *file, enum print_output, |
435 | ++ void *obj, enum cl_event evt); |
436 | ++ |
437 | + void srunner_register_lfun (SRunner *sr, FILE *lfile, int close, |
438 | + LFun lfun, enum print_output); |
439 | + |
440 | + |
441 | +=== modified file 'src/check_print.c' |
442 | +--- src/check_print.c 2008-12-31 02:05:58 +0000 |
443 | ++++ src/check_print.c 2009-03-28 06:48:39 +0000 |
444 | +@@ -54,6 +54,11 @@ |
445 | + static void srunner_fprint_summary (FILE *file, SRunner *sr, |
446 | + enum print_output print_mode) |
447 | + { |
448 | ++#if ENABLE_SUBUNIT |
449 | ++ if (print_mode == CK_SUBUNIT) |
450 | ++ return; |
451 | ++#endif |
452 | ++ |
453 | + if (print_mode >= CK_MINIMAL) { |
454 | + char *str; |
455 | + |
456 | +@@ -68,6 +73,11 @@ |
457 | + enum print_output print_mode) |
458 | + { |
459 | + List *resultlst; |
460 | ++ |
461 | ++#if ENABLE_SUBUNIT |
462 | ++ if (print_mode == CK_SUBUNIT) |
463 | ++ return; |
464 | ++#endif |
465 | + |
466 | + resultlst = sr->resultlst; |
467 | + |
468 | + |
469 | +=== modified file 'src/check_run.c' |
470 | +--- src/check_run.c 2009-02-03 12:36:16 +0000 |
471 | ++++ src/check_run.c 2009-03-28 06:48:39 +0000 |
472 | +@@ -159,6 +159,7 @@ |
473 | + |
474 | + for (i = tfun->loop_start; i < tfun->loop_end; i++) |
475 | + { |
476 | ++ log_test_start (sr, tc, tfun); |
477 | + switch (srunner_fork_status(sr)) { |
478 | + case CK_FORK: |
479 | + #ifdef _POSIX_VERSION |
480 | + |
481 | +=== modified file 'src/check_str.c' |
482 | +--- src/check_str.c 2008-12-31 02:05:58 +0000 |
483 | ++++ src/check_str.c 2009-03-28 06:48:39 +0000 |
484 | +@@ -47,6 +47,20 @@ |
485 | + return rstr; |
486 | + } |
487 | + |
488 | ++char *tr_short_str (TestResult *tr) |
489 | ++{ |
490 | ++ const char *exact_msg; |
491 | ++ char *rstr; |
492 | ++ |
493 | ++ exact_msg = (tr->rtype == CK_ERROR) ? "(after this point) ": ""; |
494 | ++ |
495 | ++ rstr = ck_strdup_printf ("%s:%d: %s%s", |
496 | ++ tr->file, tr->line, |
497 | ++ exact_msg, tr->msg); |
498 | ++ |
499 | ++ return rstr; |
500 | ++} |
501 | ++ |
502 | + char *sr_stat_str (SRunner *sr) |
503 | + { |
504 | + char *str; |
505 | + |
506 | +=== modified file 'src/check_str.h' |
507 | +--- src/check_str.h 2006-10-13 00:24:56 +0000 |
508 | ++++ src/check_str.h 2009-03-28 06:48:39 +0000 |
509 | +@@ -25,6 +25,12 @@ |
510 | + value has been malloc'd, and must be freed by the caller */ |
511 | + char *tr_str (TestResult *tr); |
512 | + |
513 | ++/* Return a string representation of the given TestResult message |
514 | ++ without the test id or result type. This is suitable for separate |
515 | ++ formatting of the test and the message. Return value has been |
516 | ++ malloc'd, and must be freed by the caller */ |
517 | ++char *tr_short_str (TestResult *tr); |
518 | ++ |
519 | + /* Return a string representation of the given SRunner's run |
520 | + statistics (% passed, num run, passed, errors, failures). Return |
521 | + value has been malloc'd, and must be freed by the caller |
522 | + |
523 | +=== modified file 'tests/Makefile.am' |
524 | +--- tests/Makefile.am 2009-02-03 12:36:16 +0000 |
525 | ++++ tests/Makefile.am 2009-03-28 08:26:21 +0000 |
526 | +@@ -20,7 +20,7 @@ |
527 | + ex_xml_output \ |
528 | + ex_log_output |
529 | + |
530 | +-EXTRA_DIST = test_output.sh test_log_output.sh test_xml_output.sh |
531 | ++EXTRA_DIST = test_output.sh test_log_output.sh test_vars.in test_xml_output.sh |
532 | + |
533 | + if NO_TIMEOUT_TESTS |
534 | + check_check_CFLAGS = -DTIMEOUT_TESTS_ENABLED=0 |
535 | +@@ -37,17 +37,18 @@ |
536 | + check_check_export_LDADD = $(top_builddir)/src/libcheck.la $(top_builddir)/lib/libcompat.la |
537 | + |
538 | + check_check_SOURCES = \ |
539 | +- check_check.h \ |
540 | +- check_list.c \ |
541 | +- check_check_sub.c \ |
542 | +- check_check_master.c \ |
543 | +- check_check_msg.c \ |
544 | +- check_check_log.c \ |
545 | +- check_check_limit.c \ |
546 | +- check_check_fork.c \ |
547 | +- check_check_fixture.c \ |
548 | +- check_check_pack.c \ |
549 | +- check_check_exit.c \ |
550 | ++ check_check.h \ |
551 | ++ check_list.c \ |
552 | ++ check_check_sub.c \ |
553 | ++ check_check_master.c \ |
554 | ++ check_check_msg.c \ |
555 | ++ check_check_log.c \ |
556 | ++ check_check_log_internal.c \ |
557 | ++ check_check_limit.c \ |
558 | ++ check_check_fork.c \ |
559 | ++ check_check_fixture.c \ |
560 | ++ check_check_pack.c \ |
561 | ++ check_check_exit.c \ |
562 | + check_check_main.c |
563 | + check_check_LDADD = $(top_builddir)/src/libcheckinternal.la $(top_builddir)/lib/libcompat.la |
564 | + |
565 | + |
566 | +=== modified file 'tests/check_check.h' |
567 | +--- tests/check_check.h 2009-02-03 12:36:16 +0000 |
568 | ++++ tests/check_check.h 2009-03-28 08:34:03 +0000 |
569 | +@@ -20,6 +20,7 @@ |
570 | + Suite *make_list_suite(void); |
571 | + Suite *make_msg_suite(void); |
572 | + Suite *make_log_suite(void); |
573 | ++Suite *make_log_internal_suite(void); |
574 | + Suite *make_limit_suite(void); |
575 | + Suite *make_fork_suite(void); |
576 | + Suite *make_fixture_suite(void); |
577 | + |
578 | +=== added file 'tests/check_check_log_internal.c' |
579 | +--- tests/check_check_log_internal.c 1970-01-01 00:00:00 +0000 |
580 | ++++ tests/check_check_log_internal.c 2009-03-28 08:33:45 +0000 |
581 | +@@ -0,0 +1,55 @@ |
582 | ++#include "../lib/libcompat.h" |
583 | ++ |
584 | ++/* Tests for log related stuff in check which need non-exported functions. */ |
585 | ++ |
586 | ++#include <stdio.h> |
587 | ++#include <stdlib.h> |
588 | ++#include <string.h> |
589 | ++#include <check.h> |
590 | ++#include <check_list.h> |
591 | ++#include <check_impl.h> |
592 | ++#include <check_log.h> |
593 | ++#include "check_check.h" |
594 | ++ |
595 | ++ |
596 | ++#if ENABLE_SUBUNIT |
597 | ++START_TEST(test_init_logging_subunit) |
598 | ++{ |
599 | ++ /* init_logging with CK_SUBUNIT sets stdout |
600 | ++ * to a subunit function, not any log. |
601 | ++ */ |
602 | ++ Log * first_log = NULL; |
603 | ++ Suite *s = suite_create("Suite"); |
604 | ++ SRunner *sr = srunner_create(s); |
605 | ++ srunner_init_logging(sr, CK_SUBUNIT); |
606 | ++ list_front (sr->loglst); |
607 | ++ fail_if (list_at_end(sr->loglst), "No entries in log list"); |
608 | ++ first_log = list_val(sr->loglst); |
609 | ++ fail_if (first_log == NULL, "log is NULL"); |
610 | ++ list_advance(sr->loglst); |
611 | ++ fail_unless(list_at_end(sr->loglst), "More than one entry in log list"); |
612 | ++ fail_unless(first_log->lfun == subunit_lfun, |
613 | ++ "Log function is not the subunit lfun."); |
614 | ++ srunner_end_logging(sr); |
615 | ++ srunner_free(sr); |
616 | ++} |
617 | ++END_TEST |
618 | ++#endif |
619 | ++ |
620 | ++Suite *make_log_internal_suite(void) |
621 | ++{ |
622 | ++ |
623 | ++ Suite *s; |
624 | ++ TCase *tc_core_subunit; |
625 | ++ |
626 | ++ s = suite_create("Log"); |
627 | ++ tc_core_subunit = tcase_create("Core SubUnit"); |
628 | ++ |
629 | ++#if ENABLE_SUBUNIT |
630 | ++ suite_add_tcase(s, tc_core_subunit); |
631 | ++ tcase_add_test(tc_core_subunit, test_init_logging_subunit); |
632 | ++#endif |
633 | ++ |
634 | ++ return s; |
635 | ++} |
636 | ++ |
637 | + |
638 | +=== modified file 'tests/check_check_main.c' |
639 | +--- tests/check_check_main.c 2009-02-03 12:36:16 +0000 |
640 | ++++ tests/check_check_main.c 2009-03-28 08:34:51 +0000 |
641 | +@@ -20,6 +20,7 @@ |
642 | + srunner_add_suite(sr, make_list_suite()); |
643 | + srunner_add_suite(sr, make_msg_suite()); |
644 | + srunner_add_suite(sr, make_log_suite()); |
645 | ++ srunner_add_suite(sr, make_log_internal_suite()); |
646 | + srunner_add_suite(sr, make_limit_suite()); |
647 | + srunner_add_suite(sr, make_fork_suite()); |
648 | + srunner_add_suite(sr, make_fixture_suite()); |
649 | + |
650 | +=== modified file 'tests/ex_output.c' |
651 | +--- tests/ex_output.c 2008-12-30 01:40:50 +0000 |
652 | ++++ tests/ex_output.c 2009-03-28 06:57:20 +0000 |
653 | +@@ -4,6 +4,7 @@ |
654 | + #include <stdio.h> |
655 | + #include <string.h> |
656 | + #include <check.h> |
657 | ++#include "config.h" |
658 | + |
659 | + START_TEST(test_pass) |
660 | + { |
661 | +@@ -49,11 +50,20 @@ |
662 | + srunner_free(sr); |
663 | + } |
664 | + |
665 | ++static void print_usage(void) |
666 | ++{ |
667 | ++ printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE"); |
668 | ++#if ENABLE_SUBUNIT |
669 | ++ printf (" | CK_SUBUNIT"); |
670 | ++#endif |
671 | ++ printf (")\n"); |
672 | ++} |
673 | ++ |
674 | + int main (int argc, char **argv) |
675 | + { |
676 | + |
677 | + if (argc != 2) { |
678 | +- printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n"); |
679 | ++ print_usage(); |
680 | + return EXIT_FAILURE; |
681 | + } |
682 | + |
683 | +@@ -65,8 +75,12 @@ |
684 | + run_tests(CK_NORMAL); |
685 | + else if (strcmp (argv[1], "CK_VERBOSE") == 0) |
686 | + run_tests(CK_VERBOSE); |
687 | ++#if ENABLE_SUBUNIT |
688 | ++ else if (strcmp (argv[1], "CK_SUBUNIT") == 0) |
689 | ++ run_tests(CK_SUBUNIT); |
690 | ++#endif |
691 | + else { |
692 | +- printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n"); |
693 | ++ print_usage(); |
694 | + return EXIT_FAILURE; |
695 | + } |
696 | + |
697 | + |
698 | +=== modified file 'tests/test_output.sh' |
699 | +--- tests/test_output.sh 2008-12-30 05:47:35 +0000 |
700 | ++++ tests/test_output.sh 2009-03-28 07:59:52 +0000 |
701 | +@@ -1,5 +1,7 @@ |
702 | + #!/bin/sh |
703 | + |
704 | ++. "${srcdir}/"test_vars |
705 | ++ |
706 | + if [ "${srcdir}" = "." ]; then |
707 | + lsrc="" |
708 | + else |
709 | +@@ -11,18 +13,31 @@ |
710 | + 33%: Checks: 3, Failures: 1, Errors: 1" |
711 | + t2="xRunning suite(s): Master |
712 | + 33%: Checks: 3, Failures: 1, Errors: 1 |
713 | +-${lsrc}ex_output.c:16:F:Core:test_fail:0: Failure |
714 | +-${lsrc}ex_output.c:20:E:Core:test_exit:0: (after this point) Early exit with return value 1" |
715 | ++${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure |
716 | ++${lsrc}ex_output.c:21:E:Core:test_exit:0: (after this point) Early exit with return value 1" |
717 | + t3="xRunning suite(s): Master |
718 | + 33%: Checks: 3, Failures: 1, Errors: 1 |
719 | +-${lsrc}ex_output.c:10:P:Core:test_pass:0: Passed |
720 | +-${lsrc}ex_output.c:16:F:Core:test_fail:0: Failure |
721 | +-${lsrc}ex_output.c:20:E:Core:test_exit:0: (after this point) Early exit with return value 1" |
722 | ++${lsrc}ex_output.c:11:P:Core:test_pass:0: Passed |
723 | ++${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure |
724 | ++${lsrc}ex_output.c:21:E:Core:test_exit:0: (after this point) Early exit with return value 1" |
725 | ++t4="xtest: Core:test_pass |
726 | ++success: Core:test_pass |
727 | ++test: Core:test_fail |
728 | ++failure: Core:test_fail [ |
729 | ++${lsrc}ex_output.c:17: Failure |
730 | ++] |
731 | ++test: Core:test_exit |
732 | ++error: Core:test_exit [ |
733 | ++${lsrc}ex_output.c:21: (after this point) Early exit with return value 1 |
734 | ++]" |
735 | + |
736 | + op0=`./ex_output CK_SILENT` |
737 | + op1=`./ex_output CK_MINIMAL` |
738 | + op2=`./ex_output CK_NORMAL` |
739 | + op3=`./ex_output CK_VERBOSE` |
740 | ++if test 1 -eq $ENABLE_SUBUNIT; then |
741 | ++op4=`./ex_output CK_SUBUNIT` |
742 | ++fi |
743 | + |
744 | + |
745 | + test_output ( ) { |
746 | +@@ -41,4 +56,7 @@ |
747 | + test_output "$t1" x"$op1" "CK_MINIMAL"; |
748 | + test_output "$t2" x"$op2" "CK_NORMAL"; |
749 | + test_output "$t3" x"$op3" "CK_VERBOSE"; |
750 | ++if test 1 -eq $ENABLE_SUBUNIT; then |
751 | ++test_output "$t4" x"$op4" "CK_SUBUNIT"; |
752 | ++fi |
753 | + exit 0 |
754 | + |
755 | +=== added file 'tests/test_vars.in' |
756 | +--- tests/test_vars.in 1970-01-01 00:00:00 +0000 |
757 | ++++ tests/test_vars.in 2009-03-28 06:48:39 +0000 |
758 | +@@ -0,0 +1,2 @@ |
759 | ++# defined to 1 if subunit is enabled |
760 | ++export ENABLE_SUBUNIT=@ENABLE_SUBUNIT@ |
761 | + |
762 | |
763 | === modified file 'filters/SConscript' |
764 | --- filters/SConscript 2008-12-07 23:29:06 +0000 |
765 | +++ filters/SConscript 2009-03-27 05:46:43 +0000 |
766 | @@ -1,19 +1,14 @@ |
767 | Import('*') |
768 | # describe what we need for filters |
769 | - |
770 | -EnsurePythonVersion(2, 4) |
771 | - |
772 | -import distutils.sysconfig |
773 | -import os.path |
774 | - |
775 | -# distutils default prefix is the common path between |
776 | -# distutils.sysconfig.get_python_lib and distutils.sysconfig.get_python_inc |
777 | -prefix = os.path.commonprefix([ |
778 | - distutils.sysconfig.get_python_lib(), |
779 | - distutils.sysconfig.get_python_inc(), |
780 | - ]) |
781 | -# suffix to install .py files to is distutils.sysconfig.get_python_lib() |
782 | -# after the common prefix |
783 | -python_suffix = distutils.sysconfig.get_python_lib()[len(prefix):] |
784 | -# install path for python is then in DESTDIR + python_suffix |
785 | -python_installdir = DESTDIR + python_suffix + '/subunit' |
786 | +filters = [ |
787 | + 'subunit-filter', |
788 | + 'subunit-ls', |
789 | + 'subunit-stats', |
790 | + 'subunit-tags', |
791 | + 'subunit2pyunit', |
792 | + 'tap2subunit', |
793 | + ] |
794 | +installs = [] |
795 | +for filter in filters: |
796 | + installs.append(env.Install(bin, filter)) |
797 | +env.Alias('install', installs) |
More polish, install filters, update check patch.