1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2013. |
---|
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 <timesys.h> |
---|
15 | #include <rtems/btimer.h> |
---|
16 | #include <errno.h> |
---|
17 | #include <pthread.h> |
---|
18 | #include "test_support.h" |
---|
19 | |
---|
20 | const char rtems_test_name[] = "PSXTMMUTEX 07"; |
---|
21 | |
---|
22 | /* forward declarations to avoid warnings */ |
---|
23 | void *POSIX_Init(void *argument); |
---|
24 | void test_mutex_setprioceiling(void); |
---|
25 | void test_mutex_getprioceiling(void); |
---|
26 | |
---|
27 | pthread_mutex_t MutexId; |
---|
28 | |
---|
29 | void test_mutex_setprioceiling(void) |
---|
30 | { |
---|
31 | benchmark_timer_t end_time; |
---|
32 | int status; |
---|
33 | int old_ceiling; |
---|
34 | |
---|
35 | benchmark_timer_initialize(); |
---|
36 | status = pthread_mutex_setprioceiling( &MutexId, 5, &old_ceiling ); |
---|
37 | end_time = benchmark_timer_read(); |
---|
38 | rtems_test_assert( status == 0 ); |
---|
39 | |
---|
40 | put_time( |
---|
41 | "pthread_mutex_setprioceiling: only case", |
---|
42 | end_time, |
---|
43 | 1, /* Only executed once */ |
---|
44 | 0, |
---|
45 | 0 |
---|
46 | ); |
---|
47 | } |
---|
48 | |
---|
49 | void test_mutex_getprioceiling(void) |
---|
50 | { |
---|
51 | benchmark_timer_t end_time; |
---|
52 | int status; |
---|
53 | int current_ceiling; |
---|
54 | |
---|
55 | benchmark_timer_initialize(); |
---|
56 | status = pthread_mutex_getprioceiling( &MutexId, ¤t_ceiling ); |
---|
57 | end_time = benchmark_timer_read(); |
---|
58 | rtems_test_assert( status == 0 ); |
---|
59 | |
---|
60 | put_time( |
---|
61 | "pthread_mutex_getprioceiling: only case", |
---|
62 | end_time, |
---|
63 | 1, /* Only executed once */ |
---|
64 | 0, |
---|
65 | 0 |
---|
66 | ); |
---|
67 | } |
---|
68 | |
---|
69 | void *POSIX_Init( |
---|
70 | void *argument |
---|
71 | ) |
---|
72 | { |
---|
73 | int status; |
---|
74 | |
---|
75 | TEST_BEGIN(); |
---|
76 | /* create mutex*/ |
---|
77 | status = pthread_mutex_init( &MutexId, NULL ); |
---|
78 | rtems_test_assert( status == 0 ); |
---|
79 | |
---|
80 | test_mutex_getprioceiling(); |
---|
81 | test_mutex_setprioceiling(); |
---|
82 | test_mutex_getprioceiling(); |
---|
83 | |
---|
84 | /* destroy mutex */ |
---|
85 | status = pthread_mutex_destroy( &MutexId ); |
---|
86 | rtems_test_assert( status == 0 ); |
---|
87 | |
---|
88 | TEST_END(); |
---|
89 | |
---|
90 | rtems_test_exit(0); |
---|
91 | } |
---|
92 | |
---|
93 | |
---|
94 | /* configuration information */ |
---|
95 | |
---|
96 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
97 | #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER |
---|
98 | |
---|
99 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
100 | #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 |
---|
101 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
102 | |
---|
103 | #define CONFIGURE_INIT |
---|
104 | |
---|
105 | #include <rtems/confdefs.h> |
---|
106 | /* end of file */ |
---|