2 * Copyright (c) 2008 Yahoo!, Inc.
4 * Written by: John Baldwin <jhb@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the author nor the names of any co-contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <sys/cdefs.h>
32 __FBSDID("$FreeBSD$");
39 static int test_index
;
40 static struct regression_test
*test
;
41 static int test_acknowleged
;
43 SET_DECLARE(regression_tests_set
, struct regression_test
);
46 * Outputs a test summary of the following:
48 * <status> <test #> [name] [# <fmt> [fmt args]]
51 vprint_status(const char *status
, const char *fmt
, va_list ap
)
54 printf("%s %d", status
, test_index
);
56 printf(" - %s", test
->rt_name
);
66 print_status(const char *status
, const char *fmt
, ...)
71 vprint_status(status
, fmt
, ap
);
79 print_status("ok", NULL
);
86 print_status("not ok", NULL
);
90 fail_err(const char *fmt
, ...)
95 vprint_status("not ok", fmt
, ap
);
100 skip(const char *reason
)
103 print_status("ok", "skip %s", reason
);
107 todo(const char *reason
)
110 print_status("not ok", "TODO %s", reason
);
116 struct regression_test
**testp
;
118 printf("1..%td\n", SET_COUNT(regression_tests_set
));
120 SET_FOREACH(testp
, regression_tests_set
) {
121 test_acknowleged
= 0;
124 if (!test_acknowleged
)
125 print_status("not ok", "unknown status");