4.115
Rev | Line | |
---|
[858e013f] | 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 | */ |
---|
[d957805] | 9 | |
---|
| 10 | #ifdef HAVE_CONFIG_H |
---|
| 11 | #include "config.h" |
---|
| 12 | #endif |
---|
| 13 | |
---|
[6fed43e] | 14 | #include <stdio.h> |
---|
| 15 | #include <errno.h> |
---|
| 16 | #include <fcntl.h> |
---|
| 17 | #include <string.h> |
---|
| 18 | #include <unistd.h> |
---|
[065441d8] | 19 | #include <stdlib.h> |
---|
[6fed43e] | 20 | #include <sys/stat.h> |
---|
| 21 | #include <sys/types.h> |
---|
[7336d4af] | 22 | |
---|
[065441d8] | 23 | #include <rtems.h> |
---|
| 24 | #include <rtems/userenv.h> |
---|
[7336d4af] | 25 | |
---|
| 26 | #include "fstest_support.h" |
---|
| 27 | #include "fs_config.h" |
---|
| 28 | |
---|
[858e013f] | 29 | #include "fstest.h" |
---|
[32448524] | 30 | #include "pmacros.h" |
---|
[858e013f] | 31 | |
---|
[7b369af] | 32 | void *volatile prevent_compiler_optimizations; |
---|
[0a3a1b24] | 33 | |
---|
[6fed43e] | 34 | /* Break out of a chroot() environment in C */ |
---|
[28860ec0] | 35 | static void break_out_of_chroot(void) |
---|
[7336d4af] | 36 | { |
---|
[065441d8] | 37 | int rv; |
---|
| 38 | struct stat st; |
---|
| 39 | |
---|
| 40 | rtems_libio_use_global_env(); |
---|
| 41 | |
---|
| 42 | /* Perform deferred global location releases */ |
---|
| 43 | rv = stat(".", &st); |
---|
| 44 | rtems_test_assert(rv == 0); |
---|
| 45 | |
---|
| 46 | /* Perform deferred memory frees */ |
---|
[0a3a1b24] | 47 | prevent_compiler_optimizations = malloc(1); |
---|
| 48 | free(prevent_compiler_optimizations); |
---|
[7336d4af] | 49 | } |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | * Main entry point of every filesystem test |
---|
| 53 | */ |
---|
| 54 | |
---|
| 55 | rtems_task Init( |
---|
| 56 | rtems_task_argument ignored) |
---|
| 57 | { |
---|
| 58 | int rc=0; |
---|
| 59 | puts( "\n\n*** FILE SYSTEM TEST ( " FILESYSTEM " ) ***" ); |
---|
| 60 | |
---|
| 61 | puts( "Initializing filesystem " FILESYSTEM ); |
---|
| 62 | test_initialize_filesystem(); |
---|
| 63 | |
---|
| 64 | rc=chroot(BASE_FOR_TEST); |
---|
| 65 | rtems_test_assert(rc==0); |
---|
| 66 | |
---|
| 67 | test(); |
---|
| 68 | |
---|
| 69 | break_out_of_chroot(); |
---|
| 70 | |
---|
| 71 | puts( "\n\nShutting down filesystem " FILESYSTEM ); |
---|
| 72 | test_shutdown_filesystem(); |
---|
| 73 | |
---|
| 74 | puts( "*** END OF FILE SYSTEM TEST ( " FILESYSTEM " ) ***" ); |
---|
| 75 | rtems_test_exit(0); |
---|
| 76 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.