source: rtems/testsuites/psxtests/psxusleep/init.c @ ea7d86b

4.104.115
Last change on this file since ea7d86b was ea7d86b, checked in by Joel Sherrill <joel.sherrill@…>, on 11/12/09 at 00:21:51

2009-11-11 Joel Sherrill <joel.sherrill@…>

PR 1466/tests

  • Makefile.am, configure.ac, psxclock/init.c, psxclock/psxclock.doc, psxclock/psxclock.scn, psxkey03/init.c, psxsignal02/init.c, psxsignal03/init.c, psxstack01/init.c: Remove usleep() from tests. Add test specifically to test it since it is deprecated as of POSIX.1-2008.
  • psxusleep/.cvsignore, psxusleep/Makefile.am, psxusleep/init.c, psxusleep/psxusleep.doc, psxusleep/psxusleep.scn: New files.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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#include <pmacros.h>
13#include <time.h>
14#include <errno.h>
15
16rtems_task Init(
17  rtems_task_argument argument
18)
19{
20  struct tm       tm;
21  struct timespec tv;
22  useconds_t      remaining;
23  int             sc;
24
25  puts( "\n\n*** POSIX USLEEP TEST ***" );
26
27  tm_build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
28
29  /* set the time of day, and print our buffer in multiple ways */
30
31  tv.tv_nsec = 0;
32  tv.tv_sec = mktime( &tm );
33  rtems_test_assert( tv.tv_sec != -1 );
34
35  /* now set the time of day */
36
37  printf( asctime( &tm ) );
38  puts( "Init: clock_settime - SUCCESSFUL" );
39  sc = clock_settime( CLOCK_REALTIME, &tv );
40  rtems_test_assert( !sc );
41
42  printf( asctime( &tm ) );
43  printf( ctime( &tv.tv_sec ) );
44
45  /* use sleep to delay */
46
47  remaining = usleep( 3 * 1000000 );
48  rtems_test_assert( !remaining );
49 
50  sc = clock_gettime( CLOCK_REALTIME, &tv );
51  rtems_test_assert( !sc );
52
53  printf( ctime( &tv.tv_sec ) );
54
55  puts( "*** END OF POSIX USLEEP TEST ***" );
56  rtems_test_exit(0);
57}
58
59
60/* configuration information */
61#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
62#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
63
64#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
65#define CONFIGURE_MAXIMUM_TASKS             1
66
67#define CONFIGURE_INIT
68#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.