Changeset fd5471b in rtems for testsuites/ada/support


Ignore:
Timestamp:
Dec 1, 2017, 9:37:06 PM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ca835e56
Parents:
6c2b8a4b
git-author:
Sebastian Huber <sebastian.huber@…> (12/01/17 21:37:06)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/04/17 13:15:18)
Message:

ada: Check C and POSIX types

Update #3256.

Location:
testsuites/ada/support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/ada/support/init.c

    r6c2b8a4b rfd5471b  
    44 */
    55
     6#include <sys/types.h>
     7#include <limits.h>
     8#include <pthread.h>
     9#include <stdio.h>
    610#include <stdlib.h>
    711
     12#include <rtems.h>
    813#include <rtems/test.h>
    914#include <rtems/score/threadimpl.h>
     
    3540uint32_t get_node(void);
    3641rtems_id tcb_to_id(Thread_Control *tcb);
     42void check_type(long type, long size, long alignment);
    3743
    3844/*
     
    100106}
    101107
     108typedef struct {
     109  const char *name;
     110  long size;
     111  long alignment;
     112} type_spec;
     113
     114#define TYPE_SPEC(t) { #t, sizeof(t) * CHAR_BIT, _Alignof(t) }
     115
     116static const type_spec types[] = {
     117  TYPE_SPEC(clockid_t),
     118  TYPE_SPEC(pid_t),
     119  TYPE_SPEC(pthread_attr_t),
     120  TYPE_SPEC(pthread_condattr_t),
     121  TYPE_SPEC(pthread_cond_t),
     122  TYPE_SPEC(pthread_key_t),
     123  TYPE_SPEC(pthread_mutexattr_t),
     124  TYPE_SPEC(pthread_mutex_t),
     125  TYPE_SPEC(pthread_rwlockattr_t),
     126  TYPE_SPEC(pthread_rwlock_t),
     127  TYPE_SPEC(pthread_t),
     128  TYPE_SPEC(rtems_id),
     129  TYPE_SPEC(sigset_t),
     130  TYPE_SPEC(stack_t),
     131  TYPE_SPEC(struct sched_param),
     132  TYPE_SPEC(struct sigaction),
     133  TYPE_SPEC(struct timespec)
     134};
     135
     136void check_type(long type, long size, long alignment)
     137{
     138  if (type >= 0 && type < (long) RTEMS_ARRAY_SIZE(types)) {
     139    const type_spec *ts;
     140
     141    ts = &types[type];
     142    printf(
     143      "%s: size %li == %li, alignment %li == %li\n",
     144      ts->name,
     145      ts->size,
     146      size,
     147      ts->alignment,
     148      alignment
     149    );
     150    if (ts->size != size || ts->alignment != alignment) {
     151      exit(0);
     152    }
     153  } else {
     154    exit(0);
     155  }
     156}
  • testsuites/ada/support/test_support.ads

    r6c2b8a4b rfd5471b  
    2828   procedure Ada_Test_End;
    2929   pragma Import (C, Ada_Test_End, "ada_test_end");
     30
     31   procedure Check_Type(
     32      t : in Long_Integer;
     33      s : in Long_Integer;
     34      a : in Long_Integer
     35   );
     36   pragma Import (C, Check_Type, "check_type");
    3037
    3138--
Note: See TracChangeset for help on using the changeset viewer.