source: rtems/testsuites/psxtests/psxfilelock01/init.c @ 9a4eca5

Last change on this file since 9a4eca5 was 698c2e50, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 25, 2014 at 7:06:16 AM

tests/psxtests: Use <rtems/test.h>

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16#include <errno.h>
17
18const char rtems_test_name[] = "PSXFILELOCK 1";
19
20/* forward declarations to avoid warnings */
21rtems_task Init(rtems_task_argument argument);
22
23rtems_task Init(
24  rtems_task_argument argument
25)
26{
27  FILE *fd;
28  int   sc;
29
30  TEST_BEGIN();
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 
50  TEST_END();
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
62#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
63
64#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
65
66#define CONFIGURE_INIT
67
68#include <rtems/confdefs.h>
69/* end of file */
Note: See TracBrowser for help on using the repository browser.