Changeset 11b9b5d in rtems


Ignore:
Timestamp:
Sep 16, 2011, 9:24:52 AM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
3ce764a
Parents:
7c9d27e
Message:

2011-09-16 Sebastian Huber <Sebastian.Huber@…>

  • monitor/monitor.scn, termios/termios.scn: New files.
  • monitor/init.c, termios01/init.c: Use rtems_shell_wait_for_input().
Location:
testsuites/libtests
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    r7c9d27e r11b9b5d  
     12011-09-16      Sebastian Huber <Sebastian.Huber@embedded-brains.de>
     2
     3        * monitor/monitor.scn, termios/termios.scn: New files.
     4        * monitor/init.c, termios01/init.c: Use rtems_shell_wait_for_input().
     5
    162011-09-02      Sebastian Huber <sebastian.huber@embedded-brains.de>
    27
  • testsuites/libtests/monitor/init.c

    r7c9d27e r11b9b5d  
    2222
    2323#include <rtems/monitor.h>
     24#include <rtems/shell.h>
    2425
    2526rtems_task_priority Priorities[6] = { 0,   1,   1,   3,   4,   5 };
     
    3738}
    3839
    39 
     40static void notification(int fd, int seconds_remaining, void *arg)
     41{
     42  printf(
     43    "Press any key to enter monitor (%is remaining)\n",
     44    seconds_remaining
     45  );
     46}
    4047
    4148rtems_task Init(
     
    4653  rtems_status_code status;
    4754
    48   puts( "\n\n*** MONITOR TASK TEST ***" );
     55  puts( "\n\n*** TEST MONITOR ***" );
    4956
    5057  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
     
    7178  }
    7279
    73   rtems_monitor_init( 0 );
     80  status = rtems_shell_wait_for_input(
     81    STDIN_FILENO,
     82    20,
     83    notification,
     84    NULL
     85  );
     86  if (status == RTEMS_SUCCESSFUL) {
     87    rtems_monitor_init( 0 );
    7488
    75   status = rtems_task_delete( RTEMS_SELF );
    76   directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     89    status = rtems_task_delete( RTEMS_SELF );
     90    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     91  } else {
     92    puts( "*** END OF TEST MONITOR ***" );
     93
     94    rtems_test_exit( 0 );
     95  }
    7796}
  • testsuites/libtests/termios/init.c

    r7c9d27e r11b9b5d  
    4444
    4545#include <rtems/confdefs.h>
     46#include <rtems/shell.h>
    4647
    4748#include <stdio.h>
     
    712713}
    713714
     715static void notification( int fd, int seconds_remaining, void *arg )
     716{
     717  printf(
     718    "Press any key to check the termios input capabilities (%is remaining)\n",
     719    seconds_remaining
     720  );
     721}
    714722
    715723/*
     
    719727Init (rtems_task_argument ignored)
    720728{
     729  rtems_status_code status;
    721730  char c ;
    722731  struct termios orig_termios, test_termios;
    723732
    724   printf( "\n\n*** TEST OF TERMIOS INPUT CAPABILITIES ***\n" );
    725 
    726   if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) {
    727     perror( "tcgetattr() failed" );
     733  puts( "\n\n*** TEST TERMIOS INPUT CAPABILITIES ***" );
     734
     735  status = rtems_shell_wait_for_input(
     736    STDIN_FILENO,
     737    20,
     738    notification,
     739    NULL
     740  );
     741  if (status == RTEMS_SUCCESSFUL) {
     742    if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) {
     743      perror( "tcgetattr() failed" );
     744      rtems_test_exit( 0 );
     745    }
     746
     747    test_termios = orig_termios;
     748
     749    usage();
     750    for(;;) {
     751      switch( c = getchar() ) {
     752        case '1':
     753          printf( "\nResetting the line to the original termios setting\n\n" );
     754          test_termios = orig_termios;
     755          if( tcsetattr( fileno( stdin ), TCSADRAIN, &test_termios ) < 0 ) {
     756            perror( "tcsetattr() failed" );
     757            rtems_test_exit( 1 );
     758          }
     759          usage();
     760          break;
     761
     762        case '2':
     763          print_termios( &test_termios );
     764          usage();
     765          break;
     766
     767        case '3':
     768          change_line_settings( &test_termios );
     769          usage();
     770          break;
     771
     772        case '4':
     773          canonical_input( &test_termios );
     774          usage();
     775          break;
     776
     777        case '5':
     778          raw_input( &test_termios );
     779          usage();
     780          break;
     781
     782        case '9':
     783          rtems_test_exit( 1 );
     784
     785        case '\n':
     786          break;
     787
     788        default:
     789          printf( "\n%c is not a valid choice. Try again\n\n", c );
     790          usage();
     791          break;
     792      }
     793    }
     794  } else {
     795    puts( "*** END OF TEST TERMIOS INPUT CAPABILITIES ***" );
     796
    728797    rtems_test_exit( 0 );
    729798  }
    730 
    731   test_termios = orig_termios;
    732 
    733   usage();
    734   for(;;) {
    735     switch( c = getchar() ) {
    736       case '1':
    737         printf( "\nResetting the line to the original termios setting\n\n" );
    738         test_termios = orig_termios;
    739         if( tcsetattr( fileno( stdin ), TCSADRAIN, &test_termios ) < 0 ) {
    740           perror( "tcsetattr() failed" );
    741           rtems_test_exit( 1 );
    742         }
    743         usage();
    744         break;
    745 
    746       case '2':
    747         print_termios( &test_termios );
    748         usage();
    749         break;
    750 
    751       case '3':
    752         change_line_settings( &test_termios );
    753         usage();
    754         break;
    755 
    756       case '4':
    757         canonical_input( &test_termios );
    758         usage();
    759         break;
    760 
    761       case '5':
    762         raw_input( &test_termios );
    763         usage();
    764         break;
    765 
    766       case '9':
    767         rtems_test_exit( 1 );
    768 
    769       case '\n':
    770         break;
    771 
    772       default:
    773         printf( "\n%c is not a valid choice. Try again\n\n", c );
    774         usage();
    775         break;
    776     }
    777   }
    778 }
     799}
Note: See TracChangeset for help on using the changeset viewer.