summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spclock_err02/init.c
diff options
context:
space:
mode:
authorChirayu Desai <cdesai@cyanogenmod.org>2013-12-24 19:02:37 +0530
committerGedare Bloom <gedare@rtems.org>2013-12-24 09:53:59 -0500
commit7b5f6643b21d87ad462410a2ff4ac02304f7b3e1 (patch)
treeae88a3eab8313b5dad5e7a7034c17c46f3f01872 /testsuites/sptests/spclock_err02/init.c
parentbfin_TLL6527: added new doxygen (diff)
downloadrtems-7b5f6643b21d87ad462410a2ff4ac02304f7b3e1.tar.bz2
sptests: refactor sp09/screen13 into a new test spclock_err02
Diffstat (limited to 'testsuites/sptests/spclock_err02/init.c')
-rw-r--r--testsuites/sptests/spclock_err02/init.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/testsuites/sptests/spclock_err02/init.c b/testsuites/sptests/spclock_err02/init.c
new file mode 100644
index 0000000000..d7d33f2741
--- /dev/null
+++ b/testsuites/sptests/spclock_err02/init.c
@@ -0,0 +1,129 @@
+/*
+ * COPYRIGHT (c) 2013.
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include "test_support.h"
+
+/* forward declaration to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ puts( "\n\n*** TEST SPCLOCK_ERR02 ***" );
+
+ rtems_time_of_day time;
+ rtems_status_code status;
+
+ status = rtems_io_close( 0xffff, 0x0000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_control( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_close with bad major number"
+ );
+ puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_initialize( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_initialize with bad major number"
+ );
+ puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_open( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_open with bad major number"
+ );
+ puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_read( 0xffff, 0x00000, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_read with bad major number"
+ );
+ puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" );
+ status = rtems_io_write( 0xffff, 0x0ffff, NULL);
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_io_write with bad major number"
+ );
+ puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" );
+
+ build_time( &time, 12, 31, 2000, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+ status = rtems_clock_get_tod( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1999, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+ status = rtems_clock_get_tod( &time );
+ directive_failed( status, "rtems_clock_get_tod" );
+ print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2100, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+ status = rtems_clock_get_tod( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+ status = rtems_clock_get_tod( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ build_time( &time, 12, 31, 1991, 23, 59, 59, 0 );
+ status = rtems_clock_set( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
+ status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+ status = rtems_clock_get_tod( &time );
+ directive_failed( status, "rtems_clock_set" );
+ print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
+
+ puts( "*** END OF TEST SPCLOCK_ERR02 ***" );
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */