[98e16aad] | 1 | /* |
---|
[6c2de60] | 2 | * COPYRIGHT (c) 1989-2012. |
---|
[98e16aad] | 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 |
---|
[c499856] | 7 | * http://www.rtems.org/license/LICENSE. |
---|
[98e16aad] | 8 | */ |
---|
| 9 | |
---|
[cafefbf] | 10 | #ifdef HAVE_CONFIG_H |
---|
| 11 | #include "config.h" |
---|
| 12 | #endif |
---|
| 13 | |
---|
[98e16aad] | 14 | #include <tmacros.h> |
---|
| 15 | #include "test_support.h" |
---|
| 16 | #include <errno.h> |
---|
| 17 | |
---|
[698c2e50] | 18 | const char rtems_test_name[] = "PSXFILELOCK 1"; |
---|
| 19 | |
---|
[6c2de60] | 20 | /* forward declarations to avoid warnings */ |
---|
| 21 | rtems_task Init(rtems_task_argument argument); |
---|
| 22 | |
---|
[98e16aad] | 23 | rtems_task Init( |
---|
| 24 | rtems_task_argument argument |
---|
| 25 | ) |
---|
| 26 | { |
---|
| 27 | FILE *fd; |
---|
| 28 | int sc; |
---|
| 29 | |
---|
[698c2e50] | 30 | TEST_BEGIN(); |
---|
[98e16aad] | 31 | |
---|
| 32 | puts( "Open /testfile" ); |
---|
| 33 | fd = fopen( "/testfile", "w+" ); |
---|
| 34 | rtems_test_assert( fd ); |
---|
| 35 | |
---|
| 36 | puts( "flockfile /testfile" ); |
---|
| 37 | flockfile( fd ); |
---|
| 38 | |
---|
| 39 | puts( "ftrylockfile /testfile" ); |
---|
| 40 | sc = ftrylockfile( fd ); |
---|
| 41 | rtems_test_assert( sc == -1 ); |
---|
| 42 | rtems_test_assert( errno == ENOTSUP ); |
---|
| 43 | |
---|
| 44 | puts( "flockfile /testfile" ); |
---|
| 45 | flockfile( fd ); |
---|
| 46 | |
---|
| 47 | puts( "funlockfile /testfile" ); |
---|
| 48 | funlockfile( fd ); |
---|
| 49 | |
---|
[698c2e50] | 50 | TEST_END(); |
---|
[98e16aad] | 51 | |
---|
| 52 | rtems_test_exit(0); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | /* configuration information */ |
---|
| 56 | |
---|
| 57 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
| 58 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
| 59 | |
---|
| 60 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 |
---|
| 61 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
[698c2e50] | 62 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
| 63 | |
---|
[98e16aad] | 64 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
| 65 | |
---|
| 66 | #define CONFIGURE_INIT |
---|
| 67 | |
---|
| 68 | #include <rtems/confdefs.h> |
---|
| 69 | /* end of file */ |
---|