source: rtems/testsuites/fstests/support/fstest.h @ 28860ec0

4.115
Last change on this file since 28860ec0 was 28860ec0, checked in by Sebastian Huber <sebastian.huber@…>, on 02/08/12 at 14:57:04

Fixed warnings and minor bugs

o Due to the usual integer propagation rules care must be taken in case

off_t is involved.

o Use the effective UID and GID consistently.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifndef __FSTEST_H
13#define __FSTEST_H
14
15#define TIME_PRECISION  (2)
16#define TIME_EQUAL(x,y) (abs((x)-(y))<TIME_PRECISION)
17
18
19#define FS_PASS() do {puts("PASS");} while (0)
20#define FS_FAIL() do {\
21  printf( "FAIL   %s: %d \n", __FILE__, __LINE__ );\
22 } while (0)
23
24
25#define SHOW_MESSAGE(e, func, ...) printf(\
26    "Testing %-10s with arguments: %-20s EXPECT %s\n",\
27    #func,#__VA_ARGS__,#e)
28
29#define EXPECT_EQUAL(expect, function, ...)  do { \
30  SHOW_MESSAGE(#expect,function,__VA_ARGS__);\
31 if (expect==function(__VA_ARGS__)) \
32     FS_PASS();\
33 else \
34     FS_FAIL();\
35   } while (0)
36
37#define EXPECT_UNEQUAL(expect, function, ...)  do { \
38  SHOW_MESSAGE(#expect,function,__VA_ARGS__);\
39 if (expect!=function(__VA_ARGS__)) \
40     FS_PASS();\
41 else\
42     FS_FAIL();\
43   } while (0)
44
45#define EXPECT_ERROR(ERROR, function, ...)  do { \
46  SHOW_MESSAGE(#ERROR,function,#__VA_ARGS__);\
47 if ((-1==function(__VA_ARGS__)) && (errno==ERROR)) \
48     FS_PASS();\
49 else \
50     FS_FAIL();\
51   } while (0)
52
53void test(void);
54
55#define BASE_FOR_TEST "/mnt"
56#endif
Note: See TracBrowser for help on using the repository browser.