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

5
Last change on this file since 9a4eca5 was 77ff5599, checked in by Sebastian Huber <sebastian.huber@…>, on 06/10/16 at 06:48:54

score: Introduce map priority scheduler operation

Introduce map/unmap priority scheduler operations to map thread priority
values from/to the user domain to/from the scheduler domain. Use the
map priority operation to validate the thread priority. The EDF
schedulers use this new operation to distinguish between normal
priorities and priorities obtain through a job release.

Update #2173.
Update #2556.

  • Property mode set to 100644
File size: 2.6 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 <pthread.h>
16#include <errno.h>
17
18const char rtems_test_name[] = "PSXAUTOINIT 1";
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22
23void *POSIX_Init(
24  void *argument
25)
26{
27  int             sc;
28  pthread_mutex_t mutex1;
29  pthread_mutex_t mutex2;
30  int             prioceiling;
31
32  TEST_BEGIN();
33
34  /* path using mutex get with interrupts disabled */
35  mutex1 = PTHREAD_MUTEX_INITIALIZER;
36  mutex2 = PTHREAD_MUTEX_INITIALIZER;
37  puts( "Init - pthread_mutex_lock - auto initialize - OK" );
38  sc = pthread_mutex_lock( &mutex1 );
39  fatal_posix_service_status( sc, 0, "mutex lock OK" );
40
41  puts( "Init - pthread_mutex_lock - auto initialize - EINVAL" );
42  sc = pthread_mutex_lock( &mutex2 );
43  fatal_posix_service_status( sc, EINVAL, "mutex lock EINVAL" );
44
45  puts( "Init - pthread_mutex_unlock - OK" );
46  sc = pthread_mutex_unlock( &mutex1 );
47  fatal_posix_service_status( sc, 0, "mutex unlock OK" );
48
49  puts( "Init - pthread_mutex_destroy - OK" );
50  sc = pthread_mutex_destroy( &mutex1 );
51  fatal_posix_service_status( sc, 0, "mutex destroy OK" );
52
53  /* path using mutex get with dispatching disabled */
54  mutex1 = PTHREAD_MUTEX_INITIALIZER;
55  mutex2 = PTHREAD_MUTEX_INITIALIZER;
56  puts( "Init - pthread_mutex_getprioceiling - auto initialize - OK" );
57  prioceiling = 1;
58  sc = pthread_mutex_getprioceiling( &mutex1, &prioceiling );
59  fatal_posix_service_status( sc, 0, "mutex getprioceiling OK" );
60  rtems_test_assert( prioceiling == 0 );
61
62  puts( "Init - pthread_mutex_getprioceiling - auto initialize - EINVAL" );
63  prioceiling = 1;
64  sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
65  fatal_posix_service_status( sc, EINVAL, "mutex getprioceiling EINVAL" );
66  rtems_test_assert( prioceiling == 1 );
67
68  puts( "Init - pthread_mutex_destroy - OK" );
69  sc = pthread_mutex_destroy( &mutex1 );
70  fatal_posix_service_status( sc, 0, "mutex destroy OK" );
71
72  TEST_END();
73  rtems_test_exit( 0 );
74
75  return NULL; /* just so the compiler thinks we returned something */
76}
77
78#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
79#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
80
81#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
82
83#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
84#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
85
86#define CONFIGURE_POSIX_INIT_THREAD_TABLE
87
88#define CONFIGURE_INIT
89#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.