diff options
Diffstat (limited to 'testsuites/fstests/support')
-rw-r--r-- | testsuites/fstests/support/fstest.h | 51 | ||||
-rw-r--r-- | testsuites/fstests/support/fstest_support.c | 17 | ||||
-rw-r--r-- | testsuites/fstests/support/fstest_support.h | 16 | ||||
-rw-r--r-- | testsuites/fstests/support/ramdisk_support.c | 18 | ||||
-rw-r--r-- | testsuites/fstests/support/ramdisk_support.h | 10 |
5 files changed, 86 insertions, 26 deletions
diff --git a/testsuites/fstests/support/fstest.h b/testsuites/fstests/support/fstest.h index bc5b591873..94bf87b45c 100644 --- a/testsuites/fstests/support/fstest.h +++ b/testsuites/fstests/support/fstest.h @@ -1,6 +1,12 @@ /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). * - * $Id$ + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id Exp $ */ #ifndef __FSTEST_H @@ -9,15 +15,46 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - #include <pmacros.h> -#include "fs_config.h" - #define TIME_PRECISION (2) -#define time_equal(x,y) (abs((x)-(y))<TIME_PRECISION) -#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) -#endif +#define TIME_EQUAL(x,y) (abs((x)-(y))<TIME_PRECISION) + + +#define FS_PASS() do {puts("PASS");} while (0) +#define FS_FAIL() do {printf( "FAIL %s: %d \n", __FILE__, __LINE__ ); } while (0) + +#define SHOW_MESSAGE(e, func, ...) printf(\ + "Testing %-10s with arguments: %-20s EXPECT %s\n",\ + #func,#__VA_ARGS__,#e) + +#define EXPECT_EQUAL(expect, function, ...) do { \ + SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ + if (expect==function(__VA_ARGS__)) \ + FS_PASS();\ + else \ + FS_FAIL();\ + } while (0) + +#define EXPECT_UNEQUAL(expect, function, ...) do { \ + SHOW_MESSAGE(#expect,function,__VA_ARGS__);\ + if (expect!=function(__VA_ARGS__)) \ + FS_PASS();\ + else\ + FS_FAIL();\ + } while (0) + +#define EXPECT_ERROR(ERROR, function, ...) do { \ + SHOW_MESSAGE(#ERROR,function,#__VA_ARGS__);\ + if ((-1==function(__VA_ARGS__)) && (errno==ERROR)) \ + FS_PASS();\ + else \ + FS_FAIL();\ + } while (0) + + +#define BASE_FOR_TEST "/mnt" +#endif diff --git a/testsuites/fstests/support/fstest_support.c b/testsuites/fstests/support/fstest_support.c index c1dac4399e..4202a1040f 100644 --- a/testsuites/fstests/support/fstest_support.c +++ b/testsuites/fstests/support/fstest_support.c @@ -1,3 +1,14 @@ +/* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id Exp $ + */ + #include <stdio.h> #include <errno.h> #include <fcntl.h> @@ -11,6 +22,8 @@ #include "fstest_support.h" #include "fs_config.h" +#include "fstest.h" + #define TEMP_DIR "waterbuffalo" @@ -18,8 +31,6 @@ void break_out_of_chroot(void) { - int x; /* Used to move up a directory tree */ - int done=0; /* Are we done yet ? */ int dir_fd; /* File descriptor to directory */ struct stat sbuf; /* The stat() buffer */ chdir("/"); @@ -87,7 +98,6 @@ rtems_task Init( break_out_of_chroot(); chdir("/"); - puts( "\n\nShutting down filesystem " FILESYSTEM ); test_shutdown_filesystem(); @@ -95,4 +105,3 @@ rtems_task Init( rtems_test_exit(0); } - diff --git a/testsuites/fstests/support/fstest_support.h b/testsuites/fstests/support/fstest_support.h index 16972710a1..2fcb208619 100644 --- a/testsuites/fstests/support/fstest_support.h +++ b/testsuites/fstests/support/fstest_support.h @@ -1,17 +1,16 @@ - /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. * - * $Id$ + * $Id Exp $ */ #ifndef __FSTEST_SUPPORT_H #define __FSTEST_SUPPORT_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "pmacros.h" - -#include "rtems.h" #ifdef __cplusplus extern "C" { @@ -30,4 +29,5 @@ extern void test_shutdown_filesystem(void); }; #endif + #endif diff --git a/testsuites/fstests/support/ramdisk_support.c b/testsuites/fstests/support/ramdisk_support.c index 2945b3456e..dba0b32a4c 100644 --- a/testsuites/fstests/support/ramdisk_support.c +++ b/testsuites/fstests/support/ramdisk_support.c @@ -1,13 +1,19 @@ - /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. * - * $Id$ + * $Id Exp $ */ #include <rtems/ramdisk.h> #include <rtems/blkdev.h> #include <rtems/libio.h> #include "ramdisk_support.h" +#include "fstest.h" /* * Ramdisk information */ @@ -25,6 +31,7 @@ void init_ramdisk(void) rtems_test_assert( rc == 0 ); } + void del_ramdisk(void ) { int rc=0; @@ -35,12 +42,15 @@ void del_ramdisk(void ) rtems_test_assert( rc == 0 ); rtems_filesystem_split_dev_t(dev,major,minor); - + + rtems_test_assert(major>=0); + rtems_test_assert(minor>=0); + rc=rtems_io_unregister_driver(major); rtems_test_assert( rc == 0 ); rc=rtems_disk_io_done(); rtems_test_assert( rc == 0 ); -} +} diff --git a/testsuites/fstests/support/ramdisk_support.h b/testsuites/fstests/support/ramdisk_support.h index f3e0836cce..82f732f539 100644 --- a/testsuites/fstests/support/ramdisk_support.h +++ b/testsuites/fstests/support/ramdisk_support.h @@ -1,6 +1,12 @@ /* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). * - * $Id$ + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id Exp $ */ #ifndef __RAMDISK_SUPPORT_H #define __RAMDISK_SUPPORT_H @@ -9,8 +15,6 @@ #include "config.h" #endif -#include "fstest_support.h" - #define RAMDISK_BLOCK_SIZE (512) #define RAMDISK_BLOCK_COUNT (1024) #define RAMDISK_PATH "/dev/ramdisk" |