rtems_task Low_task( rtems_task_argument argument ) { end_time = benchmark_timer_read(); put_time( "rtems_task_wake_when: only case", end_time, operation_count, 0, CALLING_OVERHEAD_TASK_WAKE_WHEN ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task Last_task( rtems_task_argument argument ) { end_time = benchmark_timer_read(); put_time( "rtems_task_delete: calling task", end_time, OPERATION_COUNT, 0, CALLING_OVERHEAD_TASK_DELETE ); puts( "*** END OF TEST 18 ***" ); rtems_test_exit( 0 ); }
static void Init(rtems_task_argument arg) { rtems_resource_snapshot snapshot; TEST_BEGIN(); rtems_resource_snapshot_take(&snapshot); if (rtems_get_processor_count() == CPU_COUNT) { test(); } rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); TEST_END(); rtems_test_exit(0); }
void *Task_1_through_3( void *argument ) { int status; puts( "Task_1: sched_yield to Init" ); status = sched_yield(); rtems_test_assert( !status ); /* switch to Task_1 */ /* now do some real testing */ empty_line(); /* get id of this thread */ Task_id = pthread_self(); printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id ); /* exercise pthread_equal */ status = pthread_equal( Task_id, Task_id ); if ( status ) puts( "Task_1: pthread_equal - match case passed" ); rtems_test_assert( status ); status = pthread_equal( Init_id, Task_id ); if ( !status ) puts( "Task_1: pthread_equal - different case passed" ); rtems_test_assert( !status ); puts( "Task_1: pthread_equal - first id bad" ); status = pthread_equal( (pthread_t) -1, Task_id ); rtems_test_assert( !status ); puts( "Task_1: pthread_equal - second id bad" ); status = pthread_equal( Init_id, (pthread_t) -1 ); rtems_test_assert( !status ); TEST_END(); rtems_test_exit( 0 ); return NULL; /* just so the compiler thinks we returned something */ }
rtems_task Low_task( rtems_task_argument argument ) { end_time = benchmark_timer_read(); put_time( "rtems_semaphore_obtain: not available caller blocks", end_time, operation_count - 1, 0, CALLING_OVERHEAD_SEMAPHORE_OBTAIN ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task Init( rtems_task_argument argument ) { uint32_t i; char ch; uint32_t cpu_num; rtems_id id; rtems_status_code status; TEST_BEGIN(); locked_print_initialize(); for ( killtime=0; killtime<1000000; killtime++ ) ; for ( i=0; i<rtems_get_processor_count() -1; i++ ) { ch = '1' + i; status = rtems_task_create( rtems_build_name( 'T', 'A', ch, ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "task create" ); cpu_num = rtems_get_current_processor(); locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch); status = rtems_task_start( id, Test_task, i+1 ); directive_failed( status, "task start" ); } locked_printf(" kill 10 clock ticks\n" ); while ( rtems_clock_get_ticks_since_boot() < 10 ) ; rtems_cpu_usage_report(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); do_putk(); putk(""); do_printk(); putk(""); do_getchark(); TEST_END(); rtems_test_exit( 0 ); }
static void Init(rtems_task_argument arg) { int sc; TEST_BEGIN(); /* Initialize thread id */ sc = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &Init_id ); directive_failed( sc, "Identify Init Task" ); Validate_setaffinity_errors(); Validate_getaffinity_errors(); Validate_affinity(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { puts( "\n\n*** HEAP WALK TEST ***" ); test_system_not_up(); test_check_control(); test_check_free_list(); test_freshly_initialized(); test_main_loop(); test_check_free_block(); test_output(); puts( "*** END OF HEAP WALK TEST ***" ); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { void *p1; bool retbool; Heap_Information_block info; puts( "\n\n*** TEST WORKSPACE CLASSIC API ***" ); puts( "rtems_workspace_get_information - null pointer" ); retbool = rtems_workspace_get_information( NULL ); rtems_test_assert( retbool == false ); puts( "rtems_workspace_get_information - OK" ); retbool = rtems_workspace_get_information( &info ); rtems_test_assert( retbool == true ); puts( "rtems_workspace_allocate - null pointer" ); retbool = rtems_workspace_allocate( 42, NULL ); rtems_test_assert( retbool == false ); puts( "rtems_workspace_allocate - 0 bytes" ); retbool = rtems_workspace_allocate( 0, &p1 ); rtems_test_assert( retbool == false ); puts( "rtems_workspace_allocate - too many bytes" ); retbool = rtems_workspace_allocate( info.Free.largest * 2, &p1 ); rtems_test_assert( retbool == false ); puts( "rtems_workspace_allocate - 42 bytes" ); retbool = rtems_workspace_allocate( 42, &p1 ); rtems_test_assert( retbool == true ); rtems_test_assert( p1 != NULL ); puts( "rtems_workspace_free - NULL" ); retbool = rtems_workspace_free( NULL ); rtems_test_assert( retbool == false ); puts( "rtems_workspace_free - previous pointer to 42 bytes" ); retbool = rtems_workspace_free( p1 ); rtems_test_assert( retbool == true ); puts( "*** END OF TEST WORKSPACE CLASSIC API ***" ); rtems_test_exit( 0 ); }
rtems_task Low_task( rtems_task_argument argument ) { end_time = benchmark_timer_read(); put_time( "rtems_message_queue_receive: not available caller blocks", end_time, operation_count - 1, 0, CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE ); puts( "*** END OF TEST 10 ***" ); rtems_test_exit( 0 ); }
rtems_task Init( rtems_task_argument argument ) { int i; puts( "\n\n*** TEST DUMPBUF01 ***" ); for ( i = 0 ; i < sizeof(Buffer) ; i++ ) { do_test( i ); } do_test( -1 ); puts( "*** END OF TEST DUMPBUF01 ***" ); rtems_test_exit(0); }
static void inversion_task(rtems_task_argument arg) { test_context *ctx = &test_instance; /* * Here we see that the priority of the high priority task blocked on * semaphore B doesn't propagate to the low priority task owning semaphore A * on which the owner of semaphore B depends. */ assert_prio(ctx->low, 3); assert_prio(ctx->mid, 1); assert_prio(ctx->high, 1); assert_prio(ctx->inversion, 2); TEST_END(); rtems_test_exit(0); }
void *POSIX_Init( rtems_task_argument argument ) { int status; puts( "\n\n*** POSIX TEST SIGNAL 06 ***" ); puts( "Init: pthread_cond_init - OK" ); status = pthread_cond_init( &CondVarId, NULL ); rtems_test_assert( !status ); puts( "Init: pthread_mutex_init - OK" ); status = pthread_mutex_init( &MutexId, NULL ); rtems_test_assert( !status ); puts( "Init: pthread_create - OK" ); status = pthread_create( &ThreadId, NULL, TestThread, NULL ); rtems_test_assert( !status ); sleep( 1 ); /* let TestThread run */ puts( "Init: pthread_kill - SIGUSR to Test Thread - OK" ); status = pthread_kill( ThreadId, SIGUSR1 ); rtems_test_assert( !status ); sleep( 2 ); /* let TestThread run */ puts( "Init: pthread_kill - SIGUSR to Test Thread - OK" ); status = pthread_kill( ThreadId, SIGUSR1 ); rtems_test_assert( !status ); sleep( 1 ); /* let TestThread run */ puts( "*** END OF POSIX TEST SIGNAL 06 ***" ); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code status; rtems_id task_id; puts( "\n\n*** TEST 46 ***" ); /* * Initialize Tasks */ puts( "INIT - rtems_task_create - creating task 1" ); status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); directive_failed( status, "rtems_task_create of TA1" ); puts( "INIT - rtems_task_start - TA1 " ); status = rtems_task_start( task_id, Periodic_Task, 0 ); directive_failed( status, "rtems_task_start of TA1" ); while ( !partial_loop ) { status = rtems_task_wake_after( 2 ); directive_failed( status, "rtems_task_wake_after" ); } rtems_cpu_usage_reset(); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); /* * Exit test */ puts( "*** END OF TEST 46 *** " ); rtems_test_exit( 0 ); }
void *POSIX_Init( void *ignored ) { pthread_key_t key1, key2; int sc, *value; int Data_array[2] = {1, 2}; puts( "\n\n*** TEST KEY 05 ***" ); 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 - 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 ); puts( "*** END OF TEST KEY 05 ***" ); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code sc; rtems_id timer1; struct timespec uptime; TEST_BEGIN(); sc = rtems_timer_initiate_server( 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( sc, "rtems_timer_initiate_server" ); sc = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &timer1); directive_failed( sc, "rtems_timer_create" ); Fired = 0; timerRan = false; Timer_Routine(timer1, NULL); while (1) { sc = rtems_task_wake_after( 10 ); directive_failed( sc, "rtems_task_wake_after" ); if ( timerRan == true ) { timerRan = false; sc = rtems_clock_get_uptime( &uptime ); directive_failed( sc, "rtems_clock_get_uptime" ); printf( "Timer fired at %" PRIdtime_t "\n", uptime.tv_sec ); } if ( Fired >= 10 ) { TEST_END(); rtems_test_exit( 0 ); } /* technically the following is a critical section */ } }
static void Init(rtems_task_argument ignored) { test_context *ctx = &ctx_instance; rtems_status_code sc; TEST_BEGIN(); ctx->master_task = rtems_task_self(); sc = rtems_semaphore_create( rtems_build_name('S', 'E', 'M', 'A'), 1, RTEMS_COUNTING_SEMAPHORE, 0, &ctx->semaphore_id ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_create( rtems_build_name('S', 'E', 'M', 'A'), PRIORITY_SEMAPHORE, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->semaphore_task ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_start( ctx->semaphore_task, semaphore_task, (rtems_task_argument) ctx ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); interrupt_critical_section_test(test_body, ctx, release_semaphore); rtems_test_assert(ctx->thread_queue_was_null); rtems_test_assert(ctx->status_was_successful); rtems_test_assert(ctx->status_was_timeout); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { int i; char ch; int cpu_num; rtems_id id; rtems_status_code status; locked_print_initialize(); locked_printf( "\n\n*** TEST SMP09 ***\n" ); for ( killtime=0; killtime<1000000; killtime++ ) ; for ( i=0; i<rtems_smp_get_number_of_processors() -1; i++ ) { ch = '1' + i; status = rtems_task_create( rtems_build_name( 'T', 'A', ch, ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "task create" ); cpu_num = bsp_smp_processor_id(); locked_printf(" CPU %d start task TA%c\n", cpu_num, ch); status = rtems_task_start( id, Test_task, i+1 ); directive_failed( status, "task start" ); } locked_printf(" kill 10 clock ticks\n" ); while ( rtems_clock_get_ticks_since_boot() < 10 ) ; rtems_cpu_usage_report(); locked_printf( "*** END OF TEST SMP09 ***" ); rtems_test_exit(0); }
static void Init(rtems_task_argument arg) { rtems_resource_snapshot snapshot; TEST_BEGIN(); rtems_resource_snapshot_take(&snapshot); test_task_get_set_affinity(); test_task_get_set_scheduler(); test_scheduler_ident(); test_scheduler_get_processors(); rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); TEST_END(); rtems_test_exit(0); }
rtems_task Task_2( rtems_task_argument argument ) { while ( !testsFinished ); showTaskSwitches (); puts( "" ); rtems_cpu_usage_report(); puts( "" ); puts( "TA2 - RESETTING USAGE STATISTICS" ); rtems_cpu_usage_reset(); puts( "" ); rtems_cpu_usage_report(); puts( "" ); puts( "*** END OF CPU USAGE LIBRARY TEST ***" ); rtems_test_exit( 0 ); }
void check_isr_worked( char *s, int result ) { switch (result) { case -1: printf( "isr_in_progress(%s) timer did not fire\n", s ); break; case 1: printf( "isr_in_progress(%s) from ISR -- OK\n", s ); break; case 2: printf( "isr_in_progress(%s) from ISR -- returned bad value\n", s); rtems_test_exit(0); break; } }
rtems_task test_asr(rtems_task_argument unused) { rtems_mode mode; rtems_task_mode(0, RTEMS_CURRENT_MODE, &mode); if ( (mode & RTEMS_NO_ASR) == 0 ) { puts( "ERROR - disable ASR not honored" ); printf( "mode = 0x%08" PRIXrtems_mode " asr = %s\n", mode, (mode & RTEMS_NO_ASR) ? "OFF" : "ON" ); } else puts( "Creating task with ASR disable mode honored" ); puts( "*** END OF TEST 47 ***" ); rtems_test_exit( 0 ); }
rtems_task Init(rtems_task_argument ignored) { static rtems_status_code status; TEST_BEGIN(); /* Create Task A */ status = rtems_task_create( TASK_A_NAME, TASK_A_PRIORITY, TASK_A_STACKSIZE, TASK_A_INITMODE, TASK_A_MODEATTR, &TaskA_id ); directive_failed(status,"rtems_task_create"); /* Start Task A */ status = rtems_task_start(TaskA_id, TaskAB_entry, 0); directive_failed(status,"rtems_task_start"); /* Create Task B */ status = rtems_task_create( TASK_B_NAME, TASK_B_PRIORITY, TASK_B_STACKSIZE, TASK_B_INITMODE, TASK_B_MODEATTR, &TaskB_id ); directive_failed( status, "rtems_task_create" ); /* Start Task B */ status = rtems_task_start(TaskB_id, TaskAB_entry, 1); directive_failed( status, "rtems_task_start" ); /* Suspend itself */ status = rtems_task_suspend(RTEMS_SELF); directive_failed( status, "rtems_task_suspend" ); /* This task is not suposed to be executed anymore */ printf("\nNOT SUPOSED TO RETURN HERE...\n"); rtems_test_exit(1); }
rtems_task Init( rtems_task_argument argument ) { rtems_time_of_day time; rtems_status_code status; TEST_BEGIN(); test_watchdog_static_init(); build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); status = rtems_task_create( Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); directive_failed( status, "rtems_task_start of TA1" ); puts( "INIT - rtems_timer_create - creating timer 1" ); status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_create" ); printf( "INIT - timer 1 has id (0x%" PRIxrtems_id ")\n", Timer_id[ 1 ] ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); rtems_test_exit( 0 ); }
rtems_task Init( rtems_task_argument ignored ) { TEST_BEGIN(); test_rtems_string_to_pointer(); test_rtems_string_to_unsigned_char(); test_rtems_string_to_int(); test_rtems_string_to_unsigned_int(); test_rtems_string_to_long(); test_rtems_string_to_unsigned_long(); test_rtems_string_to_long_long(); test_rtems_string_to_unsigned_long_long(); test_rtems_string_to_float(); test_rtems_string_to_double(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); pppasyncattach(); open_it(); set_wakeups(); set_discipline(); write_it(); ioctl_it(); read_it(); close_it(); TEST_END(); rtems_test_exit(0); }
rtems_task Task_3( rtems_task_argument argument ) { (void) rtems_task_suspend( RTEMS_SELF ); end_time = benchmark_timer_read(); put_time( "exit ASR overhead: returns to preempting task", end_time, 1, 0, 0 ); puts( "*** END OF TEST 19 ***" ); rtems_test_exit( 0 ); }
rtems_task Init( rtems_task_argument ignored ) { void *tmp; puts( "\n\n*** TEST 41 ***" ); puts( "Init - overwrite internal value to trip case" ); tmp = _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ]; _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = NULL; puts( "Init - rtems_iterate_over_all_threads" ); rtems_iterate_over_all_threads(iterator); _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = tmp; puts( "*** END OF TEST 41 ***" ); rtems_test_exit(0); }
void *POSIX_Init( void *argument ) { TEST_BEGIN(); rtems_time_test_measure_operation( "pthread_create: no preempt", benchmark_pthread_create, NULL, 1, 0 ); TEST_END(); rtems_test_exit(0); }