source: rtems/testsuites/psxtests/psxconfig01/init.c @ e4fd35d

5
Last change on this file since e4fd35d was e4fd35d, checked in by Sebastian Huber <sebastian.huber@…>, on May 3, 2016 at 10:55:00 AM

confdefs.h: Fix named object size estimate

Account for the terminating null character. Use _POSIX_PATH_MAX instead
of NAME_MAX according to _POSIX_Semaphore_Manager_initialization() and
_POSIX_Message_queue_Manager_initialization().

  • 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_QUEUES POSIX_MQ_COUNT
134
135  #define POSIX_MQ_0_COUNT 2
136  #define POSIX_MQ_1_COUNT 3
137  #define POSIX_MQ_2_COUNT 5
138  #define POSIX_MQ_3_COUNT 7
139  #define POSIX_MQ_4_COUNT 11
140
141  #define POSIX_MQ_0_SIZE 137
142  #define POSIX_MQ_1_SIZE 139
143  #define POSIX_MQ_2_SIZE 149
144  #define POSIX_MQ_3_SIZE 151
145  #define POSIX_MQ_4_SIZE 157
146
147  #define POSIX_MQ_BUFFER_MEMORY \
148    (CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_0_COUNT, POSIX_MQ_0_SIZE) \
149      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_1_COUNT, POSIX_MQ_1_SIZE) \
150      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_2_COUNT, POSIX_MQ_2_SIZE) \
151      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_3_COUNT, POSIX_MQ_3_SIZE) \
152      + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(POSIX_MQ_4_COUNT, POSIX_MQ_4_SIZE))
153
154  static const uint8_t posix_mq_counts [POSIX_MQ_COUNT] = {
155    POSIX_MQ_0_COUNT,
156    POSIX_MQ_1_COUNT,
157    POSIX_MQ_2_COUNT,
158    POSIX_MQ_3_COUNT,
159    POSIX_MQ_4_COUNT
160  };
161
162  static const uint8_t posix_mq_sizes [POSIX_MQ_COUNT] = {
163    POSIX_MQ_0_SIZE,
164    POSIX_MQ_1_SIZE,
165    POSIX_MQ_2_SIZE,
166    POSIX_MQ_3_SIZE,
167    POSIX_MQ_4_SIZE
168  };
169#else
170  #define POSIX_MQ_BUFFER_MEMORY 0
171#endif
172
173#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
174  (MQ_BUFFER_MEMORY + POSIX_MQ_BUFFER_MEMORY)
175
176#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
177#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
178
179#define CONFIGURE_MAXIMUM_DRIVERS 2
180
181#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
182
183#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
184
185#define CONFIGURE_INIT
186
187static rtems_task Init(rtems_task_argument argument);
188
189#include <rtems/confdefs.h>
190
191typedef struct {
192  uint64_t data [16];
193} area;
194
195#ifdef CONFIGURE_MAXIMUM_PARTITIONS
196  static area partition_areas [CONFIGURE_MAXIMUM_PARTITIONS];
197#endif
198
199#ifdef CONFIGURE_MAXIMUM_REGIONS
200  static area region_areas [CONFIGURE_MAXIMUM_REGIONS];
201#endif
202
203static char posix_name [_POSIX_PATH_MAX + 1];
204
205#if !defined(RTEMS_SMP)
206  static void *task_var;
207#endif
208
209static char *get_posix_name(char a, char b, char c, int i)
210{
211  posix_name [_POSIX_PATH_MAX - 4] = a;
212  posix_name [_POSIX_PATH_MAX - 3] = b;
213  posix_name [_POSIX_PATH_MAX - 2] = c;
214  posix_name [_POSIX_PATH_MAX - 1] = 'A' + i;
215
216  return posix_name;
217}
218
219#if !defined(RTEMS_SMP)
220static void task_var_dtor(void *var RTEMS_UNUSED)
221{
222  /* Do nothing */
223}
224#endif
225
226static void *posix_thread(void *arg RTEMS_UNUSED)
227{
228  rtems_test_assert(0);
229}
230
231static void posix_key_dtor(void *key RTEMS_UNUSED)
232{
233  /* Do nothing */
234}
235
236static void print_info(void)
237{
238  Heap_Information_block info;
239  bool ok = rtems_workspace_get_information(&info);
240  rtems_test_assert(ok);
241
242  printf(
243    "used blocks = %" PRIu32 ", "
244    "largest used block = %" PRIu32 ", "
245    "used space = %" PRIu32 "\n"
246    "free blocks = %" PRIu32 ", "
247    "largest free block = %" PRIu32 ", "
248    "free space = %" PRIu32 "\n",
249    info.Used.number,
250    info.Used.largest,
251    info.Used.total,
252    info.Free.number,
253    info.Free.largest,
254    info.Free.total
255  );
256}
257
258static rtems_task Init(rtems_task_argument argument)
259{
260  rtems_status_code sc = RTEMS_SUCCESSFUL;
261  int eno = 0;
262  int rv = 0;
263  rtems_id id = RTEMS_ID_NONE;
264  rtems_name name = rtems_build_name('C', 'O', 'N', 'F');
265  rtems_extensions_table table;
266  rtems_resource_snapshot snapshot;
267  int i = 0;
268  pthread_key_t key;
269
270  TEST_BEGIN();
271
272  memset(posix_name, 'P', sizeof(posix_name) - 1);
273
274  print_info();
275
276  rtems_resource_snapshot_take(&snapshot);
277  rtems_test_assert(rtems_resource_snapshot_equal(&snapshot, &snapshot));
278  rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
279
280#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
281  for (i = 3; i < CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; ++i) {
282    int oflag = O_WRONLY | O_CREAT | O_TRUNC;
283    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
284    char path [] = { 'F', 'I', 'L', 'E', 'A' + i, '\0' };
285    int fd = open(path, oflag, mode);
286    rtems_test_assert(fd == i);
287  }
288  rtems_resource_snapshot_take(&snapshot);
289  rtems_test_assert(
290    snapshot.open_files == CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
291  );
292#endif
293
294#ifdef CONFIGURE_MAXIMUM_USER_EXTENSIONS
295  memset(&table, 0, sizeof(table));
296  for (i = 0; i < CONFIGURE_MAXIMUM_USER_EXTENSIONS; ++i) {
297    sc = rtems_extension_create(name, &table, &id);
298    directive_failed(sc, "rtems_extension_create");
299  }
300  rtems_resource_snapshot_take(&snapshot);
301  rtems_test_assert(
302    snapshot.rtems_api.active_extensions == CONFIGURE_MAXIMUM_USER_EXTENSIONS
303  );
304#endif
305
306#ifdef CONFIGURE_MAXIMUM_POSIX_KEYS
307  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_KEYS; ++i) {
308    eno = pthread_key_create(&key, posix_key_dtor);
309    rtems_test_assert(eno == 0);
310
311    eno = pthread_setspecific(key, (void *) (uintptr_t)(i + 1));
312    rtems_test_assert(eno == 0);
313  }
314  eno = pthread_key_create(&key, posix_key_dtor);
315  rtems_test_assert(eno == EAGAIN);
316  rtems_resource_snapshot_take(&snapshot);
317  rtems_test_assert(
318    snapshot.active_posix_keys == CONFIGURE_POSIX_KEYS
319  );
320  rtems_test_assert(
321    snapshot.active_posix_key_value_pairs == CONFIGURE_MAXIMUM_POSIX_KEYS
322  );
323#else
324  (void) key;
325#endif
326
327#ifdef CONFIGURE_MAXIMUM_BARRIERS
328  for (i = 0; i < CONFIGURE_MAXIMUM_BARRIERS; ++i) {
329    sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
330    directive_failed(sc, "rtems_barrier_create");
331  }
332  rtems_resource_snapshot_take(&snapshot);
333  rtems_test_assert(
334    snapshot.rtems_api.active_barriers == CONFIGURE_MAXIMUM_BARRIERS
335  );
336#endif
337
338#ifdef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
339  for (i = 0; i < CONFIGURE_MAXIMUM_MESSAGE_QUEUES; ++i) {
340    sc = rtems_message_queue_create(
341      name,
342      mq_counts [i],
343      mq_sizes [i],
344      RTEMS_DEFAULT_ATTRIBUTES,
345      &id
346    );
347    directive_failed(sc, "rtems_message_queue_create");
348  }
349  rtems_resource_snapshot_take(&snapshot);
350  rtems_test_assert(
351    snapshot.rtems_api.active_message_queues
352      == CONFIGURE_MAXIMUM_MESSAGE_QUEUES
353  );
354#endif
355
356#ifdef CONFIGURE_MAXIMUM_PARTITIONS
357  for (i = 0; i < CONFIGURE_MAXIMUM_PARTITIONS; ++i) {
358    sc = rtems_partition_create(
359      name,
360      partition_areas + i,
361      sizeof(partition_areas [0]),
362      sizeof(partition_areas [0]),
363      RTEMS_DEFAULT_ATTRIBUTES,
364      &id
365    );
366    directive_failed(sc, "rtems_partition_create");
367  }
368  rtems_resource_snapshot_take(&snapshot);
369  rtems_test_assert(
370    snapshot.rtems_api.active_partitions == CONFIGURE_MAXIMUM_PARTITIONS
371  );
372#endif
373
374#ifdef CONFIGURE_MAXIMUM_PERIODS
375  for (i = 0; i < CONFIGURE_MAXIMUM_PERIODS; ++i) {
376    sc = rtems_rate_monotonic_create(name, &id);
377    directive_failed(sc, "rtems_rate_monotonic_create");
378  }
379  rtems_resource_snapshot_take(&snapshot);
380  rtems_test_assert(
381    snapshot.rtems_api.active_periods == CONFIGURE_MAXIMUM_PERIODS
382  );
383#endif
384
385#ifdef CONFIGURE_MAXIMUM_REGIONS
386  for (i = 0; i < CONFIGURE_MAXIMUM_REGIONS; ++i) {
387    sc = rtems_region_create(
388      name,
389      region_areas + i,
390      sizeof(region_areas [0]),
391      1,
392      RTEMS_DEFAULT_ATTRIBUTES,
393      &id
394    );
395    directive_failed(sc, "rtems_region_create");
396  }
397  rtems_resource_snapshot_take(&snapshot);
398  rtems_test_assert(
399    snapshot.rtems_api.active_regions == CONFIGURE_MAXIMUM_REGIONS
400  );
401#endif
402
403#ifdef CONFIGURE_MAXIMUM_SEMAPHORES
404  for (i = 0; i < CONFIGURE_MAXIMUM_SEMAPHORES; ++i) {
405    sc = rtems_semaphore_create(
406      name,
407      0,
408      RTEMS_DEFAULT_ATTRIBUTES,
409      0,
410      &id
411    );
412    directive_failed(sc, "rtems_semaphore_create");
413  }
414  rtems_resource_snapshot_take(&snapshot);
415  rtems_test_assert(
416    snapshot.rtems_api.active_semaphores >= CONFIGURE_MAXIMUM_SEMAPHORES
417  );
418#endif
419
420#ifdef CONFIGURE_MAXIMUM_TASKS
421  for (i = 1; i < CONFIGURE_MAXIMUM_TASKS; ++i) {
422    sc = rtems_task_create(
423      name,
424      RTEMS_MINIMUM_PRIORITY,
425      RTEMS_MINIMUM_STACK_SIZE,
426      RTEMS_DEFAULT_MODES,
427      RTEMS_LOCAL | RTEMS_FLOATING_POINT,
428      &id
429    );
430    directive_failed(sc, "rtems_task_create");
431  }
432  rtems_resource_snapshot_take(&snapshot);
433  rtems_test_assert(
434    snapshot.rtems_api.active_tasks == CONFIGURE_MAXIMUM_TASKS
435  );
436#endif
437
438#if !defined(RTEMS_SMP)
439#ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
440  /*
441   * We know this is deprecated and don't want a warning on every BSP built.
442   */
443  #pragma GCC diagnostic push
444  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
445    for (i = 0; i < CONFIGURE_MAXIMUM_TASK_VARIABLES; ++i) {
446      sc = rtems_task_variable_add(RTEMS_SELF, &task_var, task_var_dtor);
447      directive_failed(sc, "rtems_task_variable_add");
448    }
449  #pragma GCC diagnostic pop
450#endif
451#endif
452
453#ifdef CONFIGURE_MAXIMUM_TIMERS
454  for (i = 0; i < CONFIGURE_MAXIMUM_TIMERS; ++i) {
455    sc = rtems_timer_create(name, &id);
456    directive_failed(sc, "rtems_timer_create");
457  }
458  rtems_resource_snapshot_take(&snapshot);
459  rtems_test_assert(
460    snapshot.rtems_api.active_timers == CONFIGURE_MAXIMUM_TIMERS
461  );
462#endif
463
464#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
465  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_BARRIERS; ++i) {
466    pthread_barrier_t barrier;
467    eno = pthread_barrier_init(&barrier, NULL, 1);
468    rtems_test_assert(eno == 0);
469  }
470  rtems_resource_snapshot_take(&snapshot);
471  rtems_test_assert(
472    snapshot.posix_api.active_barriers == CONFIGURE_MAXIMUM_POSIX_BARRIERS
473  );
474#endif
475
476#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
477  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES; ++i) {
478    pthread_cond_t cond;
479    eno = pthread_cond_init(&cond, NULL);
480    rtems_test_assert(eno == 0);
481  }
482  rtems_resource_snapshot_take(&snapshot);
483  rtems_test_assert(
484    snapshot.posix_api.active_condition_variables
485      == CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
486  );
487#endif
488
489#ifdef POSIX_MQ_COUNT
490  for (i = 0; i < POSIX_MQ_COUNT; ++i) {
491    int oflag = O_RDWR | O_CREAT | O_EXCL;
492    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
493    struct mq_attr attr = {
494      .mq_maxmsg = posix_mq_counts [i],
495      .mq_msgsize = posix_mq_sizes [i]
496    };
497    char *path = get_posix_name('M', 'S', 'Q', i);
498    mqd_t mq = mq_open(path, oflag, mode, &attr);
499    rtems_test_assert(mq >= 0);
500  }
501  rtems_resource_snapshot_take(&snapshot);
502  rtems_test_assert(
503    snapshot.posix_api.active_message_queues
504      == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
505  );
506#endif
507
508#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
509  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MUTEXES; ++i) {
510    pthread_mutex_t mutex;
511    eno = pthread_mutex_init(&mutex, NULL);
512    rtems_test_assert(eno == 0);
513  }
514  rtems_resource_snapshot_take(&snapshot);
515  rtems_test_assert(
516    snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
517  );
518#endif
519
520#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
521  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_RWLOCKS; ++i) {
522    pthread_rwlock_t rwlock;
523    eno = pthread_rwlock_init(&rwlock, NULL);
524    rtems_test_assert(eno == 0);
525  }
526  rtems_resource_snapshot_take(&snapshot);
527  rtems_test_assert(
528    snapshot.posix_api.active_rwlocks == CONFIGURE_MAXIMUM_POSIX_RWLOCKS
529  );
530#endif
531
532#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
533  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; ++i) {
534    int oflag = O_RDWR | O_CREAT | O_EXCL;
535    mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
536    unsigned int value = 0;
537    char *path = get_posix_name('S', 'E', 'M', i);
538    sem_t *sem = sem_open(path, oflag, mode, value);
539    rtems_test_assert(sem != SEM_FAILED);
540  }
541  rtems_resource_snapshot_take(&snapshot);
542  rtems_test_assert(
543    snapshot.posix_api.active_semaphores == CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
544  );
545#endif
546
547#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
548  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SPINLOCKS; ++i) {
549    pthread_spinlock_t spinlock;
550    eno = pthread_spin_init(&spinlock, 0);
551    rtems_test_assert(eno == 0);
552  }
553  rtems_resource_snapshot_take(&snapshot);
554  rtems_test_assert(
555    snapshot.posix_api.active_spinlocks == CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
556  );
557#endif
558
559#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
560  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_THREADS; ++i) {
561    pthread_t thread;
562    eno = pthread_create(&thread, NULL, posix_thread, NULL);
563    rtems_test_assert(eno == 0);
564  }
565  rtems_resource_snapshot_take(&snapshot);
566  rtems_test_assert(
567    snapshot.posix_api.active_threads == CONFIGURE_MAXIMUM_POSIX_THREADS
568  );
569#endif
570
571#ifdef CONFIGURE_MAXIMUM_POSIX_TIMERS
572  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_TIMERS; ++i) {
573    timer_t timer_id;
574    rv = timer_create(CLOCK_REALTIME, NULL, &timer_id);
575    rtems_test_assert(rv == 0);
576  }
577  rtems_resource_snapshot_take(&snapshot);
578  rtems_test_assert(
579    snapshot.posix_api.active_timers == CONFIGURE_MAXIMUM_POSIX_TIMERS
580  );
581#endif
582
583  printf("object creation done\n");
584  print_info();
585
586  TEST_END();
587
588  rtems_test_exit(0);
589}
Note: See TracBrowser for help on using the repository browser.