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