Changeset fd5471b in rtems


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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/ada/sptests/sp01/sp01.adb

    r6c2b8a4b rfd5471b  
    2222with SPTEST;
    2323with TEST_SUPPORT;
     24with TEXT_IO;
     25with System.OS_Interface;
    2426
    2527procedure SP01 is
    2628  INIT_ID : RTEMS.ID;
    2729  STATUS  : RTEMS.STATUS_CODES;
     30  obj_clockid_t : System.OS_Interface.clockid_t;
     31  pragma Warnings (Off, obj_clockid_t);
     32  obj_pid_t : System.OS_Interface.pid_t;
     33  pragma Warnings (Off, obj_pid_t);
     34  obj_pthread_attr_t : System.OS_Interface.pthread_attr_t;
     35  pragma Warnings (Off, obj_pthread_attr_t);
     36  obj_pthread_condattr_t : System.OS_Interface.pthread_condattr_t;
     37  pragma Warnings (Off, obj_pthread_condattr_t);
     38  obj_pthread_cond_t : System.OS_Interface.pthread_cond_t;
     39  pragma Warnings (Off, obj_pthread_cond_t);
     40  obj_pthread_key_t : System.OS_Interface.pthread_key_t;
     41  pragma Warnings (Off, obj_pthread_key_t);
     42  obj_pthread_mutexattr_t : System.OS_Interface.pthread_mutexattr_t;
     43  pragma Warnings (Off, obj_pthread_mutexattr_t);
     44  obj_pthread_mutex_t : System.OS_Interface.pthread_mutex_t;
     45  pragma Warnings (Off, obj_pthread_mutex_t);
     46  obj_pthread_rwlockattr_t : System.OS_Interface.pthread_rwlockattr_t;
     47  pragma Warnings (Off, obj_pthread_rwlockattr_t);
     48  obj_pthread_rwlock_t : System.OS_Interface.pthread_rwlock_t;
     49  pragma Warnings (Off, obj_pthread_rwlock_t);
     50  obj_pthread_t : System.OS_Interface.pthread_t;
     51  pragma Warnings (Off, obj_pthread_t);
     52  obj_rtems_id : System.OS_Interface.rtems_id;
     53  pragma Warnings (Off, obj_rtems_id);
     54  obj_sigset_t : System.OS_Interface.sigset_t;
     55  pragma Warnings (Off, obj_sigset_t);
     56  obj_stack_t : System.OS_Interface.stack_t;
     57  pragma Warnings (Off, obj_stack_t);
     58  obj_struct_sched_param : System.OS_Interface.struct_sched_param;
     59  pragma Warnings (Off, obj_struct_sched_param);
     60  obj_struct_sigaction : System.OS_Interface.struct_sigaction;
     61  pragma Warnings (Off, obj_struct_sigaction);
     62  obj_timespec : System.OS_Interface.timespec;
     63  pragma Warnings (Off, obj_timespec);
    2864begin
     65
     66   TEXT_IO.NEW_LINE( 2 );
     67   TEST_SUPPORT.ADA_TEST_BEGIN;
     68
     69   TEST_SUPPORT.Check_Type(
     70      0,
     71      obj_clockid_t'Size,
     72      obj_clockid_t'Alignment
     73   );
     74   TEST_SUPPORT.Check_Type(
     75      1,
     76      obj_pid_t'Size,
     77      obj_pid_t'Alignment
     78   );
     79   TEST_SUPPORT.Check_Type(
     80      2,
     81      obj_pthread_attr_t'Size,
     82      obj_pthread_attr_t'Alignment
     83   );
     84   TEST_SUPPORT.Check_Type(
     85      3,
     86      obj_pthread_condattr_t'Size,
     87      obj_pthread_condattr_t'Alignment
     88   );
     89   TEST_SUPPORT.Check_Type(
     90      4,
     91      obj_pthread_cond_t'Size,
     92      obj_pthread_cond_t'Alignment
     93   );
     94   TEST_SUPPORT.Check_Type(
     95      5,
     96      obj_pthread_key_t'Size,
     97      obj_pthread_key_t'Alignment
     98   );
     99   TEST_SUPPORT.Check_Type(
     100      6,
     101      obj_pthread_mutexattr_t'Size,
     102      obj_pthread_mutexattr_t'Alignment
     103   );
     104   TEST_SUPPORT.Check_Type(
     105      7,
     106      obj_pthread_mutex_t'Size,
     107      obj_pthread_mutex_t'Alignment
     108   );
     109   TEST_SUPPORT.Check_Type(
     110      8,
     111      obj_pthread_rwlockattr_t'Size,
     112      obj_pthread_rwlockattr_t'Alignment
     113   );
     114   TEST_SUPPORT.Check_Type(
     115      9,
     116      obj_pthread_rwlock_t'Size,
     117      obj_pthread_rwlock_t'Alignment
     118   );
     119   TEST_SUPPORT.Check_Type(
     120      10,
     121      obj_pthread_t'Size,
     122      obj_pthread_t'Alignment
     123   );
     124   TEST_SUPPORT.Check_Type(
     125      11,
     126      obj_rtems_id'Size,
     127      obj_rtems_id'Alignment
     128   );
     129   TEST_SUPPORT.Check_Type(
     130      12,
     131      obj_sigset_t'Size,
     132      obj_sigset_t'Alignment
     133   );
     134   TEST_SUPPORT.Check_Type(
     135      13,
     136      obj_stack_t'Size,
     137      obj_stack_t'Alignment
     138   );
     139   TEST_SUPPORT.Check_Type(
     140      14,
     141      obj_struct_sched_param'Size,
     142      obj_struct_sched_param'Alignment
     143   );
     144   TEST_SUPPORT.Check_Type(
     145      15,
     146      obj_struct_sigaction'Size,
     147      obj_struct_sigaction'Alignment
     148   );
     149   TEST_SUPPORT.Check_Type(
     150      16,
     151      obj_timespec'Size,
     152      obj_timespec'Alignment
     153   );
    29154
    30155   RTEMS.TASKS.CREATE(
  • testsuites/ada/sptests/sp01/sptest.adb

    r6c2b8a4b rfd5471b  
    3737      STATUS : RTEMS.STATUS_CODES;
    3838   begin
    39 
    40       TEXT_IO.NEW_LINE( 2 );
    41       TEST_SUPPORT.ADA_TEST_BEGIN;
    4239
    4340      TIME := ( 1988, 12, 31, 9, 0, 0, 0 );
  • 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.