source: rtems/testsuites/sptests/spobjgetnext/init.c @ 072d2a09

4.104.115
Last change on this file since 072d2a09 was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/09 at 14:39:46

2009-05-10 Joel Sherrill <joel.sherrill@…>

  • 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.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Exercise SuperCore Object Get Next
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#define CONFIGURE_INIT
15#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
16#include "system.h"
17
18/* prototypes */
19int scan_objects(
20  Objects_Information *information,
21  Objects_Id           start
22);
23
24#define MAX_SCAN 10
25
26int scan_objects(
27  Objects_Information *information,
28  Objects_Id           start
29)
30{
31  Objects_Control  *o[MAX_SCAN];
32  int               i;
33  Objects_Locations location;
34  Objects_Id        id;
35
36  memset( o, 1, sizeof(o) );
37
38  id = start;
39  for (i=0 ; i<MAX_SCAN ; i++ ) {
40    o[i] = _Objects_Get_next(
41      information,
42      id,
43      &location,
44      &id
45    );
46    if ( !o[i] )
47      break;
48    if ( location == OBJECTS_ERROR )
49      break;
50    /* XXX check dispatch level with macros */
51
52    _Thread_Enable_dispatch();
53
54    /* XXX should be able to check that next Id is not one we have seen */
55  }
56  return i;
57
58
59rtems_task Init(
60  rtems_task_argument argument
61)
62{
63  rtems_status_code     status;
64  rtems_id              main_task;
65  int                   count;
66
67  puts( "\n\n*** TEST OBJECT GET NEXT ***" );
68
69  main_task = rtems_task_self();
70
71  /* XXX push the three NULL error cases */
72
73  /* simple case of only all tasks in the system, starting at initial */
74  count = scan_objects( &_RTEMS_tasks_Information, OBJECTS_ID_INITIAL_INDEX );
75  printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
76  assert( count == 1 );
77
78  /* simple case of only 1 task in the system, starting at that task */
79  count = scan_objects( &_RTEMS_tasks_Information, main_task );
80  printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
81  assert( count == 1 );
82
83  /* XXX create >= 1 task and make sure the counts are correct when */
84  /* XXX you start the search at initial, first id, arbitrary id */
85
86  /* XXX try with a manager with no objects created */
87
88  puts( "*** END OF TEST OBJECT GET NEXT ***" );
89  rtems_test_exit( 0 );
90}
Note: See TracBrowser for help on using the repository browser.