source: trunk/src/make-tests.sh@ 26

Last change on this file since 26 was 19, checked in by rainer, 19 years ago

Rewrite of test suite, checksum for growing logs, fix for minor bug with dead client detection.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
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
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
14if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi
15
16echo '
17
18/* This is auto-generated code. Edit at your own peril. */
19
20#include <stdio.h>
21#include "CuTest.h"
22
23'
24
25cat $FILES | grep '^void Test' |
26 sed -e 's/(.*$//' \
27 -e 's/$/(CuTest*);/' \
28 -e 's/^/extern /'
29
30echo \
31'
32
33int RunAllTests(void)
34{
35 CuString *output = CuStringNew();
36 CuSuite* suite = CuSuiteNew();
37
38'
39cat $FILES | grep '^void Test' |
40 sed -e 's/^void //' \
41 -e 's/(.*$//' \
42 -e 's/^/ SUITE_ADD_TEST(suite, /' \
43 -e 's/$/);/'
44
45echo \
46'
47 CuSuiteRun(suite);
48 CuSuiteSummary(suite, output);
49 CuSuiteDetails(suite, output);
50 if (suite->failCount > 0)
51 fprintf(stderr, "%s\n", output->buffer);
52 else
53 fprintf(stdout, "%s\n", output->buffer);
54 return suite->failCount;
55}
56
57int main(void)
58{
59 int retval;
60 retval = RunAllTests();
61 return (retval == 0) ? 0 : 1;
62}
63'
Note: See TracBrowser for help on using the repository browser.