source: branches/samhain-2_2-branch/src/make-tests.sh@ 476

Last change on this file since 476 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
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%c", output->buffer, 0x0A);
52 else
53 fprintf(stdout, "%s%c", output->buffer, 0x0A);
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.