diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-12-01 22:37:06 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-12-04 14:15:18 +0100 |
commit | fd5471b6b7761a03e87a11808b57dd123ae49e31 (patch) | |
tree | 0d268d4fd2db978715987ffd0d5498967deacd18 /testsuites/ada/support | |
parent | score: Use self-contained API mutex (diff) | |
download | rtems-fd5471b6b7761a03e87a11808b57dd123ae49e31.tar.bz2 |
ada: Check C and POSIX types
Update #3256.
Diffstat (limited to 'testsuites/ada/support')
-rw-r--r-- | testsuites/ada/support/init.c | 55 | ||||
-rw-r--r-- | testsuites/ada/support/test_support.ads | 7 |
2 files changed, 62 insertions, 0 deletions
diff --git a/testsuites/ada/support/init.c b/testsuites/ada/support/init.c index 4fabad5825..3e395fc15f 100644 --- a/testsuites/ada/support/init.c +++ b/testsuites/ada/support/init.c @@ -3,8 +3,13 @@ * On-Line Applications Research Corporation (OAR). */ +#include <sys/types.h> +#include <limits.h> +#include <pthread.h> +#include <stdio.h> #include <stdlib.h> +#include <rtems.h> #include <rtems/test.h> #include <rtems/score/threadimpl.h> @@ -34,6 +39,7 @@ uint32_t work_space_size(void); uint32_t is_configured_multiprocessing(void); uint32_t get_node(void); rtems_id tcb_to_id(Thread_Control *tcb); +void check_type(long type, long size, long alignment); /* * By putting this in brackets rather than quotes, we get the search @@ -99,3 +105,52 @@ uint32_t get_node(void) return _Objects_Local_node; } +typedef struct { + const char *name; + long size; + long alignment; +} type_spec; + +#define TYPE_SPEC(t) { #t, sizeof(t) * CHAR_BIT, _Alignof(t) } + +static const type_spec types[] = { + TYPE_SPEC(clockid_t), + TYPE_SPEC(pid_t), + TYPE_SPEC(pthread_attr_t), + TYPE_SPEC(pthread_condattr_t), + TYPE_SPEC(pthread_cond_t), + TYPE_SPEC(pthread_key_t), + TYPE_SPEC(pthread_mutexattr_t), + TYPE_SPEC(pthread_mutex_t), + TYPE_SPEC(pthread_rwlockattr_t), + TYPE_SPEC(pthread_rwlock_t), + TYPE_SPEC(pthread_t), + TYPE_SPEC(rtems_id), + TYPE_SPEC(sigset_t), + TYPE_SPEC(stack_t), + TYPE_SPEC(struct sched_param), + TYPE_SPEC(struct sigaction), + TYPE_SPEC(struct timespec) +}; + +void check_type(long type, long size, long alignment) +{ + if (type >= 0 && type < (long) RTEMS_ARRAY_SIZE(types)) { + const type_spec *ts; + + ts = &types[type]; + printf( + "%s: size %li == %li, alignment %li == %li\n", + ts->name, + ts->size, + size, + ts->alignment, + alignment + ); + if (ts->size != size || ts->alignment != alignment) { + exit(0); + } + } else { + exit(0); + } +} diff --git a/testsuites/ada/support/test_support.ads b/testsuites/ada/support/test_support.ads index b1f2f55280..e3a71a33a0 100644 --- a/testsuites/ada/support/test_support.ads +++ b/testsuites/ada/support/test_support.ads @@ -28,6 +28,13 @@ package Test_Support is procedure Ada_Test_End; pragma Import (C, Ada_Test_End, "ada_test_end"); + procedure Check_Type( + t : in Long_Integer; + s : in Long_Integer; + a : in Long_Integer + ); + pragma Import (C, Check_Type, "check_type"); + -- -- Fatal_Directive_Status -- |