Files
rtems/testsuites/sptests/spobjgetnext/init.c
Joel Sherrill b84f1fdc0d 2009-05-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c,
	sp12/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c,
	sp15/init.c, sp16/system.h, sp19/fptask.c, sp25/system.h,
	sp26/task1.c, sp27/init.c, sp28/init.c, sp29/init.c, sp31/task1.c,
	sp33/init.c, sp34/changepri.c, sp35/priinv.c, sp37/init.c,
	sp38/init.c, sp39/init.c, sp41/init.c, sp42/init.c, sp43/init.c,
	sp44/init.c, sp45/init.c, sp46/init.c, sp47/init.c, sp48/init.c,
	spfatal03/testcase.h, spfatal05/testcase.h, spfatal06/testcase.h,
	spfatal_support/system.h, spobjgetnext/init.c, spsize/getint.c,
	spsize/size.c: Fix warnings.
2009-05-10 14:39:46 +00:00

91 lines
2.1 KiB
C

/*
* Exercise SuperCore Object Get Next
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define CONFIGURE_INIT
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
#include "system.h"
/* prototypes */
int scan_objects(
Objects_Information *information,
Objects_Id start
);
#define MAX_SCAN 10
int scan_objects(
Objects_Information *information,
Objects_Id start
)
{
Objects_Control *o[MAX_SCAN];
int i;
Objects_Locations location;
Objects_Id id;
memset( o, 1, sizeof(o) );
id = start;
for (i=0 ; i<MAX_SCAN ; i++ ) {
o[i] = _Objects_Get_next(
information,
id,
&location,
&id
);
if ( !o[i] )
break;
if ( location == OBJECTS_ERROR )
break;
/* XXX check dispatch level with macros */
_Thread_Enable_dispatch();
/* XXX should be able to check that next Id is not one we have seen */
}
return i;
}
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_id main_task;
int count;
puts( "\n\n*** TEST OBJECT GET NEXT ***" );
main_task = rtems_task_self();
/* XXX push the three NULL error cases */
/* simple case of only all tasks in the system, starting at initial */
count = scan_objects( &_RTEMS_tasks_Information, OBJECTS_ID_INITIAL_INDEX );
printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
assert( count == 1 );
/* simple case of only 1 task in the system, starting at that task */
count = scan_objects( &_RTEMS_tasks_Information, main_task );
printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
assert( count == 1 );
/* XXX create >= 1 task and make sure the counts are correct when */
/* XXX you start the search at initial, first id, arbitrary id */
/* XXX try with a manager with no objects created */
puts( "*** END OF TEST OBJECT GET NEXT ***" );
rtems_test_exit( 0 );
}