Changeset 6f67619 in rtems


Ignore:
Timestamp:
Jul 6, 2010, 10:27:23 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
66e5e144
Parents:
39507635
Message:

2010-07-06 Joel Sherrill <joel.sherrilL@…>

  • sp21/Makefile.am, sp21/init.c, sp21/sp21.scn: Add rtems_io_lookup_name() and simplify test.
  • sp21/system.h, sp21/task1.c: Removed.
Location:
testsuites/sptests
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/ChangeLog

    r39507635 r6f67619  
     12010-07-06      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        * sp21/Makefile.am, sp21/init.c, sp21/sp21.scn: Add
     4        rtems_io_lookup_name() and simplify test.
     5        * sp21/system.h, sp21/task1.c: Removed.
     6
    172010-07-05      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • testsuites/sptests/sp21/Makefile.am

    r39507635 r6f67619  
    33##
    44
    5 MANAGERS = io semaphore clock
    6 
    75rtems_tests_PROGRAMS = sp21
    8 sp21_SOURCES = init.c task1.c system.h
     6sp21_SOURCES = init.c
    97
    108dist_rtems_tests_DATA = sp21.scn
     
    1412include $(top_srcdir)/../automake/compile.am
    1513include $(top_srcdir)/../automake/leaf.am
    16 
    17 sp21_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
    1814
    1915AM_CPPFLAGS += -I$(top_srcdir)/../support/include
  • testsuites/sptests/sp21/init.c

    r39507635 r6f67619  
    1 /*  Init
    2  *
    3  *  This routine is the initialization task for this test program.
    4  *  It is a user initialization task and has the responsibility for creating
    5  *  and starting the tasks that make up the test.  If the time of day
    6  *  clock is required for the test, it should also be set to a known
    7  *  value by this function.
    8  *
    9  *  Input parameters:
    10  *    argument - task argument
    11  *
    12  *  Output parameters:  NONE
    13  *
    14  *  COPYRIGHT (c) 1989-1999.
     1/*
     2 *  COPYRIGHT (c) 1989-2010.
    153 *  On-Line Applications Research Corporation (OAR).
    164 *
     
    2210 */
    2311
    24 #define CONFIGURE_INIT
    25 #include "system.h"
     12#include <tmacros.h>
     13#include <rtems/devnull.h>
     14
     15
     16#define PRIurtems_device_major_number PRIu32
     17
     18#define STUB_DRIVER_MAJOR     0x2
     19#define NO_DRIVER_MAJOR       0x3
     20#define INVALID_DRIVER_MAJOR  \
     21     (rtems_configuration_get_number_of_device_drivers() + 1)
     22
     23/* driver entries to use with io_register */
     24rtems_driver_address_table GoodDriver = DEVNULL_DRIVER_TABLE_ENTRY;
     25rtems_driver_address_table BadDriver_Nothing = {
     26  NULL, NULL, NULL, NULL, NULL, NULL
     27};
     28
     29void do_test_io_manager(void)
     30{
     31  rtems_status_code         status;
     32  rtems_device_major_number registered;
     33  rtems_device_major_number registered_worked;
     34
     35  puts( "-----  TESTING THE NULL DRIVER CHECKS  -----" );
     36
     37  status = rtems_io_initialize( NO_DRIVER_MAJOR, 0, NULL );
     38  directive_failed( status, "rtems_io_initialize" );
     39  puts( "rtems_io_initialize  - NULL DRIVER RTEMS_SUCCESSFUL" );
     40
     41  status = rtems_io_open( NO_DRIVER_MAJOR, 0, NULL );
     42  directive_failed( status, "rtems_io_open" );
     43  puts( "rtems_io_open        - NULL DRIVER RTEMS_SUCCESSFUL" );
     44
     45  status = rtems_io_close( NO_DRIVER_MAJOR, 0, NULL );
     46  directive_failed( status, "rtems_io_close" );
     47  puts( "rtems_io_close       - NULL DRIVER RTEMS_SUCCESSFUL" );
     48
     49  status = rtems_io_read( NO_DRIVER_MAJOR, 0, NULL );
     50  directive_failed( status, "rtems_io_read" );
     51  puts( "rtems_io_read        - NULL DRIVER RTEMS_SUCCESSFUL" );
     52
     53  status = rtems_io_write( NO_DRIVER_MAJOR, 0, NULL );
     54  directive_failed( status, "rtems_io_write" );
     55  puts( "rtems_io_write       - NULL DRIVER RTEMS_SUCCESSFUL" );
     56
     57  status = rtems_io_control( NO_DRIVER_MAJOR, 0, NULL );
     58  directive_failed( status, "rtems_io_control" );
     59  puts( "rtems_io_control     - NULL DRIVER RTEMS_SUCCESSFUL" );
     60
     61  puts( "-----  TESTING THE I/O MANAGER DIRECTIVES  -----" );
     62
     63  status = rtems_io_initialize( STUB_DRIVER_MAJOR, 0, NULL );
     64  directive_failed( status, "rtems_io_initialize" );
     65  puts( "rtems_io_initialize  - STUB DRIVER RTEMS_SUCCESSFUL" );
     66
     67  status = rtems_io_open( STUB_DRIVER_MAJOR, 0, NULL );
     68  directive_failed( status, "rtems_io_open" );
     69  puts( "rtems_io_open        - STUB DRIVER RTEMS_SUCCESSFUL" );
     70
     71  status = rtems_io_close( STUB_DRIVER_MAJOR, 0, NULL );
     72  directive_failed( status, "rtems_io_close" );
     73  puts( "rtems_io_close       - STUB DRIVER RTEMS_SUCCESSFUL" );
     74
     75  status = rtems_io_read( STUB_DRIVER_MAJOR, 0, NULL );
     76  directive_failed( status, "rtems_io_read" );
     77  puts( "rtems_io_read        - STUB DRIVER RTEMS_SUCCESSFUL" );
     78
     79  status = rtems_io_write( STUB_DRIVER_MAJOR, 0, NULL );
     80  directive_failed( status, "rtems_io_write" );
     81  puts( "rtems_io_write       - STUB DRIVER RTEMS_SUCCESSFUL" );
     82
     83  status = rtems_io_control( STUB_DRIVER_MAJOR, 0, NULL );
     84  directive_failed( status, "rtems_io_control" );
     85  puts( "rtems_io_control     - STUB DRIVER RTEMS_SUCCESSFUL" );
     86
     87  /*
     88   *  Invalid major number
     89   */
     90  puts( "-----  RETURNING INVALID MAJOR NUMBER -----" );
     91
     92  status = rtems_io_initialize( INVALID_DRIVER_MAJOR, 0, NULL );
     93  fatal_directive_status(
     94    status,
     95    RTEMS_INVALID_NUMBER,
     96    "rtems_io_initialize"
     97  );
     98  puts( "rtems_io_initialize  - RTEMS_INVALID_NUMBER" );
     99
     100  status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL );
     101  fatal_directive_status(
     102    status,
     103    RTEMS_INVALID_NUMBER,
     104    "rtems_io_open"
     105  );
     106  puts( "rtems_io_open        - RTEMS_INVALID_NUMBER" );
     107
     108  /*
     109   *  Exercise the io register driver directive
     110   */
     111  puts( "-----  EXERCISE DRIVER REGISTER -----" );
     112
     113  status = rtems_io_register_driver( 0, &GoodDriver, NULL );
     114  fatal_directive_status(
     115    status,
     116    RTEMS_INVALID_ADDRESS,
     117    "rtems_io_register_driver"
     118  );
     119  puts(
     120   "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL registered"
     121  );
     122
     123  status = rtems_io_register_driver( 0, NULL, &registered );
     124  fatal_directive_status(
     125    status,
     126    RTEMS_INVALID_ADDRESS,
     127    "rtems_io_register_driver"
     128  );
     129  puts(
     130    "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL device"
     131  );
     132
     133  status = rtems_io_register_driver( 0, &BadDriver_Nothing, &registered );
     134  fatal_directive_status(
     135    status,
     136    RTEMS_INVALID_ADDRESS,
     137    "rtems_io_register_driver"
     138  );
     139  puts(
     140    "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - no callouts"
     141  );
     142
     143  status = rtems_io_register_driver(
     144    INVALID_DRIVER_MAJOR, &GoodDriver, &registered );
     145  fatal_directive_status(
     146    status,
     147    RTEMS_INVALID_NUMBER,
     148    "rtems_io_register_driver"
     149  );
     150  puts( "rtems_io_register_driver - RTEMS_INVALID_NUMBER - bad major" );
     151
     152  /* this has to succeed to overwrite NULL driver entry required above. */
     153  status = rtems_io_register_driver( 0, &GoodDriver, &registered_worked );
     154  directive_failed( status, "rtems_io_register_driver" );
     155  puts( "rtems_io_register_driver - RTEMS_SUCCESSFUL - overwrite NULL" );
     156
     157  status = rtems_io_register_driver( 0, &GoodDriver, &registered );
     158  if ( status == RTEMS_SUCCESSFUL )
     159    printf(
     160      "registered major = %" PRIurtems_device_major_number "\n", registered );
     161  fatal_directive_status(
     162    status,
     163    RTEMS_TOO_MANY,
     164    "rtems_io_register_driver"
     165  );
     166  puts( "rtems_io_register_driver - RTEMS_TOO_MANY - no slots" );
     167
     168  /* there should be a driver at major 1 -- clock, console, or stub */
     169  status = rtems_io_register_driver( 1, &GoodDriver, &registered );
     170  fatal_directive_status(
     171    status,
     172    RTEMS_RESOURCE_IN_USE,
     173    "rtems_io_register_driver"
     174  );
     175  puts(
     176    "rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use"
     177  );
     178
     179  /* this should unregister the device driver we registered above */
     180  status = rtems_io_unregister_driver( registered_worked );
     181  directive_failed( status, "rtems_io_unregister_driver" );
     182  puts( "rtems_io_unregister_driver - RTEMS_SUCCESSFUL" );
     183}
     184
     185void do_test_io_lookup_name(void)
     186{
     187  rtems_status_code    sc;
     188  rtems_driver_name_t  info;
     189
     190  puts( "rtems_io_lookup_name( \"\", &info )" );
     191  sc = rtems_io_lookup_name( "", &info );
     192  fatal_directive_status( sc, RTEMS_UNSATISFIED, "lookup empty string" );
     193 
     194  puts( "rtems_io_lookup_name( \"/dev/null\", &info )" );
     195  sc = rtems_io_lookup_name( "/dev/null", &info );
     196  directive_failed( sc, "lookup /dev/null" );
     197}
    26198
    27199rtems_task Init(
     
    29201)
    30202{
    31   rtems_status_code status;
    32 
    33203  puts( "\n\n*** TEST 21 ***" );
    34204
    35   Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
    36 
    37   status = rtems_task_create(
    38     Task_name[ 1 ],
    39     1,
    40     RTEMS_MINIMUM_STACK_SIZE,
    41     RTEMS_DEFAULT_MODES,
    42     RTEMS_DEFAULT_ATTRIBUTES,
    43     &Task_id[ 1 ]
    44   );
    45   directive_failed( status, "rtems_task_create of TA1" );
    46 
    47   status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
    48   directive_failed( status, "rtems_task_start of TA1" );
    49 
    50   status = rtems_task_delete( RTEMS_SELF );
    51   directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     205  do_test_io_manager();
     206
     207  do_test_io_lookup_name();
     208
     209  puts( "*** END OF TEST 21 ***" );
     210  rtems_test_exit( 0 );
    52211}
     212
     213/* configuration information */
     214
     215#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     216#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     217#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
     218#define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
     219
     220#define CONFIGURE_MAXIMUM_TASKS             1
     221#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
     222
     223#define CONFIGURE_INIT
     224#include <rtems/confdefs.h>
     225/* end of file */
  • testsuites/sptests/sp21/sp21.scn

    r39507635 r6f67619  
    11*** TEST 21 ***
    22-----  TESTING THE NULL DRIVER CHECKS  -----
    3 TA1 - rtems_io_initialize  - NULL DRIVER RTEMS_SUCCESSFUL
    4 TA1 - rtems_io_open        - NULL DRIVER RTEMS_SUCCESSFUL
    5 TA1 - rtems_io_close       - NULL DRIVER RTEMS_SUCCESSFUL
    6 TA1 - rtems_io_read        - NULL DRIVER RTEMS_SUCCESSFUL
    7 TA1 - rtems_io_write       - NULL DRIVER RTEMS_SUCCESSFUL
    8 TA1 - rtems_io_control     - NULL DRIVER RTEMS_SUCCESSFUL
     3rtems_io_initialize  - NULL DRIVER RTEMS_SUCCESSFUL
     4rtems_io_open        - NULL DRIVER RTEMS_SUCCESSFUL
     5rtems_io_close       - NULL DRIVER RTEMS_SUCCESSFUL
     6rtems_io_read        - NULL DRIVER RTEMS_SUCCESSFUL
     7rtems_io_write       - NULL DRIVER RTEMS_SUCCESSFUL
     8rtems_io_control     - NULL DRIVER RTEMS_SUCCESSFUL
    99-----  TESTING THE I/O MANAGER DIRECTIVES  -----
    10 TA1 - rtems_io_initialize  - STUB DRIVER RTEMS_SUCCESSFUL
    11 TA1 - rtems_io_open        - STUB DRIVER RTEMS_SUCCESSFUL
    12 TA1 - rtems_io_close       - STUB DRIVER RTEMS_SUCCESSFUL
    13 TA1 - rtems_io_read        - STUB DRIVER RTEMS_SUCCESSFUL
    14 TA1 - rtems_io_write       - STUB DRIVER RTEMS_SUCCESSFUL
    15 TA1 - rtems_io_control     - STUB DRIVER RTEMS_SUCCESSFUL
     10rtems_io_initialize  - STUB DRIVER RTEMS_SUCCESSFUL
     11rtems_io_open        - STUB DRIVER RTEMS_SUCCESSFUL
     12rtems_io_close       - STUB DRIVER RTEMS_SUCCESSFUL
     13rtems_io_read        - STUB DRIVER RTEMS_SUCCESSFUL
     14rtems_io_write       - STUB DRIVER RTEMS_SUCCESSFUL
     15rtems_io_control     - STUB DRIVER RTEMS_SUCCESSFUL
    1616-----  RETURNING INVALID MAJOR NUMBER -----
    17 TA1 - rtems_io_initialize  - RTEMS_INVALID_NUMBER
    18 TA1 - rtems_io_open        - RTEMS_INVALID_NUMBER
     17rtems_io_initialize  - RTEMS_INVALID_NUMBER
     18rtems_io_open        - RTEMS_INVALID_NUMBER
    1919-----  EXERCISE DRIVER REGISTER -----
    20 TA1 - rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL registered
    21 TA1 - rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL device
    22 TA1 - rtems_io_register_driver - RTEMS_INVALID_ADDRESS - no callouts
    23 TA1 - rtems_io_register_driver - RTEMS_INVALID_NUMBER - bad major
    24 TA1 - rtems_io_register_driver - RTEMS_SUCCESSFUL - overwrite NULL
    25 TA1 - rtems_io_register_driver - RTEMS_TOO_MANY - no slots
    26 TA1 - rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use
    27 TA1 - rtems_io_unregister_driver - RTEMS_SUCCESSFUL
     20rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL registered
     21rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL device
     22rtems_io_register_driver - RTEMS_INVALID_ADDRESS - no callouts
     23rtems_io_register_driver - RTEMS_INVALID_NUMBER - bad major
     24rtems_io_register_driver - RTEMS_SUCCESSFUL - overwrite NULL
     25rtems_io_register_driver - RTEMS_TOO_MANY - no slots
     26rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use
     27rtems_io_unregister_driver - RTEMS_SUCCESSFUL
     28rtems_io_lookup_name( "", &info )
     29rtems_io_lookup_name( "/dev/null", &info )
    2830*** END OF TEST 21 ***
Note: See TracChangeset for help on using the changeset viewer.