• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2004, Bull S.A..  All rights reserved.
3  * Created by: Sebastien Decugis
4 
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  *
17 
18 
19  * This file is a wrapper to use the tests from the NPTL Test & Trace Project
20  * with either the Linux Test Project or the Open POSIX Test Suite.
21 
22  * The following macros are defined here:
23  * UNRESOLVED(ret, descr);
24  *    where descr is a description of the error and ret is an int (error code for example)
25  * FAILED(descr);
26  *    where descr is a short text saying why the test has failed.
27  * PASSED();
28  *    No parameter.
29  *
30  * Both three macros shall terminate the calling process.
31  * The testcase shall not terminate without calling one of those macros.
32  *
33  *
34  */
35 
36 #include "posixtest.h"
37 #include <string.h> /* for the strerror() routine */
38 
39 
40 #ifdef __GNUC__ /* We are using GCC */
41 
42   #define UNRESOLVED(x, s) \
43  { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \
44  	output_fini(); \
45  	exit(PTS_UNRESOLVED); }
46 
47  #define FAILED(s) \
48  { output("Test %s FAILED: %s\n", __FILE__, s); \
49  	output_fini(); \
50  	exit(PTS_FAIL); }
51 
52  #define PASSED \
53   output_fini(); \
54   exit(PTS_PASS);
55 
56  #define UNTESTED(s) \
57 {	output("File %s cannot test: %s\n", __FILE__, s); \
58 	  output_fini(); \
59   exit(PTS_UNTESTED); \
60 }
61 
62 #else /* not using GCC */
63 
64   #define UNRESOLVED(x, s) \
65  { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \
66   output_fini(); \
67  	exit(PTS_UNRESOLVED); }
68 
69  #define FAILED(s) \
70  { output("Test FAILED: %s\n", s); \
71   output_fini(); \
72  	exit(PTS_FAIL); }
73 
74  #define PASSED \
75   output_fini(); \
76   exit(PTS_PASS);
77 
78  #define UNTESTED(s) \
79 {	output("Unable to test: %s\n", s); \
80 	  output_fini(); \
81   exit(PTS_UNTESTED); \
82 }
83 
84 #endif
85 
86