summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-31 23:42:50 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-31 23:42:50 +0000
commit920343eed752a059396eab7a8663fcde246c0948 (patch)
treef7da5226808d719a554e0cabfb77917a5d400435 /testsuites
parent2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-920343eed752a059396eab7a8663fcde246c0948.tar.bz2
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: New tests. * psxfatal01/.cvsignore, psxfatal01/Makefile.am, psxfatal01/psxfatal01.scn, psxfatal01/testcase.h, psxfatal02/.cvsignore, psxfatal02/Makefile.am, psxfatal02/psxfatal02.scn, psxfatal02/testcase.h, psxfatal_support/init.c, psxfatal_support/system.h: New files.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/ChangeLog9
-rw-r--r--testsuites/psxtests/Makefile.am5
-rw-r--r--testsuites/psxtests/configure.ac2
-rw-r--r--testsuites/psxtests/psxfatal01/.cvsignore2
-rw-r--r--testsuites/psxtests/psxfatal01/Makefile.am27
-rw-r--r--testsuites/psxtests/psxfatal01/psxfatal01.scn1
-rw-r--r--testsuites/psxtests/psxfatal01/testcase.h36
-rw-r--r--testsuites/psxtests/psxfatal02/.cvsignore2
-rw-r--r--testsuites/psxtests/psxfatal02/Makefile.am27
-rw-r--r--testsuites/psxtests/psxfatal02/psxfatal02.scn1
-rw-r--r--testsuites/psxtests/psxfatal02/testcase.h36
-rw-r--r--testsuites/psxtests/psxfatal_support/init.c156
-rw-r--r--testsuites/psxtests/psxfatal_support/system.h72
13 files changed, 375 insertions, 1 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 2911b5cd2a..2a672256cc 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,5 +1,14 @@
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
+ * Makefile.am, configure.ac: New tests.
+ * psxfatal01/.cvsignore, psxfatal01/Makefile.am,
+ psxfatal01/psxfatal01.scn, psxfatal01/testcase.h,
+ psxfatal02/.cvsignore, psxfatal02/Makefile.am,
+ psxfatal02/psxfatal02.scn, psxfatal02/testcase.h,
+ psxfatal_support/init.c, psxfatal_support/system.h: New files.
+
+2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
+
* Makefile.am, configure.ac: Add psx14 to exercise POSIX API specific
portions of Object Services added to API.
* psx14/.cvsignore, psx14/Makefile.am, psx14/init.c, psx14/psx14.scn,
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index bebfb09eb9..a93214a231 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
psx10 psx11 psx12 psx13 psx14 psxcleanup psxtime psxtimer01 psxtimer02 \
psxcancel psxbarrier01 psxmsgq01 psxrwlock01 psxsem01 psxspin01 \
- psxenosys psxsignal01 psxsysconf psxualarm
+ psxenosys psxsignal01 psxsysconf psxualarm psxfatal01 psxfatal02
## File IO tests
SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01
@@ -18,6 +18,9 @@ if HAS_NETWORKING
SUBDIRS += psxrdwrv
endif
+DIST_SUBDIRS = $(SUBDIRS) psxfatal_support
+EXTRA_DIST = psxfatal_support/init.c psxfatal_support/system.h
+
include $(top_srcdir)/../automake/subdirs.am
include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 854fa8cc01..aa3cc8c45e 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -46,6 +46,8 @@ psxcancel/Makefile
psxchroot01/Makefile
psxcleanup/Makefile
psxenosys/Makefile
+psxfatal01/Makefile
+psxfatal02/Makefile
psxfile01/Makefile
psxhdrs/Makefile
psxmount/Makefile
diff --git a/testsuites/psxtests/psxfatal01/.cvsignore b/testsuites/psxtests/psxfatal01/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxfatal01/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxfatal01/Makefile.am b/testsuites/psxtests/psxfatal01/Makefile.am
new file mode 100644
index 0000000000..fc04980ea6
--- /dev/null
+++ b/testsuites/psxtests/psxfatal01/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxfatal01.exe
+psxfatal01_exe_SOURCES = ../psxfatal_support/init.c ../psxfatal_support/system.h testcase.h
+
+dist_rtems_tests_DATA = psxfatal01.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxfatal01_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxfatal01_exe_OBJECTS) $(psxfatal01_exe_LDADD)
+LINK_LIBS = $(psxfatal01_exe_LDLIBS)
+
+psxfatal01.exe$(EXEEXT): $(psxfatal01_exe_OBJECTS) $(psxfatal01_exe_DEPENDENCIES)
+ @rm -f psxfatal01.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxfatal01/psxfatal01.scn b/testsuites/psxtests/psxfatal01/psxfatal01.scn
new file mode 100644
index 0000000000..5314230233
--- /dev/null
+++ b/testsuites/psxtests/psxfatal01/psxfatal01.scn
@@ -0,0 +1 @@
+Fatal error (POSIX API Init thread create failure - NULL entry) hit
diff --git a/testsuites/psxtests/psxfatal01/testcase.h b/testsuites/psxtests/psxfatal01/testcase.h
new file mode 100644
index 0000000000..01ab0b6836
--- /dev/null
+++ b/testsuites/psxtests/psxfatal01/testcase.h
@@ -0,0 +1,36 @@
+/*
+ * Classic API Init task create failure
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+
+/*
+ * Way too much stack space. Should generate a fatal error
+ * on the init task create.
+ */
+#define CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0
+posix_initialization_threads_table POSIX_Initialization_threads[] = {
+ { NULL, /* bad thread entry */
+ 0
+ }
+};
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME POSIX_Initialization_threads
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
+ sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
+ sizeof(posix_initialization_threads_table)
+
+#define FATAL_ERROR_DESCRIPTION \
+ "POSIX API Init thread create failure - NULL entry"
+#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_POSIX_API
+#define FATAL_ERROR_EXPECTED_IS_INTERNAL TRUE
+#define FATAL_ERROR_EXPECTED_ERROR EFAULT
+
+void force_error()
+{
+ /* we will not run this far */
+}
diff --git a/testsuites/psxtests/psxfatal02/.cvsignore b/testsuites/psxtests/psxfatal02/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxfatal02/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxfatal02/Makefile.am b/testsuites/psxtests/psxfatal02/Makefile.am
new file mode 100644
index 0000000000..c1b5008552
--- /dev/null
+++ b/testsuites/psxtests/psxfatal02/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxfatal02.exe
+psxfatal02_exe_SOURCES = ../psxfatal_support/init.c ../psxfatal_support/system.h testcase.h
+
+dist_rtems_tests_DATA = psxfatal02.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxfatal02_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxfatal02_exe_OBJECTS) $(psxfatal02_exe_LDADD)
+LINK_LIBS = $(psxfatal02_exe_LDLIBS)
+
+psxfatal02.exe$(EXEEXT): $(psxfatal02_exe_OBJECTS) $(psxfatal02_exe_DEPENDENCIES)
+ @rm -f psxfatal02.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxfatal02/psxfatal02.scn b/testsuites/psxtests/psxfatal02/psxfatal02.scn
new file mode 100644
index 0000000000..c6a0cea99d
--- /dev/null
+++ b/testsuites/psxtests/psxfatal02/psxfatal02.scn
@@ -0,0 +1 @@
+Fatal error (POSIX API Init thread create failure -- no memory for stack) hit
diff --git a/testsuites/psxtests/psxfatal02/testcase.h b/testsuites/psxtests/psxfatal02/testcase.h
new file mode 100644
index 0000000000..09dd5b80f8
--- /dev/null
+++ b/testsuites/psxtests/psxfatal02/testcase.h
@@ -0,0 +1,36 @@
+/*
+ * Classic API Init task create failure
+ *
+ * $Id$
+ */
+
+#include <errno.h>
+
+/*
+ * Way too much stack space. Should generate a fatal error
+ * on the init task create.
+ */
+#define CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0
+posix_initialization_threads_table POSIX_Initialization_threads[] = {
+ { POSIX_Init,
+ 12 * 1024 * 1024 /* too much stack */
+ }
+};
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME POSIX_Initialization_threads
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
+ sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
+ sizeof(posix_initialization_threads_table)
+
+#define FATAL_ERROR_DESCRIPTION \
+ "POSIX API Init thread create failure -- no memory for stack"
+#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_POSIX_API
+#define FATAL_ERROR_EXPECTED_IS_INTERNAL TRUE
+#define FATAL_ERROR_EXPECTED_ERROR EAGAIN
+
+void force_error()
+{
+ /* we will not run this far */
+}
diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c
new file mode 100644
index 0000000000..20dcce306d
--- /dev/null
+++ b/testsuites/psxtests/psxfatal_support/init.c
@@ -0,0 +1,156 @@
+/* POSIX_Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-2008.
+ * 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.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+void *POSIX_Init(
+ void *argument
+)
+{
+ force_error();
+ printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
+ rtems_test_exit(0);
+}
+
+char *Sources[] = {
+ "INTERNAL_ERROR_CORE",
+ "INTERNAL_ERROR_RTEMS_API",
+ "INTERNAL_ERROR_POSIX_API",
+ "INTERNAL_ERROR_ITRON_API"
+};
+
+char *Errors_Rtems[] = {
+ "RTEMS_SUCCESSFUL", /* successful completion */
+ "RTEMS_TASK_EXITTED", /* returned from a task */
+ "RTEMS_MP_NOT_CONFIGURED", /* multiprocessing not configured */
+ "RTEMS_INVALID_NAME", /* invalid object name */
+ "RTEMS_INVALID_ID", /* invalid object id */
+ "RTEMS_TOO_MANY", /* too many */
+ "RTEMS_TIMEOUT", /* timed out waiting */
+ "RTEMS_OBJECT_WAS_DELETED", /* object was deleted while waiting */
+ "RTEMS_INVALID_SIZE", /* specified size was invalid */
+ "RTEMS_INVALID_ADDRESS", /* address specified is invalid */
+ "RTEMS_INVALID_NUMBER", /* number was invalid */
+ "RTEMS_NOT_DEFINED", /* item has not been initialized */
+ "RTEMS_RESOURCE_IN_USE", /* resources still outstanding */
+ "RTEMS_UNSATISFIED", /* request not satisfied */
+ "RTEMS_INCORRECT_STATE", /* task is in wrong state */
+ "RTEMS_ALREADY_SUSPENDED", /* task already in state */
+ "RTEMS_ILLEGAL_ON_SELF", /* illegal operation on calling task */
+ "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
+ "RTEMS_CALLED_FROM_ISR", /* called from ISR */
+ "RTEMS_INVALID_PRIORITY", /* invalid task priority */
+ "RTEMS_INVALID_CLOCK", /* invalid date/time */
+ "RTEMS_INVALID_NODE", /* invalid node id */
+ "RTEMS_NOT_OWNER_OF_RESOURCE", /* not owner of resource */
+ "RTEMS_NOT_CONFIGURED", /* directive not configured */
+ "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */
+};
+
+char *Errors_Core[] = {
+ "INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
+ "INTERNAL_ERROR_NO_CPU_TABLE",
+ "INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS",
+ "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
+ "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
+ "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
+ "INTERNAL_ERROR_THREAD_EXITTED",
+ "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
+ "INTERNAL_ERROR_INVALID_NODE",
+ "INTERNAL_ERROR_NO_MPCI",
+ "INTERNAL_ERROR_BAD_PACKET",
+ "INTERNAL_ERROR_OUT_OF_PACKETS",
+ "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
+ "INTERNAL_ERROR_OUT_OF_PROXIES",
+ "INTERNAL_ERROR_INVALID_GLOBAL_ID",
+ "INTERNAL_ERROR_BAD_STACK_HOOK",
+ "INTERNAL_ERROR_BAD_ATTRIBUTES",
+ "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
+ "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
+ "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE"
+};
+
+void Put_Error( uint32_t source, uint32_t error )
+{
+ if ( source == INTERNAL_ERROR_CORE ) {
+ if ( error > INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE )
+ printk("Unknown Internal Core Error (%d)", error);
+ else
+ printk( Errors_Core[ error ] );
+ }
+ else if (source == INTERNAL_ERROR_RTEMS_API ){
+ if (error > RTEMS_NOT_IMPLEMENTED )
+ printk("Unknown Internal Rtems Error (%d)", error);
+ else
+ printk( Errors_Rtems[ error ] );
+ }
+ else if (source == INTERNAL_ERROR_POSIX_API ) {
+ printk( "SOURCE=%d ERROR=%d %s", source, error, strerror( error ) );
+ }
+}
+
+void Put_Source( uint32_t source )
+{
+ if ( source > INTERNAL_ERROR_ITRON_API )
+ printk("Unknown Source (%d)", source);
+ else
+ printk( Sources[ source ] );
+}
+
+
+rtems_extension Fatal_extension(
+ uint32_t source,
+ boolean is_internal,
+ uint32_t error
+)
+{
+ printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
+
+ if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
+ printk( "ERROR==> Fatal Extension source Expected (");
+ Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
+ printk( ") received (");
+ Put_Source( source );
+ printk( ")\n" );
+ }
+
+ if ( is_internal != FATAL_ERROR_EXPECTED_IS_INTERNAL )
+ {
+ if ( is_internal == TRUE )
+ printk( "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" );
+ else
+ printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" );
+ }
+
+ if ( error != FATAL_ERROR_EXPECTED_ERROR ) {
+ printk( "ERROR==> Fatal Error Expected (");
+ Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
+ printk( ") received (");
+ Put_Error( source, error );
+ printk( ")\n" );
+ }
+
+ /* return and let the CPU halt */
+}
+
diff --git a/testsuites/psxtests/psxfatal_support/system.h b/testsuites/psxtests/psxfatal_support/system.h
new file mode 100644
index 0000000000..551632a79f
--- /dev/null
+++ b/testsuites/psxtests/psxfatal_support/system.h
@@ -0,0 +1,72 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * 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.
+ *
+ * $Id$
+ */
+
+/*
+ * Some of the fatal error cases require the ability to peek inside RTEMS
+ */
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <rtems.h>
+#include <tmacros.h>
+
+/* functions */
+
+void *POSIX_Init(
+ void *argument
+);
+
+rtems_extension Fatal_extension(
+ uint32_t source,
+ boolean is_internal,
+ uint32_t error
+);
+
+/* need prototypes */
+
+#include "testcase.h"
+
+/* configuration information */
+
+extern rtems_extensions_table initial_extensions;
+
+#define CONFIGURE_INITIAL_EXTENSIONS \
+ { \
+ NULL, /* create */ \
+ NULL, /* start */ \
+ NULL, /* restart */ \
+ NULL, /* delete */ \
+ NULL, /* switch */ \
+ NULL, /* begin */ \
+ NULL, /* exitted */ \
+ Fatal_extension /* fatal */ \
+ }
+
+/* extra parameters may be in testcase.h */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+/* always need an Init task, some cases need more tasks */
+#ifndef SPFATAL_TEST_CASE_EXTRA_THREADS
+#define SPFATAL_TEST_CASE_EXTRA_THREADS 0
+#endif
+#define CONFIGURE_MAXIMUM_POSIX_THREADS \
+ (SPFATAL_TEST_CASE_EXTRA_THREADS + 1)
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+/* end of include file */