source: rtems/testsuites/psxtests/psx11/init.c @ d802489

4.104.114.84.95
Last change on this file since d802489 was d802489, checked in by Joel Sherrill <joel.sherrill@…>, on 08/02/02 at 00:53:21

2002-08-01 Joel Sherrill <joel@…>

  • Per PR47 add support for buffered test output. This involved adding defines to redirect output to a buffer and dump it when full, at "test pause", and at exit. To avoid problems when redefining exit(), all tests were modified to call rtems_test_exit(). Some tests, notable psxtests, had to be modified to include the standard test macro .h file (pmacros.h or tmacros.h) to enable this support.
  • include/pmacros.h, psx01/task.c, psx02/init.c, psx02/task.c, psx03/init.c, psx04/init.c, psx05/init.c, psx06/init.c, psx07/init.c, psx08/task3.c, psx09/init.c, psx10/init.c, psx11/init.c, psx12/init.c, psx13/Makefile.am, psx13/main.c, psx13/test.c, psxcancel/init.c, psxchroot01/Makefile.am, psxchroot01/main.c, psxchroot01/test.c, psxfile01/Makefile.am, psxfile01/main.c, psxfile01/test.c, psxfile01/test_cat.c, psxfile01/test_extend.c, psxfile01/test_write.c, psxmount/Makefile.am, psxmount/main.c, psxmount/test.c, psxmsgq01/init.c, psxreaddir/Makefile.am, psxreaddir/main.c, psxreaddir/test.c, psxsem01/init.c, psxstat/Makefile.am, psxstat/main.c, psxstat/test.c, psxtime/main.c, psxtime/test.c, psxtimer/psxtimer.c: Modified.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
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.OARcorp.com/rtems/license.html.
8 *
9 *  $Id$
10 */
11
12#define CONFIGURE_INIT
13#include "system.h"
14#include <errno.h>
15
16void *POSIX_Init(
17  void *argument
18)
19{
20  int                  status;
21  struct sched_param   param;
22  pthread_attr_t       attr;
23
24  puts( "\n\n*** POSIX TEST 11 ***" );
25
26  /* set the time of day, and print our buffer in multiple ways */
27
28  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
29
30  /* get id of this thread */
31
32  Init_id = pthread_self();
33  printf( "Init's ID is 0x%08x\n", Init_id );
34 
35  /* exercise pthread_setschedparam */
36
37  param.sched_priority = 127;
38
39  puts( "Init: Setting scheduling parameters to FIFO with priority 127" );
40  status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
41  assert( !status );
42
43  param.sched_priority = 125;
44
45  puts( "Init: Setting scheduling parameters to RR with priority 125" );
46  status = pthread_setschedparam( Init_id, SCHED_RR, &param );
47  assert( !status );
48
49  param.sched_priority = 121;
50
51  puts( "Init: Setting scheduling parameters to OTHER with priority 121" );
52  status = pthread_setschedparam( Init_id, SCHED_OTHER, &param );
53  assert( !status );
54
55  /* create a thread as SCHED_FIFO */
56 
57  puts( "Init: create a thread of SCHED_FIFO with priority 120" );
58  status = pthread_attr_init( &attr );
59  assert( !status );
60 
61  attr.schedpolicy = SCHED_FIFO;
62  attr.schedparam.sched_priority = 120;
63 
64  status = pthread_create( &Task_id, &attr, Task_1, NULL );
65  assert( !status );
66 
67  puts( "Init: join with the other thread" );
68  status = pthread_join( Task_id, NULL );
69  assert( !status );
70
71  /* create a thread as SCHED_RR */
72 
73  puts( "Init: create a thread of SCHED_RR with priority 120" );
74  status = pthread_attr_init( &attr );
75  assert( !status );
76 
77  attr.schedpolicy = SCHED_RR;
78  attr.schedparam.sched_priority = 120;
79 
80  status = pthread_create( &Task_id, &attr, Task_1, NULL );
81  assert( !status );
82 
83  puts( "Init: join with the other thread" );
84  status = pthread_join( Task_id, NULL );
85  assert( !status );
86
87  /* create a thread as SCHED_OTHER */
88
89  puts( "Init: create a thread of SCHED_OTHER with priority 120" );
90  status = pthread_attr_init( &attr );
91  assert( !status );
92
93  attr.schedpolicy = SCHED_OTHER;
94  attr.schedparam.sched_priority = 120;
95
96  status = pthread_create( &Task_id, &attr, Task_1, NULL );
97  assert( !status );
98
99  puts( "Init: join with the other thread" );
100  status = pthread_join( Task_id, NULL );
101  assert( !status );
102
103  puts( "*** END OF POSIX TEST 11 ***" );
104  rtems_test_exit( 0 );
105
106  return NULL; /* just so the compiler thinks we returned something */
107}
Note: See TracBrowser for help on using the repository browser.