source: rtems/testsuites/psxtests/psxconfig01/init.c @ 7bdb765

4.11
Last change on this file since 7bdb765 was 7bdb765, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 12, 2014 at 7:46:30 AM

Add POSIX key value pairs to resource snapshot

  • Property mode set to 100644
File size: 15.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup psxtests
5 *
6 * @brief Test that the workspace size estimate is correct.
7 */
8
9/*
10 * Copyright (c) 2014. On-Line Applications Research Corporation (OAR).
11 * Copyright (c) 2011-2014 embedded brains GmbH.  All rights reserved.
12 *
13 *  embedded brains GmbH
14 *  Dornierstr. 4
15 *  82178 Puchheim
16 *  Germany
17 *  <rtems@embedded-brains.de>
18 *
19 * The license and distribution terms for this file may be
20 * found in the file LICENSE in this distribution or at
21 * http://www.rtems.org/license/LICENSE.
22 */
23
24#ifdef HAVE_CONFIG_H
25  #include "config.h"
26#endif
27
28#include <rtems/test.h>
29#include <tmacros.h>
30
31#include <sys/stat.h>
32#include <fcntl.h>
33#include <inttypes.h>
34#include <mqueue.h>
35#include <pthread.h>
36#include <semaphore.h>
37#include <signal.h>
38#include <stdio.h>
39#include <time.h>
40#include <limits.h>
41
42#include <rtems/libcsupport.h>
43
44const char rtems_test_name[] = "PSXCONFIG 1";
45
46#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
47
48#define CONFIGURE_MAXIMUM_POSIX_KEYS 23
49#ifdef CONFIGURE_MAXIMUM_POSIX_KEYS
50  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS CONFIGURE_MAXIMUM_POSIX_KEYS
51#endif
52
53#define CONFIGURE_MAXIMUM_BARRIERS 2
54#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 7
55#define CONFIGURE_MAXIMUM_PARTITIONS 37
56#define CONFIGURE_MAXIMUM_PERIODS 41
57#define CONFIGURE_MAXIMUM_REGIONS 43
58#define CONFIGURE_MAXIMUM_SEMAPHORES 47
59#define CONFIGURE_MAXIMUM_TASKS 11
60#if !defined(RTEMS_SMP)
61  #define CONFIGURE_MAXIMUM_TASK_VARIABLES 13
62#endif
63#define CONFIGURE_MAXIMUM_TIMERS 59
64#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 17
65
66#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 31
67#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 29
68#define POSIX_MQ_COUNT 5
69#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 19
70#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 7
71#define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 31
72#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 41
73#define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 17
74#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
75
76#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
77#define CONFIGURE_MAXIMUM_POSIX_TIMERS 47
78
79#ifndef CONFIGURE_MAXIMUM_TASKS
80  #define CONFIGURE_MAXIMUM_TASKS 1
81#endif
82
83#ifdef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
84  #define MQ_0_COUNT 2
85  #define MQ_1_COUNT 3
86  #define MQ_2_COUNT 5
87  #define MQ_3_COUNT 7
88  #define MQ_4_COUNT 11
89  #define MQ_5_COUNT 13
90  #define MQ_6_COUNT 17
91
92  #define MQ_0_SIZE 101
93  #define MQ_1_SIZE 103
94  #define MQ_2_SIZE 107
95  #define MQ_3_SIZE 109
96  #define MQ_4_SIZE 113
97  #define MQ_5_SIZE 127
98  #define MQ_6_SIZE 131
99
100  #define MQ_BUFFER_MEMORY \
101    (CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_0_COUNT, MQ_0_SIZE) \
102      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_1_COUNT, MQ_1_SIZE) \
103      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_2_COUNT, MQ_2_SIZE) \
104      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_3_COUNT, MQ_3_SIZE) \
105      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_4_COUNT, MQ_4_SIZE) \
106      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_5_COUNT, MQ_5_SIZE) \
107      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MQ_6_COUNT, MQ_6_SIZE))
108
109  static const uint8_t mq_counts [CONFIGURE_MAXIMUM_MESSAGE_QUEUES] = {
110    MQ_0_COUNT,
111    MQ_1_COUNT,
112    MQ_2_COUNT,
113    MQ_3_COUNT,
114    MQ_4_COUNT,
115    MQ_5_COUNT,
116    MQ_6_COUNT
117  };
118
119  static const uint8_t mq_sizes [CONFIGURE_MAXIMUM_MESSAGE_QUEUES] = {
120    MQ_0_SIZE,
121    MQ_1_SIZE,
122    MQ_2_SIZE,
123    MQ_3_SIZE,
124    MQ_4_SIZE,
125    MQ_5_SIZE,
126    MQ_6_SIZE
127  };
128#else
129  #define MQ_BUFFER_MEMORY 0
130#endif
131
132#ifdef POSIX_MQ_COUNT
133  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS POSIX_MQ_COUNT
134  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES POSIX_MQ_COUNT
135
136  #define POSIX_MQ_0_COUNT 2
137  #define POSIX_MQ_1_COUNT 3
138  #define POSIX_MQ_2_COUNT 5
139  #define POSIX_MQ_3_COUNT 7
140  #define POSIX_MQ_4_COUNT 11
141
142  #define POSIX_MQ_0_SIZE 137
143  #define POSIX_MQ_1_SIZE 139
144  #define POSIX_MQ_2_SIZE 149
145  #define POSIX_MQ_3_SIZE 151
146  #define POSIX_MQ_4_SIZE 157
147
148  #define POSIX_MQ_BUFFER_MEMORY \
149    (CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_0_COUNT, POSIX_MQ_0_SIZE) \
150      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_1_COUNT, POSIX_MQ_1_SIZE) \
151      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_2_COUNT, POSIX_MQ_2_SIZE) \
152      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_3_COUNT, POSIX_MQ_3_SIZE) \
153      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_4_COUNT, POSIX_MQ_4_SIZE))
154
155  static const uint8_t posix_mq_counts [POSIX_MQ_COUNT] = {
156    POSIX_MQ_0_COUNT,
157    POSIX_MQ_1_COUNT,
158    POSIX_MQ_2_COUNT,
159    POSIX_MQ_3_COUNT,
160    POSIX_MQ_4_COUNT
161  };
162
163  static const uint8_t posix_mq_sizes [POSIX_MQ_COUNT] = {
164    POSIX_MQ_0_SIZE,
165    POSIX_MQ_1_SIZE,
166    POSIX_MQ_2_SIZE,
167    POSIX_MQ_3_SIZE,
168    POSIX_MQ_4_SIZE
169  };
170#else
171  #define POSIX_MQ_BUFFER_MEMORY 0
172#endif
173
174#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
175  (MQ_BUFFER_MEMORY + POSIX_MQ_BUFFER_MEMORY)
176
177#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
178#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
179
180#define CONFIGURE_MAXIMUM_DRIVERS 2
181
182#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
183
184#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
185
186#define CONFIGURE_INIT
187
188static rtems_task Init(rtems_task_argument argument);
189
190#include <rtems/confdefs.h>
191
192typedef struct {
193  uint64_t data [16];
194} area;
195
196#ifdef CONFIGURE_MAXIMUM_PARTITIONS
197  static area partition_areas [CONFIGURE_MAXIMUM_PARTITIONS];
198#endif
199
200#ifdef CONFIGURE_MAXIMUM_REGIONS
201  static area region_areas [CONFIGURE_MAXIMUM_REGIONS];
202#endif
203
204static char posix_name [NAME_MAX];
205
206#if !defined(RTEMS_SMP)
207  static void *task_var;
208#endif
209
210static char *get_posix_name(char a, char b, char c, int i)
211{
212  posix_name [NAME_MAX - 5] = a;
213  posix_name [NAME_MAX - 4] = b;
214  posix_name [NAME_MAX - 3] = c;
215  posix_name [NAME_MAX - 2] = 'A' + i;
216
217  return posix_name;
218}
219
220#if !defined(RTEMS_SMP)
221static void task_var_dtor(void *var __attribute__((unused)))
222{
223  /* Do nothing */
224}
225#endif
226
227static void *posix_thread(void *arg __attribute__((unused)))
228{
229  rtems_test_assert(0);
230}
231
232static void posix_key_dtor(void *key __attribute__((unused)))
233{
234  /* Do nothing */
235}
236
237static void print_info(void)
238{
239  Heap_Information_block info;
240  bool ok = rtems_workspace_get_information(&info);
241  rtems_test_assert(ok);
242
243  printf(
244    "used blocks = %" PRIu32 ", "
245    "largest used block = %" PRIu32 ", "
246    "used space = %" PRIu32 "\n"
247    "free blocks = %" PRIu32 ", "
248    "largest free block = %" PRIu32 ", "
249    "free space = %" PRIu32 "\n",
250    info.Used.number,
251    info.Used.largest,
252    info.Used.total,
253    info.Free.number,
254    info.Free.largest,
255    info.Free.total
256  );
257}
258
259static rtems_task Init(rtems_task_argument argument)
260{
261  rtems_status_code sc = RTEMS_SUCCESSFUL;
262  int eno = 0;
263  int rv = 0;
264  rtems_id id = RTEMS_ID_NONE;
265  rtems_name name = rtems_build_name('C', 'O', 'N', 'F');
266  rtems_extensions_table table;
267  rtems_resource_snapshot snapshot;
268  int i = 0;
269  pthread_key_t key;
270
271  TEST_BEGIN();
272
273  memset(posix_name, 'P', sizeof(posix_name) - 1);
274
275  print_info();
276
277  rtems_resource_snapshot_take(&snapshot);
278  rtems_test_assert(rtems_resource_snapshot_equal(&snapshot, &snapshot));
279  rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
280
281#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
282  for (i = 3; i < CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; ++i) {
283    int oflag = O_WRONLY | O_CREAT | O_TRUNC;
284    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
285    char path [] = { 'F', 'I', 'L', 'E', 'A' + i, '\0' };
286    int fd = open(path, oflag, mode);
287    rtems_test_assert(fd == i);
288  }
289  rtems_resource_snapshot_take(&snapshot);
290  rtems_test_assert(
291    snapshot.open_files == CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
292  );
293#endif
294
295#ifdef CONFIGURE_MAXIMUM_USER_EXTENSIONS
296  memset(&table, 0, sizeof(table));
297  for (i = 0; i < CONFIGURE_MAXIMUM_USER_EXTENSIONS; ++i) {
298    sc = rtems_extension_create(name, &table, &id);
299    directive_failed(sc, "rtems_extension_create");
300  }
301  rtems_resource_snapshot_take(&snapshot);
302  rtems_test_assert(
303    snapshot.rtems_api.active_extensions == CONFIGURE_MAXIMUM_USER_EXTENSIONS
304  );
305#endif
306
307#ifdef CONFIGURE_MAXIMUM_POSIX_KEYS
308  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_KEYS; ++i) {
309    eno = pthread_key_create(&key, posix_key_dtor);
310    rtems_test_assert(eno == 0);
311
312    eno = pthread_setspecific(key, (void *) (i + 1));
313    rtems_test_assert(eno == 0);
314  }
315  eno = pthread_key_create(&key, posix_key_dtor);
316  rtems_test_assert(eno == EAGAIN);
317  rtems_resource_snapshot_take(&snapshot);
318  rtems_test_assert(
319    snapshot.active_posix_keys == CONFIGURE_POSIX_KEYS
320  );
321  rtems_test_assert(
322    snapshot.active_posix_key_value_pairs == CONFIGURE_MAXIMUM_POSIX_KEYS
323  );
324#else
325  (void) key;
326#endif
327
328#ifdef CONFIGURE_MAXIMUM_BARRIERS
329  for (i = 0; i < CONFIGURE_MAXIMUM_BARRIERS; ++i) {
330    sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
331    directive_failed(sc, "rtems_barrier_create");
332  }
333  rtems_resource_snapshot_take(&snapshot);
334  rtems_test_assert(
335    snapshot.rtems_api.active_barriers == CONFIGURE_MAXIMUM_BARRIERS
336  );
337#endif
338
339#ifdef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
340  for (i = 0; i < CONFIGURE_MAXIMUM_MESSAGE_QUEUES; ++i) {
341    sc = rtems_message_queue_create(
342      name,
343      mq_counts [i],
344      mq_sizes [i],
345      RTEMS_DEFAULT_ATTRIBUTES,
346      &id
347    );
348    directive_failed(sc, "rtems_message_queue_create");
349  }
350  rtems_resource_snapshot_take(&snapshot);
351  rtems_test_assert(
352    snapshot.rtems_api.active_message_queues
353      == CONFIGURE_MAXIMUM_MESSAGE_QUEUES
354  );
355#endif
356
357#ifdef CONFIGURE_MAXIMUM_PARTITIONS
358  for (i = 0; i < CONFIGURE_MAXIMUM_PARTITIONS; ++i) {
359    sc = rtems_partition_create(
360      name,
361      partition_areas + i,
362      sizeof(partition_areas [0]),
363      sizeof(partition_areas [0]),
364      RTEMS_DEFAULT_ATTRIBUTES,
365      &id
366    );
367    directive_failed(sc, "rtems_partition_create");
368  }
369  rtems_resource_snapshot_take(&snapshot);
370  rtems_test_assert(
371    snapshot.rtems_api.active_partitions == CONFIGURE_MAXIMUM_PARTITIONS
372  );
373#endif
374
375#ifdef CONFIGURE_MAXIMUM_PERIODS
376  for (i = 0; i < CONFIGURE_MAXIMUM_PERIODS; ++i) {
377    sc = rtems_rate_monotonic_create(name, &id);
378    directive_failed(sc, "rtems_rate_monotonic_create");
379  }
380  rtems_resource_snapshot_take(&snapshot);
381  rtems_test_assert(
382    snapshot.rtems_api.active_periods == CONFIGURE_MAXIMUM_PERIODS
383  );
384#endif
385
386#ifdef CONFIGURE_MAXIMUM_REGIONS
387  for (i = 0; i < CONFIGURE_MAXIMUM_REGIONS; ++i) {
388    sc = rtems_region_create(
389      name,
390      region_areas + i,
391      sizeof(region_areas [0]),
392      1,
393      RTEMS_DEFAULT_ATTRIBUTES,
394      &id
395    );
396    directive_failed(sc, "rtems_region_create");
397  }
398  rtems_resource_snapshot_take(&snapshot);
399  rtems_test_assert(
400    snapshot.rtems_api.active_regions == CONFIGURE_MAXIMUM_REGIONS
401  );
402#endif
403
404#ifdef CONFIGURE_MAXIMUM_SEMAPHORES
405  for (i = 0; i < CONFIGURE_MAXIMUM_SEMAPHORES; ++i) {
406    sc = rtems_semaphore_create(
407      name,
408      0,
409      RTEMS_DEFAULT_ATTRIBUTES,
410      0,
411      &id
412    );
413    directive_failed(sc, "rtems_semaphore_create");
414  }
415  rtems_resource_snapshot_take(&snapshot);
416  rtems_test_assert(
417    snapshot.rtems_api.active_semaphores >= CONFIGURE_MAXIMUM_SEMAPHORES
418  );
419#endif
420
421#ifdef CONFIGURE_MAXIMUM_TASKS
422  for (i = 1; i < CONFIGURE_MAXIMUM_TASKS; ++i) {
423    sc = rtems_task_create(
424      name,
425      RTEMS_MINIMUM_PRIORITY,
426      RTEMS_MINIMUM_STACK_SIZE,
427      RTEMS_DEFAULT_MODES,
428      RTEMS_LOCAL | RTEMS_FLOATING_POINT,
429      &id
430    );
431    directive_failed(sc, "rtems_task_create");
432  }
433  rtems_resource_snapshot_take(&snapshot);
434  rtems_test_assert(
435    snapshot.rtems_api.active_tasks == CONFIGURE_MAXIMUM_TASKS
436  );
437#endif
438
439#if !defined(RTEMS_SMP)
440#ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
441  for (i = 0; i < CONFIGURE_MAXIMUM_TASK_VARIABLES; ++i) {
442    sc = rtems_task_variable_add(RTEMS_SELF, &task_var, task_var_dtor);
443    directive_failed(sc, "rtems_task_variable_add");
444  }
445#endif
446#endif
447
448#ifdef CONFIGURE_MAXIMUM_TIMERS
449  for (i = 0; i < CONFIGURE_MAXIMUM_TIMERS; ++i) {
450    sc = rtems_timer_create(name, &id);
451    directive_failed(sc, "rtems_timer_create");
452  }
453  rtems_resource_snapshot_take(&snapshot);
454  rtems_test_assert(
455    snapshot.rtems_api.active_timers == CONFIGURE_MAXIMUM_TIMERS
456  );
457#endif
458
459#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
460  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_BARRIERS; ++i) {
461    pthread_barrier_t barrier;
462    eno = pthread_barrier_init(&barrier, NULL, 1);
463    rtems_test_assert(eno == 0);
464  }
465  rtems_resource_snapshot_take(&snapshot);
466  rtems_test_assert(
467    snapshot.posix_api.active_barriers == CONFIGURE_MAXIMUM_POSIX_BARRIERS
468  );
469#endif
470
471#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
472  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES; ++i) {
473    pthread_cond_t cond;
474    eno = pthread_cond_init(&cond, NULL);
475    rtems_test_assert(eno == 0);
476  }
477  rtems_resource_snapshot_take(&snapshot);
478  rtems_test_assert(
479    snapshot.posix_api.active_condition_variables
480      == CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
481  );
482#endif
483
484#ifdef POSIX_MQ_COUNT
485  for (i = 0; i < POSIX_MQ_COUNT; ++i) {
486    int oflag = O_RDWR | O_CREAT | O_EXCL;
487    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
488    struct mq_attr attr = {
489      .mq_maxmsg = posix_mq_counts [i],
490      .mq_msgsize = posix_mq_sizes [i]
491    };
492    char *path = get_posix_name('M', 'S', 'Q', i);
493    mqd_t mq = mq_open(path, oflag, mode, &attr);
494    rtems_test_assert(mq >= 0);
495  }
496  rtems_resource_snapshot_take(&snapshot);
497  rtems_test_assert(
498    snapshot.posix_api.active_message_queue_descriptors
499      == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
500  );
501  rtems_test_assert(
502    snapshot.posix_api.active_message_queues
503      == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
504  );
505#endif
506
507#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
508  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MUTEXES; ++i) {
509    pthread_mutex_t mutex;
510    eno = pthread_mutex_init(&mutex, NULL);
511    rtems_test_assert(eno == 0);
512  }
513  rtems_resource_snapshot_take(&snapshot);
514  rtems_test_assert(
515    snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
516  );
517#endif
518
519#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
520  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_RWLOCKS; ++i) {
521    pthread_rwlock_t rwlock;
522    eno = pthread_rwlock_init(&rwlock, NULL);
523    rtems_test_assert(eno == 0);
524  }
525  rtems_resource_snapshot_take(&snapshot);
526  rtems_test_assert(
527    snapshot.posix_api.active_rwlocks == CONFIGURE_MAXIMUM_POSIX_RWLOCKS
528  );
529#endif
530
531#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
532  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; ++i) {
533    int oflag = O_RDWR | O_CREAT | O_EXCL;
534    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
535    unsigned int value = 0;
536    char *path = get_posix_name('S', 'E', 'M', i);
537    sem_t *sem = sem_open(path, oflag, mode, value);
538    rtems_test_assert(sem != SEM_FAILED);
539  }
540  rtems_resource_snapshot_take(&snapshot);
541  rtems_test_assert(
542    snapshot.posix_api.active_semaphores == CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
543  );
544#endif
545
546#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
547  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SPINLOCKS; ++i) {
548    pthread_spinlock_t spinlock;
549    eno = pthread_spin_init(&spinlock, 0);
550    rtems_test_assert(eno == 0);
551  }
552  rtems_resource_snapshot_take(&snapshot);
553  rtems_test_assert(
554    snapshot.posix_api.active_spinlocks == CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
555  );
556#endif
557
558#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
559  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_THREADS; ++i) {
560    pthread_t thread;
561    eno = pthread_create(&thread, NULL, posix_thread, NULL);
562    rtems_test_assert(eno == 0);
563  }
564  rtems_resource_snapshot_take(&snapshot);
565  rtems_test_assert(
566    snapshot.posix_api.active_threads == CONFIGURE_MAXIMUM_POSIX_THREADS
567  );
568#endif
569
570#ifdef CONFIGURE_MAXIMUM_POSIX_TIMERS
571  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_TIMERS; ++i) {
572    timer_t timer_id;
573    rv = timer_create(CLOCK_REALTIME, NULL, &timer_id);
574    rtems_test_assert(rv == 0);
575  }
576  rtems_resource_snapshot_take(&snapshot);
577  rtems_test_assert(
578    snapshot.posix_api.active_timers == CONFIGURE_MAXIMUM_POSIX_TIMERS
579  );
580#endif
581
582  printf("object creation done\n");
583  print_info();
584
585  TEST_END();
586
587  rtems_test_exit(0);
588}
Note: See TracBrowser for help on using the repository browser.