void *POSIX_Init( void *argument ) { TEST_BEGIN(); benchmark_pthread_create(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument ignored ) { TEST_BEGIN(); timespec_divide_by_zero(); timespec_greater_than_lhs_sec_less(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument ignored ) { TEST_BEGIN(); threadq_first_empty( "FIFO", THREAD_QUEUE_DISCIPLINE_FIFO ); threadq_first_empty( "Priority", THREAD_QUEUE_DISCIPLINE_PRIORITY ); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { TEST_BEGIN(); benchmark_create_cond_var(); benchmark_destroy_cond_var(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); rtems_panic( "Dummy panic\n" ); rtems_test_assert(0); }
static void Init(rtems_task_argument arg) { TEST_BEGIN(); test_internal_error_text(); test_fatal_source_text(); test_status_text(); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { int status; pthread_t threadId; uint32_t end_time; struct sched_param param; int policy; TEST_BEGIN(); status = pthread_create( &threadId, NULL, Blocker, NULL ); rtems_test_assert( status == 0 ); status = pthread_mutex_init(&MutexID, NULL); rtems_test_assert( status == 0 ); status = pthread_cond_init(&CondID, NULL); /* Create condition variable */ rtems_test_assert( status == 0 ); /* * Let the other thread start so the thread startup overhead, * is accounted for. When we return, we can start the benchmark. */ sched_yield(); /* let other thread run */ /* To be extra sure we don't get preempted on the signal */ status = pthread_getschedparam(pthread_self(), &policy, ¶m); rtems_test_assert( status == 0); param.sched_priority = sched_get_priority_max(policy) - 1; status = pthread_setschedparam(pthread_self(), policy, ¶m); rtems_test_assert( status == 0); benchmark_timer_initialize(); status = pthread_cond_signal(&CondID); end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "pthread_cond_signal: thread waiting no preempt", end_time, 1, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
static void Init(rtems_task_argument arg) { TEST_BEGIN(); test_with_request_server(); test_with_request_self(); test_with_timeout(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { int error; uint32_t index; rtems_status_code status; rtems_printer_task_set_priority( &printer_task, 254 ); rtems_printer_task_set_file_descriptor( &printer_task, 1 ); rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] ); rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT ); rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE ); error = rtems_print_printer_task( &rtems_test_printer, &printer_task ); rtems_test_assert( error == 0 ); TEST_BEGIN(); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); for ( index = 1 ; index <= 6 ; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_FLOATING_POINT, &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); } for ( index = 1 ; index <= 6 ; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_6, index ); directive_failed( status, "rtems_task_start loop" ); } Count.count[ 1 ] = 0; Count.count[ 2 ] = 0; Count.count[ 3 ] = 0; Count.count[ 4 ] = 0; Count.count[ 5 ] = 0; Count.count[ 6 ] = 0; status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Init( rtems_task_argument argument ) { clock_t start; clock_t end; clock_t now; clock_t sc; clock_t difference; struct tms start_tm; struct tms end_tm; int interval = 5; TEST_BEGIN(); puts( "times( NULL ) -- EFAULT" ); sc = times( NULL ); rtems_test_assert( sc == -1 ); rtems_test_assert( errno == EFAULT ); puts( "_times_r( NULL, NULL ) -- EFAULT" ); start = _times_r( NULL, NULL ); rtems_test_assert( sc == -1 ); rtems_test_assert( errno == EFAULT ); while ( rtems_clock_get_ticks_since_boot() == 0 ) ; puts( "_times( &start_tm ) -- OK" ); now = _times( &start_tm ); rtems_test_assert( start != 0 ); rtems_test_assert( now != 0 ); rtems_test_spin_for_ticks( interval ); puts( "_times( &end_tm ) -- OK" ); end = _times( &end_tm ); rtems_test_assert( end != 0 ); puts( "Check various values" ); difference = end - start; rtems_test_assert( difference >= interval ); rtems_test_assert( end_tm.tms_utime - start_tm.tms_utime >= interval ); rtems_test_assert( end_tm.tms_stime - start_tm.tms_stime >= interval ); rtems_test_assert( end_tm.tms_cutime == 0 ); rtems_test_assert( end_tm.tms_cstime == 0 ); TEST_END(); rtems_test_exit(0); }
static rtems_task Init(rtems_task_argument argument) { mode_t omode = S_IRWXU | S_IRWXG | S_IRWXO; int rv = 0; TEST_BEGIN(); puts( "rtems_mkdir a - OK" ); test_mkdir("a", omode, 0); puts( "rtems_mkdir a/b - OK" ); test_mkdir("a/b", omode, 0); puts( "rtems_mkdir a/b/c/d/e/f/g/h/i - OK" ); test_mkdir("a/b/c/d/e/f/g/h/i", omode, 0); puts( "rtems_mkdir a/b/c - OK" ); test_mkdir("a/b/c", omode, 0); puts( "rtems_mkdir a/b/c/1 - OK" ); test_mkdir("a/b/c/1", 0, 0); puts( "rtems_mkdir a/b/c/2 - OK" ); test_mkdir("a/b/c/2", S_IRWXU, 0); puts( "rtems_mkdir a/b/c/3 - OK" ); test_mkdir("a/b/c/3", S_IRWXG, 0); puts( "rtems_mkdir a/b/c/4 - OK" ); test_mkdir("a/b/c/4", S_IRWXO, 0); puts( "rtems_mkdir a/b - OK" ); test_mkdir("a/b", omode, 0); puts( "rtems_mkdir a - OK" ); test_mkdir("a", omode, 0); puts( "rtems_mkdir a/b/x - OK" ); test_mkdir("a/b/x", S_IRUSR, 0); puts( "rtems_mkdir a/b/x/y - expect failure" ); test_mkdir("a/b/x/y", S_IRUSR, -1); puts( "mknod regular file a/n - OK" ); rv = mknod("a/n", S_IRWXU | S_IFREG, 0LL); puts( "rtems_mkdir a/n/b - expect failure" ); test_mkdir("a/n/b", S_IRUSR, -1); puts( "Create node b and open in RDONLY mode - OK" ); rv = open ("b", O_CREAT | O_RDONLY, omode); rtems_test_assert(rv >= 0); puts( "Closing b - OK" ); rv = close(rv); rtems_test_assert(rv == 0); puts( "rtems_mkdir b - expect failure" ); test_mkdir("b", omode, -1); rtems_test_assert(errno == EEXIST); TEST_END(); exit(0); }
rtems_task Init( rtems_task_argument argument ) { uint32_t index; rtems_status_code status; rtems_id rmid; rtems_name period; TEST_BEGIN(); period = rtems_build_name( 'I', 'G', 'N', 'R' ); status = rtems_rate_monotonic_create( period, &rmid ); directive_failed( status, "rtems_rate_monotonic_create" ); printf( "INIT - rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id " (stays inactive)\n", rmid ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); for ( index = 1 ; index <= 5 ; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], RTEMS_MINIMUM_STACK_SIZE * 4, RTEMS_DEFAULT_MODES, (index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); } for ( index = 1 ; index <= 5 ; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_5, index ); directive_failed( status, "rtems_task_start loop" ); } Count.count[ 1 ] = 0; Count.count[ 2 ] = 0; Count.count[ 3 ] = 0; Count.count[ 4 ] = 0; Count.count[ 5 ] = 0; status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend of RTEMS_SELF" ); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); puts( "devFS_Show" ); devFS_Show(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument ignored ) { TEST_BEGIN(); test_untar_from_memory(); puts( "" ); test_untar_from_file(); TEST_END(); exit( 0 ); }
static void Init(rtems_task_argument arg) { TEST_BEGIN(); test_data_flush_and_invalidate(); test_timing(); test_cache_aligned_alloc(); test_cache_coherent_alloc(); TEST_END(); rtems_test_exit(0); }
static void Init(rtems_task_argument arg) { test_context *self = &test_instance; TEST_BEGIN(); test_context_is_executing(); test(self); TEST_END(); rtems_test_exit(0); }
void test_matrix(void) { SECTION_BEGIN("Matrix Math"); TEST_BEGIN("Quaternion Conversion"); mat4 m; quaternion q; mat4_identity(m); mat4_to_quaternion(m, q); vec4_print(q); //TODO: assert q = (0,0,0,1); TEST_END("Quaternion Conversion"); SECTION_END("Matrix Math"); }
void test_str(void) { SECTION_BEGIN("str"); str s; str_init(&s, "Some long text or something"); TEST_BEGIN("find string"); assert(str_find_cstr(&s, "or") == 15); str_reset(&s, "some other string 1232 and stuffy"); assert(str_find_cstr(&s, " 12") == 17); assert(str_find_cstr(&s, "stringy") == -1); TEST_END("find string"); SECTION_END("str"); }
void *POSIX_Init( void *argument ) { TEST_BEGIN(); benchmark_pthread_getschedparam(); benchmark_pthread_setschedparam(); TEST_END(); rtems_test_exit(0); }
static void Init(rtems_task_argument arg) { TEST_BEGIN(); if (rtems_get_processor_count() == CPU_COUNT) { test(); } else { puts("warning: wrong processor count to run the test"); } TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); puts( "putenv(\"FOO=BAR\") - expected to work" ); putenv ("FOO=BAR"); printf ("getenv(\"FOO\") ==> \"%s\"\n", getenv ("FOO")); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { TEST_BEGIN(); pthread_cond_init(&CondID, NULL); benchmark_signal(); TEST_END(); rtems_test_exit(0); }
static rtems_task Init( rtems_task_argument argument ) { rtems_task_priority prio; rtems_status_code status; TEST_BEGIN(); Master = rtems_task_self(); if (RTEMS_MAXIMUM_PRIORITY >= 255) Priorities = Priorities_High; else if (RTEMS_MAXIMUM_PRIORITY >= 15) Priorities = Priorities_Low; else { puts( "Test needs at least 16 configured priority levels" ); rtems_test_exit( 0 ); } prio = RTEMS_MAXIMUM_PRIORITY - 1; status = rtems_task_set_priority(RTEMS_SELF, prio, &prio); directive_failed( status, "rtems_task_set_priority" ); if ( sizeof(Priorities_Low) / sizeof(rtems_task_priority) != MAX_TASKS ) { puts( "Priorities_Low table does not have right number of entries" ); rtems_test_exit( 0 ); } if ( sizeof(Priorities_High) / sizeof(rtems_task_priority) != MAX_TASKS ) { puts( "Priorities_High table does not have right number of entries" ); rtems_test_exit( 0 ); } puts( "Exercising blocking discipline w/extract in FIFO order " ); do_test( RTEMS_FIFO, TRUE ); puts( "Exercising blocking discipline w/unblock in FIFO order" ); do_test( RTEMS_FIFO, FALSE ); rtems_test_pause_and_screen_number( 2 ); puts( "Exercising blocking discipline w/extract in priority order " ); do_test( RTEMS_PRIORITY, TRUE ); puts( "Exercising blocking discipline w/unblock in priority order" ); do_test( RTEMS_PRIORITY, FALSE ); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { int i; int status; pthread_t threadId; pthread_rwlockattr_t attr; TEST_BEGIN(); for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { status = pthread_create( &threadId, NULL, Middle, NULL ); rtems_test_assert( !status ); } status = pthread_create( &threadId, NULL, Low, NULL ); rtems_test_assert( !status ); /* * Timeout for 5 seconds from now. */ status = clock_gettime( CLOCK_REALTIME, &abstime ); rtems_test_assert( !status ); abstime.tv_sec += 5; /* * Deliberately create the rwlock after the threads. This way if the * threads do run before we intend, they will get an error. */ status = pthread_rwlockattr_init( &attr ); rtems_test_assert( status == 0 ); status = pthread_rwlock_init( &rwlock, &attr ); rtems_test_assert( status == 0 ); /* * Let the other threads start so the thread startup overhead, * is accounted for. When we return, we can start the benchmark. */ sched_yield(); /* let other threads run */ /* start the timer and switch through all the other tasks */ benchmark_timer_initialize(); /* write lock operation, this could be any write lock * I decided to use timedwrlock just to continue in the timed line */ status = pthread_rwlock_timedwrlock(&rwlock,0); rtems_test_assert( status == 0 ); return NULL; }
rtems_task Init( rtems_task_argument ignored ) { pthread_key_t key1, key2; int sc, *value; int Data_array[2] = {1, 2}; TEST_BEGIN(); puts( "Init - pthread key1 create - OK" ); sc = pthread_key_create( &key1, NULL ); rtems_test_assert( !sc ); puts( "Init - pthread key2 create - OK" ); sc = pthread_key_create( &key2, NULL ); rtems_test_assert( !sc ); puts( "Init - key1 pthread_setspecific - OK" ); sc = pthread_setspecific( key1, &Data_array[0] ); rtems_test_assert( !sc ); puts( "Init - key2 pthread_setspecific - OK" ); sc = pthread_setspecific( key2, &Data_array[1] ); rtems_test_assert( !sc ); puts( "Init - key1 pthread_getspecific - OK" ); value = pthread_getspecific( key1 ); rtems_test_assert( *value == Data_array[0] ); puts( "Init - key2 pthread_getspecific - OK" ); value = pthread_getspecific( key2 ); rtems_test_assert( *value == Data_array[1] ); puts( "Init - key1 pthread_setspecific - OK" ); sc = pthread_setspecific( key1, &Data_array[1] ); rtems_test_assert( !sc ); puts( "Init - key1 pthread_getspecific - OK" ); value = pthread_getspecific( key1 ); rtems_test_assert( *value == Data_array[1] ); puts( "Init - pthread key1 delete - OK" ); sc = pthread_key_delete( key1 ); rtems_test_assert( sc == 0 ); puts( "Init - pthread key2 delete - OK" ); sc = pthread_key_delete( key2 ); rtems_test_assert( sc == 0 ); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init(void *argument) { int status; pthread_t threadId; benchmark_timer_t end_time; TEST_BEGIN(); status = pthread_create( &threadId, NULL, Blocker, NULL ); rtems_test_assert( status == 0 ); /* * Deliberately create the semaphore after the threads. This way if the * threads do run before we intend, they will get an error. */ status = sem_init( &sem1, 0, 1 ); rtems_test_assert( status == 0 ); /* * Ensure the semaphore is unavailable so the other threads block. * Lock semaphore resource to ensure thread blocks. */ status = sem_wait(&sem1); rtems_test_assert( status == 0 ); /* * Let the other thread start so the thread startup overhead, * is accounted for. When we return, we can start the benchmark. */ sched_yield(); /* let other thread run */ benchmark_timer_initialize(); status = sem_post( &sem1 ); /* semaphore unblocking operation */ end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "sem_post: thread waiting no preempt", end_time, 1, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
void *POSIX_Init( void *argument ) { TEST_BEGIN(); test_mutex_create(); test_mutex_destroy(); TEST_END(); rtems_test_exit(0); }
static void Init(rtems_task_argument arg) { TEST_BEGIN(); test_with_normal_and_system_event(); test_with_timeout(); test_with_invalid_receiver(); test_with_invalid_address(); test_get_pending_events(); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { char name[128]; char *ptr; rtems_status_code status; TEST_BEGIN(); ptr = rtems_object_get_name( pthread_self(), 128, name ); printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); /* Set my name to Justin */ puts( "Setting current thread name to Justin" ); status = rtems_object_set_name( pthread_self(), "Justin" ); directive_failed( status, "rtems_object_set_name" ); ptr = rtems_object_get_name( pthread_self(), 128, name ); printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); /* Set my name to Jordan */ puts( "Setting current thread name to Jordan" ); status = rtems_object_set_name( pthread_self(), "Jordan" ); directive_failed( status, "rtems_object_set_name" ); ptr = rtems_object_get_name( pthread_self(), 128, name ); printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); /* exercise the POSIX path through some routines */ printf( "rtems_object_api_minimum_class(OBJECTS_POSIX_API) returned %d\n", rtems_object_api_minimum_class(OBJECTS_POSIX_API) ); printf( "rtems_object_api_maximum_class(OBJECTS_POSIX_API) returned %d\n", rtems_object_api_maximum_class(OBJECTS_POSIX_API) ); printf( "rtems_object_get_api_name(POSIX_API) = %s\n", rtems_object_get_api_name(OBJECTS_POSIX_API) ); printf("rtems_object_get_api_class_name(POSIX_API, POSIX_KEYS) = %s\n", rtems_object_get_api_class_name( OBJECTS_POSIX_API, OBJECTS_POSIX_KEYS) ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
void *POSIX_Init( void *argument ) { int i; int status; pthread_t threadId; pthread_barrierattr_t attr; TEST_BEGIN(); for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { status = pthread_create( &threadId, NULL, Middle, NULL ); rtems_test_assert( !status ); } status = pthread_create( &threadId, NULL, Low, NULL ); rtems_test_assert( !status ); /* * Create the barrier with default attributes and deliberately * create it after the Threads so if they run too early, they * wull fail with an error. */ status = pthread_barrierattr_init( &attr ); rtems_test_assert( status == 0 ); /* * Set threshold on count higher than number of threads so all will * block. */ status = pthread_barrier_init( &barrier,&attr, OPERATION_COUNT + 2 ); rtems_test_assert( status == 0 ); /* * Let other threads run through their initialization */ sched_yield(); /* * Start the timer and start the blocking barrier wait chain through * all the other tasks. */ benchmark_timer_initialize(); /* blocking barrier call */ status = pthread_barrier_wait( &barrier ); rtems_test_assert( status == 0 ); return NULL; }