Have attributes for mutex, rwlock and cond like in pthread.
[npth.git] / tests / t-support.h
1 /* t-support.h - Helper routines for regression tests.
2    Copyright (C) 2011 g10 Code GmbH
3
4    This file is part of NPTH.
5  
6    NPTH is free software; you can redistribute it and/or modify it
7    under the terms of the GNU Lesser General Public License as
8    published by the Free Software Foundation; either version 2.1 of
9    the License, or (at your option) any later version.
10    
11    NPTH is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15    
16    You should have received a copy of the GNU Lesser General Public
17    License along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19    02111-1307, USA.  */
20
21 #include <unistd.h>
22 #include <errno.h>
23 #include <stdlib.h>
24 #include <locale.h>
25
26 #include <npth.h>
27
28 #ifndef DIM
29 #define DIM(v)               (sizeof(v)/sizeof((v)[0]))
30 #endif
31
32 #define fail_if_err(err)                                        \
33   do                                                            \
34     {                                                           \
35       if (err)                                                  \
36         {                                                       \
37           fprintf (stderr, "%s:%d: %s\n",                       \
38                    __FILE__, __LINE__, strerror(err));          \
39           exit (1);                                             \
40         }                                                       \
41     }                                                           \
42   while (0)