summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spfatal29
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/sptests/spfatal29
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/sptests/spfatal29')
-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
4 files changed, 77 insertions, 0 deletions
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);
+}