From ba959a4b1cac2df4f3530518bdd16868f078010c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 14 Jul 2010 23:17:48 +0000 Subject: 2010-07-14 Joel Sherrill * spprintk/init.c, spprintk/spprintk.doc, spprintk/spprintk.scn: Clean up and add test of getchark(). --- testsuites/sptests/ChangeLog | 5 +++ testsuites/sptests/spprintk/init.c | 54 +++++++++++++++++++++++++++----- testsuites/sptests/spprintk/spprintk.doc | 6 ++++ testsuites/sptests/spprintk/spprintk.scn | 6 ++-- 4 files changed, 61 insertions(+), 10 deletions(-) (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index dcd4983883..5c665caad0 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,8 @@ +2010-07-14 Joel Sherrill + + * spprintk/init.c, spprintk/spprintk.doc, spprintk/spprintk.scn: Clean + up and add test of getchark(). + 2010-07-14 Joel Sherrill * spfatal21/Makefile.am: Fix typo. diff --git a/testsuites/sptests/spprintk/init.c b/testsuites/sptests/spprintk/init.c index 2135412c65..8ff4711652 100644 --- a/testsuites/sptests/spprintk/init.c +++ b/testsuites/sptests/spprintk/init.c @@ -1,7 +1,7 @@ /* - * Exercise Printk + * Exercise putk, printk, and getchark * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -12,15 +12,41 @@ */ #include +#include -rtems_task Init( - rtems_task_argument argument -) +int test_getchar(void) { - printk( "\n\n*** TEST PRINTK ***\n" ); + return 0x35; +} + +void do_getchark(void) +{ + int sc; + BSP_polling_getchar_function_type poll_char; + + poll_char = BSP_poll_char; + + BSP_poll_char = NULL; + + putk( "getchark - NULL getchar method - return -1" ); + sc = getchark(); + rtems_test_assert( sc == -1 ); + + putk( "getchark - test getchar method - returns 0x35" ); + BSP_poll_char = test_getchar; + sc = getchark(); + rtems_test_assert( sc == 0x35 ); + + BSP_poll_char = poll_char; +} - putk( "This is a test of putk\n" ); +void do_putk(void) +{ + putk( "This is a test of putk" ); +} +void do_printk(void) +{ printk( "bad format -- %%q in parentheses (%q)\n" ); printk( "bad format -- %%lq in parentheses (%lq)\n", 0x1234 ); @@ -52,7 +78,21 @@ rtems_task Init( printk( "%%-12s of joel -- (%-20s)\n", "joel" ); printk( "%%-4s of joel -- (%-4s)\n", "joel" ); printk( "%%c of X -- (%c)\n", 'X' ); +} + +rtems_task Init( + rtems_task_argument argument +) +{ + printk( "\n\n*** TEST PRINTK ***\n" ); + + do_putk(); + putk(""); + + do_printk(); + putk(""); + do_getchark(); printk( "*** END OF TEST PRINTK ***\n" ); rtems_test_exit( 0 ); diff --git a/testsuites/sptests/spprintk/spprintk.doc b/testsuites/sptests/spprintk/spprintk.doc index 84020d6d14..070dd01129 100644 --- a/testsuites/sptests/spprintk/spprintk.doc +++ b/testsuites/sptests/spprintk/spprintk.doc @@ -15,8 +15,14 @@ test set name: spprintk directives: + putk printk + getchark concepts: ++ Ensure that putk() is fully exercised and operates as expected. + + Ensure that printk() is fully exercised and operates as expected. + ++ Ensure that getchark() is fully exercised and operates as expected. diff --git a/testsuites/sptests/spprintk/spprintk.scn b/testsuites/sptests/spprintk/spprintk.scn index ad58614679..52ca4834c4 100644 --- a/testsuites/sptests/spprintk/spprintk.scn +++ b/testsuites/sptests/spprintk/spprintk.scn @@ -1,6 +1,3 @@ -sparc-rtems4.10-run is /opt/rtems-4.10/bin/sparc-rtems4.10-run - - *** TEST PRINTK *** This is a test of putk @@ -28,4 +25,7 @@ bad format -- %lq in parentheses (q) %-12s of joel -- (joel ) %-4s of joel -- (joel) %c of X -- (X) + +getchark - NULL getchar method - return -1 +getchark - test getchar method - returns 0x35 *** END OF TEST PRINTK *** -- cgit v1.2.3