Changeset 452f6ba9 in rtems


Ignore:
Timestamp:
Feb 22, 2016, 8:15:45 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
5d478af
Parents:
c466c62
git-author:
Sebastian Huber <sebastian.huber@…> (02/22/16 08:15:45)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/22/16 08:16:23)
Message:

psxtests/psxalarm01: Add adjtime() test case

Update #2606.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxalarm01/init.c

    rc466c62 r452f6ba9  
    1414#include <pmacros.h>
    1515
     16#include <sys/time.h>
    1617#include <signal.h>
    1718#include <errno.h>
     
    2223void *POSIX_Init(void *argument);
    2324
    24 volatile int Signal_occurred;
    2525volatile int Signal_count;
    26 void Signal_handler( int signo );
    27 void Signal_info_handler(
    28   int        signo,
    29   siginfo_t *info,
    30   void      *context
    31 );
    3226
    33 void Signal_handler(
     27static void Signal_handler(
    3428  int signo
    3529)
     
    4236    Signal_count
    4337  );
    44   Signal_occurred = 1;
    45 }
    46 
    47 void Signal_info_handler(
    48   int        signo,
    49   siginfo_t *info,
    50   void      *context
    51 )
    52 {
    53   Signal_count++;
    54   printf(
    55     "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
    56     signo,
    57     pthread_self(),
    58     Signal_count,
    59     info->si_signo,
    60     info->si_code,
    61     info->si_value.sival_int
    62   );
    63   Signal_occurred = 1;
    6438}
    6539
     
    7246  struct sigaction  act;
    7347  sigset_t          mask;
     48  struct timeval    delta;
    7449
    7550  TEST_BEGIN();
     
    10580  sleep( 2 );
    10681
     82  rtems_test_assert( Signal_count == 1 );
     83
    10784  puts( "Init: Cancel alarm" );
    10885  remaining = alarm( 0 );
    10986  printf( "Init: %d seconds left on previous alarm\n", remaining );
    11087  rtems_test_assert( remaining == 0 );
     88
     89  remaining = alarm( 1 );
     90  rtems_test_assert( remaining == 0 );
     91
     92  delta.tv_sec = 2;
     93  delta.tv_usec = 0;
     94  sc = adjtime( &delta, NULL );
     95  rtems_test_assert( sc == 0 );
     96
     97  rtems_test_assert( Signal_count == 1 );
     98
     99  remaining = alarm( 0 );
     100  rtems_test_assert( remaining == 1 );
    111101
    112102  TEST_END();
Note: See TracChangeset for help on using the changeset viewer.