source: rtems/testsuites/psxtmtests/psxtmcond01/init.c @ fd46711

4.115
Last change on this file since fd46711 was fd46711, checked in by bjorn larsson <bjornlarsson@…>, on 03/21/14 at 20:35:26

psxtmtests: Add test.h support

  • Property mode set to 100644
File size: 1.9 KB
Line 
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 <coverhd.h>
15#include <tmacros.h>
16#include <timesys.h>
17#include "test_support.h"
18#include <pthread.h>
19#include <sched.h>
20#include <rtems/timerdrv.h>
21
22const char rtems_test_name[] = "PSXTMCOND 01";
23
24/* forward declarations to avoid warnings */
25void *POSIX_Init(void *argument);
26void benchmark_create_cond_var(void);
27void benchmark_destroy_cond_var(void);
28
29pthread_cond_t mycondvar;
30
31void benchmark_create_cond_var(void)
32{
33  long end_time;
34  int  status;
35
36  benchmark_timer_initialize();
37  status = pthread_cond_init(&mycondvar, NULL);
38  end_time = benchmark_timer_read();
39  rtems_test_assert( status == 0 );
40
41  put_time(
42    "pthread_cond_init: only case",
43    end_time,
44    1,
45    0,
46    0
47  );
48}
49
50void benchmark_destroy_cond_var(void)
51{
52  long end_time;
53  int  status;
54
55  benchmark_timer_initialize();
56  status = pthread_cond_destroy(&mycondvar);
57  end_time = benchmark_timer_read();
58  rtems_test_assert( status == 0 );
59
60  put_time(
61    "pthread_cond_destroy: only case",
62    end_time,
63    1,
64    0,
65    0
66  );
67}
68
69void *POSIX_Init(
70  void *argument
71)
72{
73  TEST_BEGIN();
74
75  benchmark_create_cond_var();
76  benchmark_destroy_cond_var();
77
78  TEST_END();
79  rtems_test_exit(0);
80}
81
82/* configuration information */
83
84#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
85#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
86
87/* configure an instance of the condition variable created and destroyed */
88#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1
89
90#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
91#define CONFIGURE_POSIX_INIT_THREAD_TABLE
92
93#define CONFIGURE_INIT
94
95#include <rtems/confdefs.h>
96/* end of file */
Note: See TracBrowser for help on using the repository browser.