Changeset af9115f3 in rtems for testsuites/smptests


Ignore:
Timestamp:
Oct 6, 2017, 8:07:38 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
da9f5f1
Parents:
65012bf
git-author:
Sebastian Huber <sebastian.huber@…> (10/06/17 08:07:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/09/17 12:52:58)
Message:

posix: Simplify POSIX_API_Control

Return stack area via pthread_getattr_np().

Simplify

  • pthread_attr_setaffinity_np(), and
  • pthread_attr_getaffinity_np()

and let the scheduler do the more sophisticated error checks.

Make

  • pthread_setaffinity_np(),
  • pthread_getaffinity_np(),
  • pthread_attr_setaffinity_np(), and
  • pthread_attr_getaffinity_np()

available in all configurations.

Update #2514.
Close #3145.
Close #3168.

Location:
testsuites/smptests/smppsxaffinity01
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/smptests/smppsxaffinity01/init.c

    r65012bf raf9115f3  
    3939  pthread_attr_t      attr;
    4040
     41  sc = pthread_attr_init( &attr );
     42  rtems_test_assert( sc == 0 );
     43
    4144  /* Verify pthread_attr_getaffinity_np validates attr  */
    42   puts( "Init - pthread_attr_getaffinity_np - Invalid attr - EFAULT" );
    43   sc = pthread_attr_getaffinity_np( NULL, sizeof(cpu_set_t), &cpuset );
    44   rtems_test_assert( sc == EFAULT );
     45  puts( "Init - pthread_attr_getaffinity_np - Invalid attr - EINVAL" );
     46  sc = pthread_attr_getaffinity_np( NULL, sizeof( cpuset ), &cpuset );
     47  rtems_test_assert( sc == EINVAL );
    4548
    4649  /* Verify pthread_attr_getaffinity_np validates cpuset */
    47   puts( "Init - pthread_attr_getaffinity_np - Invalid attr - EFAULT" );
    48   sc = pthread_attr_getaffinity_np( &attr, sizeof(cpu_set_t), NULL );
    49   rtems_test_assert( sc == EFAULT );
     50  puts( "Init - pthread_attr_getaffinity_np - Invalid attr - EINVAL" );
     51  sc = pthread_attr_getaffinity_np( &attr, sizeof( cpuset ), NULL );
     52  rtems_test_assert( sc == EINVAL );
    5053
    5154  /* Verify pthread_attr_getaffinity_np validates cpusetsize */
    5255  puts( "Init - pthread_attr_getaffinity_np - Invalid cpusetsize - EINVAL" );
    53   sc = pthread_attr_getaffinity_np( &attr, sizeof(cpu_set_t) * 2 , &cpuset );
     56  sc = pthread_attr_getaffinity_np( &attr, sizeof( cpuset ) * 2 , &cpuset );
    5457  rtems_test_assert( sc == EINVAL );
    5558
     59  sc = pthread_attr_destroy( &attr );
     60  rtems_test_assert( sc == 0 );
     61
     62  puts( "Init - pthread_attr_getaffinity_np - Not initialized attr - EINVAL" );
     63  sc = pthread_attr_getaffinity_np( &attr, sizeof( cpuset ), &cpuset );
     64  rtems_test_assert( sc == EINVAL );
    5665}
    5766
     
    6271  pthread_attr_t      attr;
    6372
     73  sc = pthread_attr_init( &attr );
     74  rtems_test_assert( sc == 0 );
     75
    6476  /* Verify pthread_attr_setaffinity_np validates attr.  */
    65   puts( "Init - pthread_attr_setaffinity_np - Invalid attr - EFAULT" );
    66   sc = pthread_attr_setaffinity_np( NULL, sizeof(cpu_set_t), &cpuset );
    67   rtems_test_assert( sc == EFAULT );
     77  puts( "Init - pthread_attr_setaffinity_np - Invalid attr - EINVAL" );
     78  sc = pthread_attr_setaffinity_np( NULL, sizeof( cpuset ), &cpuset );
     79  rtems_test_assert( sc == EINVAL );
    6880
    6981  /* Verify pthread_attr_setaffinity_np validates cpuset    */
    70   puts( "Init - pthread_attr_setaffinity_np - Invalid attr - EFAULT" );
    71   sc = pthread_attr_setaffinity_np( &attr, sizeof(cpu_set_t), NULL );
    72   rtems_test_assert( sc == EFAULT );
     82  puts( "Init - pthread_attr_setaffinity_np - Invalid attr - EINVAL" );
     83  sc = pthread_attr_setaffinity_np( &attr, sizeof( cpuset ), NULL );
     84  rtems_test_assert( sc == EINVAL );
    7385
    7486  /* Verify pthread_attr_setaffinity_np validates cpusetsize */
    7587  puts( "Init - pthread_attr_setaffinity_np - Invalid cpusetsize - EINVAL" );
    76   sc = pthread_attr_setaffinity_np( &attr, sizeof(cpu_set_t) * 2 , &cpuset );
     88  sc = pthread_attr_setaffinity_np( &attr, sizeof( cpuset ) * 2 , &cpuset );
    7789  rtems_test_assert( sc == EINVAL );
    7890
    79   /* Verify pthread_attr_setaffinity_np validates cpuset greater than 0  */
    80   CPU_ZERO(&cpuset);
    81   puts( "Init - pthread_attr_setaffinity_np - No cpus in cpuset - EINVAL" );
    82   sc = pthread_attr_setaffinity_np( &attr, sizeof(cpu_set_t) , &cpuset );
    83   rtems_test_assert( sc == EINVAL );
     91  sc = pthread_attr_destroy( &attr );
     92  rtems_test_assert( sc == 0 );
    8493
    85   /* Verify pthread_attr_setaffinity_np validates invalid cpu in cpuset */
    86   CPU_FILL(&cpuset);
    87   puts( "Init - pthread_attr_setaffinity_np - Too many cpus in cpuset - EINVAL" );
    88   sc = pthread_attr_setaffinity_np( &attr, sizeof(cpu_set_t) , &cpuset );
     94  puts( "Init - pthread_attr_setaffinity_np - Not initialized attr - EINVAL" );
     95  sc = pthread_attr_setaffinity_np( &attr, sizeof( cpuset ), &cpuset  );
    8996  rtems_test_assert( sc == EINVAL );
    9097}
  • testsuites/smptests/smppsxaffinity01/smppsxaffinity01.scn

    r65012bf raf9115f3  
    1 *** SMP POSIX AFFINITY ATTRIBUTE TEST 1 ***
    2 Init - pthread_attr_setaffinity_np - Invalid attr - EFAULT
    3 Init - pthread_attr_setaffinity_np - Invalid attr - EFAULT
     1*** BEGIN OF TEST SMPPSXAFFINITY 1 ***
     2Init - pthread_attr_setaffinity_np - Invalid attr - EINVAL
     3Init - pthread_attr_setaffinity_np - Invalid attr - EINVAL
    44Init - pthread_attr_setaffinity_np - Invalid cpusetsize - EINVAL
    5 Init - pthread_attr_setaffinity_np - No cpus in cpuset - EINVAL
    6 Init - pthread_attr_setaffinity_np - Too many cpus in cpuset - EINVAL
    7 Init - pthread_attr_getaffinity_np - Invalid attr - EFAULT
    8 Init - pthread_attr_getaffinity_np - Invalid attr - EFAULT
     5Init - pthread_attr_setaffinity_np - Not initialized attr - EINVAL
     6Init - pthread_attr_getaffinity_np - Invalid attr - EINVAL
     7Init - pthread_attr_getaffinity_np - Invalid attr - EINVAL
    98Init - pthread_attr_getaffinity_np - Invalid cpusetsize - EINVAL
     9Init - pthread_attr_getaffinity_np - Not initialized attr - EINVAL
    1010Init - Validate pthread_attr_setaffinity_np and pthread_attr_getaffinity_np
    11 *** END OF SMP POSIX AFFINITY ATTRIBUTE TEST 1 ***
     11*** END OF TEST SMPPSXAFFINITY 1 ***
Note: See TracChangeset for help on using the changeset viewer.