-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-tests
executable file
·61 lines (52 loc) · 1.34 KB
/
make-tests
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
#!/usr/bin/env bash
# Auto generate single AllTests file for CuTest.
# Searches through all *.c files in the current directory.
# Prints to stdout.
# Author: Asim Jalis
# Date: 01/08/2003
if test $# -eq 0 ; then FILES=src/**.c ; else FILES=$* ; fi
echo '
/* This is auto-generated code. Edit at your own peril. */
#include <stdio.h>
#include <stdlib.h>
#include "ghostsh.h"
#include "CuTest.h"
'
cat $FILES | grep '^void Test' |
sed -e 's/(.*$//' \
-e 's/$/(CuTest*);/' \
-e 's/^/extern /'
echo \
'
int RunAllTests(gs_options_t* opt)
{
CuString *output = CuStringNew();
CuSuite* suite = CuSuiteNew();
suite->opt = opt;
'
cat $FILES | grep '^void Test' |
sed -e 's/^void //' \
-e 's/(.*$//' \
-e 's/^/ SUITE_ADD_TEST(suite, /' \
-e 's/$/);/'
echo \
'
CuSuiteRun(suite);
CuSuiteSummary(suite, output);
CuSuiteDetails(suite, output);
if (opt->selfcheck_export_path != NULL)
{
CuString *export = CuStringNew();
CuSuiteExportJunitXml(suite, export);
FILE *fp = fopen(opt->selfcheck_export_path, "w+");
fwrite(export->buffer, export->length, 1, fp);
fclose(fp);
CuStringDelete(export);
}
int failures = suite->failCount;
printf("%s\n", output->buffer);
CuStringDelete(output);
CuSuiteDelete(suite);
return failures;
}
'