Last change
on this file since 87 was 29, checked in by rainer, 19 years ago |
Fixes for test suite, OpenBSD portability, self-resolving, and suidchk patch by Neil
|
-
Property svn:executable
set to
*
|
File size:
1.2 KB
|
Rev | Line | |
---|
[17] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | # Auto generate single AllTests file for CuTest.
|
---|
| 4 | # Searches through all *.c files in the current directory.
|
---|
| 5 | # Prints to stdout.
|
---|
| 6 | # Author: Asim Jalis
|
---|
| 7 | # Date: 01/08/2003
|
---|
| 8 |
|
---|
[19] | 9 | # Modified to return non-zero if any test has failed
|
---|
| 10 | # Rainer Wichmann, 29. Jan 2006
|
---|
| 11 | # ...and to print to stderr if any test has failed
|
---|
| 12 | # Rainer Wichmann, 31. Jan 2006
|
---|
| 13 |
|
---|
[17] | 14 | if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi
|
---|
| 15 |
|
---|
| 16 | echo '
|
---|
| 17 |
|
---|
| 18 | /* This is auto-generated code. Edit at your own peril. */
|
---|
| 19 |
|
---|
| 20 | #include <stdio.h>
|
---|
| 21 | #include "CuTest.h"
|
---|
| 22 |
|
---|
| 23 | '
|
---|
| 24 |
|
---|
| 25 | cat $FILES | grep '^void Test' |
|
---|
| 26 | sed -e 's/(.*$//' \
|
---|
| 27 | -e 's/$/(CuTest*);/' \
|
---|
| 28 | -e 's/^/extern /'
|
---|
| 29 |
|
---|
| 30 | echo \
|
---|
| 31 | '
|
---|
| 32 |
|
---|
[19] | 33 | int RunAllTests(void)
|
---|
[17] | 34 | {
|
---|
| 35 | CuString *output = CuStringNew();
|
---|
| 36 | CuSuite* suite = CuSuiteNew();
|
---|
| 37 |
|
---|
| 38 | '
|
---|
| 39 | cat $FILES | grep '^void Test' |
|
---|
| 40 | sed -e 's/^void //' \
|
---|
| 41 | -e 's/(.*$//' \
|
---|
| 42 | -e 's/^/ SUITE_ADD_TEST(suite, /' \
|
---|
| 43 | -e 's/$/);/'
|
---|
| 44 |
|
---|
| 45 | echo \
|
---|
| 46 | '
|
---|
| 47 | CuSuiteRun(suite);
|
---|
| 48 | CuSuiteSummary(suite, output);
|
---|
| 49 | CuSuiteDetails(suite, output);
|
---|
[19] | 50 | if (suite->failCount > 0)
|
---|
[29] | 51 | fprintf(stderr, "%s%c", output->buffer, 0x0A);
|
---|
[19] | 52 | else
|
---|
[29] | 53 | fprintf(stdout, "%s%c", output->buffer, 0x0A);
|
---|
[19] | 54 | return suite->failCount;
|
---|
[17] | 55 | }
|
---|
| 56 |
|
---|
| 57 | int main(void)
|
---|
| 58 | {
|
---|
[19] | 59 | int retval;
|
---|
| 60 | retval = RunAllTests();
|
---|
| 61 | return (retval == 0) ? 0 : 1;
|
---|
[17] | 62 | }
|
---|
| 63 | '
|
---|
Note:
See
TracBrowser
for help on using the repository browser.