summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-14 09:11:07 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-18 07:30:31 +0100
commitd78d5294cd076b48160e12c2f52a940d783b4dac (patch)
tree15bdd7b4b424b6c4ab49435e71ac6c795bb5a58d /testsuites
parentscore: Remove obsolete defines (diff)
downloadrtems-d78d5294cd076b48160e12c2f52a940d783b4dac.tar.bz2
score: Add and use _Thread_Dispatch_direct()
This function is useful for operations which synchronously block, e.g. self restart, self deletion, yield, sleep. It helps to detect if these operations are called in the wrong context. Since the thread dispatch necessary indicator is not used, this is more robust in some SMP situations. Update #2751.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/Makefile.am1
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/spfatal29/Makefile.am19
-rw-r--r--testsuites/sptests/spfatal29/spfatal29.doc11
-rw-r--r--testsuites/sptests/spfatal29/spfatal29.scn3
-rw-r--r--testsuites/sptests/spfatal29/testcase.h44
-rw-r--r--testsuites/sptests/spinternalerror02/init.c2
7 files changed, 80 insertions, 1 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 6e01eb2756..54a4de7f44 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -33,6 +33,7 @@ _SUBDIRS = \
spsignal_err01 spport_err01 spmsgq_err01 spmsgq_err02 spsem_err01 \
spsem_err02 sptask_err01 spevent_err03 sptask_err03 sptask_err02 \
sptask_err04 spclock_err01
+_SUBDIRS += spfatal29
_SUBDIRS += spmutex01
_SUBDIRS += spextensions01
_SUBDIRS += spsysinit01
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 2899b160c7..76d60e3b3c 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -193,6 +193,7 @@ spfatal20/Makefile
spfatal24/Makefile
spfatal25/Makefile
spfatal27/Makefile
+spfatal29/Makefile
spfifo01/Makefile
spfifo02/Makefile
spfifo03/Makefile
diff --git a/testsuites/sptests/spfatal29/Makefile.am b/testsuites/sptests/spfatal29/Makefile.am
new file mode 100644
index 0000000000..23d37a9472
--- /dev/null
+++ b/testsuites/sptests/spfatal29/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = spfatal29
+spfatal29_SOURCES = ../spfatal_support/init.c ../spfatal_support/system.h testcase.h
+
+dist_rtems_tests_DATA = spfatal29.scn spfatal29.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spfatal29_OBJECTS)
+LINK_LIBS = $(spfatal29_LDLIBS)
+
+spfatal29$(EXEEXT): $(spfatal29_OBJECTS) $(spfatal29_DEPENDENCIES)
+ @rm -f spfatal29$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spfatal29/spfatal29.doc b/testsuites/sptests/spfatal29/spfatal29.doc
new file mode 100644
index 0000000000..194e1f5082
--- /dev/null
+++ b/testsuites/sptests/spfatal29/spfatal29.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: spfatal29
+
+directives:
+
+ - _Thread_Dispatch_force()
+
+concepts:
+
+ - Provoke the INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL fatal error.
diff --git a/testsuites/sptests/spfatal29/spfatal29.scn b/testsuites/sptests/spfatal29/spfatal29.scn
new file mode 100644
index 0000000000..c640980d6e
--- /dev/null
+++ b/testsuites/sptests/spfatal29/spfatal29.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST SPFATAL 29 ***
+Fatal error (yield in interrupt context) hit
+*** END OF TEST SPFATAL 29 ***
diff --git a/testsuites/sptests/spfatal29/testcase.h b/testsuites/sptests/spfatal29/testcase.h
new file mode 100644
index 0000000000..096a66ad03
--- /dev/null
+++ b/testsuites/sptests/spfatal29/testcase.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#define FATAL_ERROR_TEST_NAME "29"
+#define FATAL_ERROR_DESCRIPTION "yield in interrupt context"
+#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
+#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
+#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL
+
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+static void timer(rtems_id id, void *arg)
+{
+ rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
+}
+
+void force_error()
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_timer_create(
+ rtems_build_name('T', 'I', 'M', 'E'),
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_timer_fire_after(id, 1, timer, NULL);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_delete(RTEMS_SELF);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c
index 3de5ef9483..af9d764271 100644
--- a/testsuites/sptests/spinternalerror02/init.c
+++ b/testsuites/sptests/spinternalerror02/init.c
@@ -36,7 +36,7 @@ static void test_internal_error_text(void)
} while ( text != text_last );
rtems_test_assert(
- error - 3 == INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
+ error - 3 == INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL
);
}