Changeset bb3484c9 in rtems for testsuites


Ignore:
Timestamp:
Oct 29, 2018, 7:59:45 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7e2aabd7
Parents:
8dc1ed1
git-author:
Sebastian Huber <sebastian.huber@…> (10/29/18 07:59:45)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/29/18 09:52:48)
Message:

posix: Enable more sptests test cases by default

Update #2514.

Location:
testsuites/sptests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spmutex01/init.c

    r8dc1ed1 rbb3484c9  
    1717#endif
    1818
     19#include <errno.h>
     20#include <pthread.h>
     21#include <setjmp.h>
    1922#include <threads.h>
    20 #include <setjmp.h>
    2123
    2224#include <rtems.h>
    2325#include <rtems/libcsupport.h>
    24 
    25 #ifdef RTEMS_POSIX_API
    26 #include <errno.h>
    27 #include <pthread.h>
    28 #endif
    2926
    3027#include "tmacros.h"
     
    7168  rtems_id mtx[MTX_COUNT];
    7269  mtx_t mtx_c11;
    73 #ifdef RTEMS_POSIX_API
    7470  pthread_mutex_t mtx_posix;
    75 #endif
    7671  rtems_id tasks[TASK_COUNT];
    7772  int generation[TASK_COUNT];
     
    223218}
    224219
    225 #ifdef RTEMS_POSIX_API
    226220static void obtain_posix(test_context *ctx)
    227221{
     
    247241  rtems_test_assert(error == 0);
    248242}
    249 #endif
    250243
    251244static void check_generations(test_context *ctx, task_id a, task_id b)
     
    369362    }
    370363
    371 #ifdef RTEMS_POSIX_API
    372364    if ((events & REQ_MTX_POSIX_OBTAIN) != 0) {
    373365      obtain_posix(ctx);
     
    379371      ++ctx->generation[id];
    380372    }
    381 #endif
    382373  }
    383374}
     
    388379  int status;
    389380  size_t i;
     381  int error;
     382  pthread_mutexattr_t attr;
    390383
    391384  ctx->tasks[M] = rtems_task_self();
     
    409402  rtems_test_assert(status == thrd_success);
    410403
    411 #ifdef RTEMS_POSIX_API
    412   {
    413     int error;
    414     pthread_mutexattr_t attr;
    415 
    416     error = pthread_mutexattr_init(&attr);
    417     rtems_test_assert(error == 0);
    418 
    419     error = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
    420     rtems_test_assert(error == 0);
    421 
    422     error = pthread_mutex_init(&ctx->mtx_posix, &attr);
    423     rtems_test_assert(error == 0);
    424 
    425     error = pthread_mutexattr_destroy(&attr);
    426     rtems_test_assert(error == 0);
    427   }
    428 #endif
     404  error = pthread_mutexattr_init(&attr);
     405  rtems_test_assert(error == 0);
     406
     407  error = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
     408  rtems_test_assert(error == 0);
     409
     410  error = pthread_mutex_init(&ctx->mtx_posix, &attr);
     411  rtems_test_assert(error == 0);
     412
     413  error = pthread_mutexattr_destroy(&attr);
     414  rtems_test_assert(error == 0);
    429415}
    430416
     
    635621static void test_deadlock_posix_and_classic(test_context *ctx)
    636622{
    637 #ifdef RTEMS_POSIX_API
    638623  obtain_posix(ctx);
    639624  request(ctx, A_1, REQ_MTX_0_OBTAIN);
     
    648633  request(ctx, A_1, REQ_MTX_0_RELEASE);
    649634  check_generations(ctx, A_1, NONE);
    650 #endif
    651635}
    652636
    653637static void test_deadlock_classic_and_posix(test_context *ctx)
    654638{
    655 #ifdef RTEMS_POSIX_API
    656639  obtain(ctx, MTX_0);
    657640  request(ctx, A_1, REQ_MTX_POSIX_OBTAIN);
     
    666649  request(ctx, A_1, REQ_MTX_POSIX_RELEASE);
    667650  check_generations(ctx, A_1, NONE);
    668 #endif
    669651}
    670652
     
    673655  rtems_status_code sc;
    674656  size_t i;
     657  int error;
    675658
    676659  for (i = 1; i < TASK_COUNT; ++i) {
     
    686669  mtx_destroy(&ctx->mtx_c11);
    687670
    688 #ifdef RTEMS_POSIX_API
    689   {
    690     int error;
    691 
    692     error = pthread_mutex_destroy(&ctx->mtx_posix);
    693     rtems_test_assert(error == 0);
    694   }
    695 #endif
     671  error = pthread_mutex_destroy(&ctx->mtx_posix);
     672  rtems_test_assert(error == 0);
    696673}
    697674
     
    749726#define CONFIGURE_MAXIMUM_SEMAPHORES 3
    750727
    751 #ifdef RTEMS_POSIX_API
    752 #endif
    753 
    754728#define CONFIGURE_INITIAL_EXTENSIONS \
    755729  { .fatal = fatal_extension }, \
  • testsuites/sptests/spstdthreads01/init.c

    r8dc1ed1 rbb3484c9  
    245245}
    246246
    247 #if defined(RTEMS_POSIX_API)
    248247static int thrd(void *arg)
    249248{
    250249  thrd_exit(123);
    251250}
    252 #endif
    253251
    254252static void test_thrd(test_context *ctx)
    255253{
    256 #if defined(RTEMS_POSIX_API)
    257254  thrd_start_t thrd_start = thrd;
    258255  int status;
     
    293290  status = thrd_detach(11235);
    294291  rtems_test_assert(status == thrd_error);
    295 #endif
    296292}
    297293
     
    418414#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
    419415#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
    420 
    421 #if defined(RTEMS_POSIX_API)
    422416#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
    423 #endif
    424417
    425418#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
  • testsuites/sptests/spsysinit01/init.c

    r8dc1ed1 rbb3484c9  
    3434
    3535#include <rtems/extensionimpl.h>
    36 #ifdef RTEMS_POSIX_API
    3736#include <rtems/posix/barrierimpl.h>
    3837#include <rtems/posix/mqueueimpl.h>
    3938#include <rtems/posix/muteximpl.h>
     39#ifdef RTEMS_POSIX_API
    4040#include <rtems/posix/psignalimpl.h>
     41#endif /* RTEMS_POSIX_API */
    4142#include <rtems/posix/pthreadimpl.h>
    4243#include <rtems/posix/rwlockimpl.h>
    4344#include <rtems/posix/semaphoreimpl.h>
    4445#include <rtems/posix/shmimpl.h>
     46#ifdef RTEMS_POSIX_API
    4547#include <rtems/posix/timerimpl.h>
    4648#endif /* RTEMS_POSIX_API */
     
    101103  POSIX_SIGNALS_PRE,
    102104  POSIX_SIGNALS_POST,
     105#endif /* RTEMS_POSIX_API */
    103106  POSIX_THREADS_PRE,
    104107  POSIX_THREADS_POST,
     
    107110  POSIX_SEMAPHORE_PRE,
    108111  POSIX_SEMAPHORE_POST,
     112#ifdef RTEMS_POSIX_API
    109113  POSIX_TIMER_PRE,
    110114  POSIX_TIMER_POST,
     115#endif /* RTEMS_POSIX_API */
    111116  POSIX_SHM_PRE,
    112117  POSIX_SHM_POST,
    113 #endif /* RTEMS_POSIX_API */
    114118  POSIX_KEYS_PRE,
    115119  POSIX_KEYS_POST,
    116 #ifdef RTEMS_POSIX_API
    117120  POSIX_CLEANUP_PRE,
    118121  POSIX_CLEANUP_POST,
    119 #endif /* RTEMS_POSIX_API */
    120122  IDLE_THREADS_PRE,
    121123  IDLE_THREADS_POST,
     
    130132  CLASSIC_USER_TASKS_PRE,
    131133  CLASSIC_USER_TASKS_POST,
    132 #ifdef RTEMS_POSIX_API
    133134  POSIX_USER_THREADS_PRE,
    134135  POSIX_USER_THREADS_POST,
    135 #endif /* RTEMS_POSIX_API */
    136136  STD_FILE_DESCRIPTORS_PRE,
    137137  STD_FILE_DESCRIPTORS_POST,
     
    402402
    403403#ifdef RTEMS_POSIX_API
    404 
    405404FIRST(RTEMS_SYSINIT_POSIX_SIGNALS)
    406405{
     
    426425  next_step(POSIX_SIGNALS_POST);
    427426}
     427#endif /* RTEMS_POSIX_API */
    428428
    429429FIRST(RTEMS_SYSINIT_POSIX_THREADS)
     
    463463}
    464464
     465#ifdef RTEMS_POSIX_API
    465466FIRST(RTEMS_SYSINIT_POSIX_TIMER)
    466467{
     
    474475  next_step(POSIX_TIMER_POST);
    475476}
     477#endif /* RTEMS_POSIX_API */
    476478
    477479FIRST(RTEMS_SYSINIT_POSIX_SHM)
     
    505507}
    506508
    507 #endif /* RTEMS_POSIX_API */
    508 
    509509FIRST(RTEMS_SYSINIT_POSIX_KEYS)
    510510{
     
    605605}
    606606
    607 #ifdef RTEMS_POSIX_API
    608 
    609607FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS)
    610608{
     
    622620  next_step(POSIX_USER_THREADS_POST);
    623621}
    624 
    625 #endif /* RTEMS_POSIX_API */
    626622
    627623FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS)
     
    660656static void Init(rtems_task_argument arg)
    661657{
    662 #ifdef RTEMS_POSIX_API
    663658  pthread_cleanup_push(NULL, NULL);
    664659  pthread_cleanup_pop(0);
    665 #endif /* RTEMS_POSIX_API */
    666660  next_step(INIT_TASK);
    667661  TEST_END();
     
    669663}
    670664
    671 #ifdef RTEMS_POSIX_API
    672 
    673665static void *POSIX_Init(void *arg)
    674666{
    675667  return NULL;
    676668}
    677 
    678 #endif /* RTEMS_POSIX_API */
    679669
    680670#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
     
    701691#define CONFIGURE_MAXIMUM_TIMERS 1
    702692
     693#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
     694
     695#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
     696
     697#define CONFIGURE_MAXIMUM_POSIX_SHMS 1
     698
    703699#ifdef RTEMS_POSIX_API
    704 
    705 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
    706 
    707 
    708 #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
    709 
    710 #define CONFIGURE_MAXIMUM_POSIX_SHMS 1
    711 
    712700#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
     701#endif /* RTEMS_POSIX_API */
    713702
    714703#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
     
    716705#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    717706
    718 #endif /* RTEMS_POSIX_API */
    719 
    720707#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
    721708
  • testsuites/sptests/spthreadq01/init.c

    r8dc1ed1 rbb3484c9  
    2020#include <rtems/score/threadimpl.h>
    2121
    22 #if defined(RTEMS_POSIX_API)
    23   #include <fcntl.h>
    24   #include <mqueue.h>
    25   #include <semaphore.h>
    26   #include <string.h>
    27   #include <pthread.h>
    28 #endif
     22#include <fcntl.h>
     23#include <mqueue.h>
     24#include <semaphore.h>
     25#include <string.h>
     26#include <pthread.h>
    2927
    3028const char rtems_test_name[] = "SPTHREADQ 1";
     
    4038  rtems_id mq;
    4139  rtems_id br;
    42 #if defined(RTEMS_POSIX_API)
    4340  mqd_t pmq;
    44 #endif
    4541} test_context;
    4642
     
    112108static void posix_worker(test_context *ctx)
    113109{
    114 #if defined(RTEMS_POSIX_API)
    115110  int rv;
    116111  char buf[1];
     
    122117  rv = mq_send(ctx->pmq, &buf[0], sizeof(buf), 0);
    123118  rtems_test_assert(rv == 0);
    124 #endif
    125119}
    126120
     
    177171static void test_posix_init(test_context *ctx)
    178172{
    179 #if defined(RTEMS_POSIX_API)
    180173  struct mq_attr attr;
    181174
     
    186179  ctx->pmq = mq_open("mq", O_CREAT | O_RDWR, 0x777, &attr);
    187180  rtems_test_assert(ctx->mq != -1);
    188 #endif
    189181}
    190182
     
    252244static void test_posix_obj(test_context *ctx)
    253245{
    254 #if defined(RTEMS_POSIX_API)
    255246  char buf[1];
    256247  unsigned prio;
     
    265256  rtems_test_assert(buf[0] == 'x');
    266257  rtems_test_assert(prio == 0);
    267 #endif
    268258}
    269259
     
    300290#define CONFIGURE_MAXIMUM_BARRIERS  1
    301291
    302 #if defined(RTEMS_POSIX_API)
    303   #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
    304   #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
    305     (2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1))
    306 #else
    307   #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
    308     CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1)
    309 #endif
     292#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
     293#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
     294  (2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1))
    310295
    311296#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.