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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Copyright (c) 2004, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This file is a wrapper to use the tests from the NPTL Test & Trace Project
* with either the Linux Test Project or the Open POSIX Test Suite.
*
* The following macros are defined here:
* UNRESOLVED(ret, descr);
* where descr is a description of the error and ret is
* an int (error code for example)
* FAILED(descr);
* where descr is a short text saying why the test has failed.
* PASSED();
* No parameter.
*
* Both three macros shall terminate the calling process.
* The testcase shall not terminate without calling one of those macros.
*/
#include "posixtest.h"
#include <string.h>
#ifdef __GNUC__
#define UNRESOLVED(x, s) \
{ \
output("Test %s unresolved: got %i (%s) on line %i (%s)\n", \
__FILE__, x, strerror(x), __LINE__, s); \
output_fini(); \
exit(PTS_UNRESOLVED); \
}
#define FAILED(s) \
{ \
output("Test %s FAILED: %s\n", __FILE__, s); \
output_fini(); \
exit(PTS_FAIL); \
}
#define PASSED \
{ \
output_fini(); \
exit(PTS_PASS); \
}
#define UNTESTED(s) \
{ \
output("File %s cannot test: %s\n", __FILE__, s); \
output_fini(); \
exit(PTS_UNTESTED); \
}
#else
#define UNRESOLVED(x, s) \
{ \
output("Test unresolved: got %i (%s) on line %i (%s)\n", \
x, strerror(x), __LINE__, s); \
output_fini(); \
exit(PTS_UNRESOLVED); \
}
#define FAILED(s) \
{ \
output("Test FAILED: %s\n", s); \
output_fini(); \
exit(PTS_FAIL); \
}
#define PASSED \
{ \
output_fini(); \
exit(PTS_PASS); \
}
#define UNTESTED(s) \
{ \
output("Unable to test: %s\n", s); \
output_fini(); \
exit(PTS_UNTESTED); \
}
#endif
|