Home | History | Annotate | Download | only in pthread_cond_init
      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 #ifdef __GNUC__ /* We are using GCC */
     40 
     41   #define UNRESOLVED(x, s) \
     42  { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \
     43  	output_fini(); \
     44  	exit(PTS_UNRESOLVED); }
     45 
     46  #define FAILED(s) \
     47  { output("Test %s FAILED: %s\n", __FILE__, s); \
     48  	output_fini(); \
     49  	exit(PTS_FAIL); }
     50 
     51  #define PASSED \
     52   output_fini(); \
     53   exit(PTS_PASS);
     54 
     55  #define UNTESTED(s) \
     56 {	output("File %s cannot test: %s\n", __FILE__, s); \
     57 	  output_fini(); \
     58   exit(PTS_UNTESTED); \
     59 }
     60 
     61 #else /* not using GCC */
     62 
     63   #define UNRESOLVED(x, s) \
     64  { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \
     65   output_fini(); \
     66  	exit(PTS_UNRESOLVED); }
     67 
     68  #define FAILED(s) \
     69  { output("Test FAILED: %s\n", s); \
     70   output_fini(); \
     71  	exit(PTS_FAIL); }
     72 
     73  #define PASSED \
     74   output_fini(); \
     75   exit(PTS_PASS);
     76 
     77  #define UNTESTED(s) \
     78 {	output("Unable to test: %s\n", s); \
     79 	  output_fini(); \
     80   exit(PTS_UNTESTED); \
     81 }
     82 
     83 #endif
     84 
     85