summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spfatal31
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-19 09:07:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-25 11:41:11 +0200
commit600d88dfd7c245a4e97d297bd208d568f8bae16b (patch)
tree1d2b6b87a7934ca0a5f6a9a702577fb6ae59569c /testsuites/sptests/spfatal31
parentsparc: Rename SPARC_USE_SAFE_FP_SUPPORT (diff)
downloadrtems-600d88dfd7c245a4e97d297bd208d568f8bae16b.tar.bz2
INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
Add new fatal error INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT. Update #3077.
Diffstat (limited to 'testsuites/sptests/spfatal31')
-rw-r--r--testsuites/sptests/spfatal31/Makefile.am19
-rw-r--r--testsuites/sptests/spfatal31/init.c96
-rw-r--r--testsuites/sptests/spfatal31/spfatal31.doc12
-rw-r--r--testsuites/sptests/spfatal31/spfatal31.scn2
4 files changed, 129 insertions, 0 deletions
diff --git a/testsuites/sptests/spfatal31/Makefile.am b/testsuites/sptests/spfatal31/Makefile.am
new file mode 100644
index 0000000000..ec6161b313
--- /dev/null
+++ b/testsuites/sptests/spfatal31/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = spfatal31
+spfatal31_SOURCES = init.c
+
+dist_rtems_tests_DATA = spfatal31.scn spfatal31.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 = $(spfatal31_OBJECTS)
+LINK_LIBS = $(spfatal31_LDLIBS)
+
+spfatal31$(EXEEXT): $(spfatal31_OBJECTS) $(spfatal31_DEPENDENCIES)
+ @rm -f spfatal31$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spfatal31/init.c b/testsuites/sptests/spfatal31/init.c
new file mode 100644
index 0000000000..b5066c0825
--- /dev/null
+++ b/testsuites/sptests/spfatal31/init.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define TESTS_USE_PRINTK
+#include "tmacros.h"
+
+#include <rtems.h>
+
+const char rtems_test_name[] = "SPFATAL 31";
+
+#if CPU_HARDWARE_FP == TRUE && defined(__sparc__)
+#define EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#endif
+
+static volatile double f = 1.0;
+
+static void timer(rtems_id id, void *arg)
+{
+ f *= 123.456;
+}
+
+static void Init(rtems_task_argument arg)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ TEST_BEGIN();
+
+ 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_wake_after(2);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+ rtems_test_assert(0);
+#else
+ TEST_END();
+ rtems_test_exit(0);
+#endif
+}
+
+#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+static void fatal_extension(
+ rtems_fatal_source source,
+ bool always_set_to_false,
+ rtems_fatal_code code
+)
+{
+ if (
+ source == INTERNAL_ERROR_CORE
+ && !always_set_to_false
+ && code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+ ) {
+ TEST_END();
+ }
+}
+
+#define CONFIGURE_INITIAL_EXTENSIONS \
+ { .fatal = fatal_extension }, \
+ RTEMS_TEST_INITIAL_EXTENSION
+
+#else /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#endif /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/sptests/spfatal31/spfatal31.doc b/testsuites/sptests/spfatal31/spfatal31.doc
new file mode 100644
index 0000000000..5e5a450f52
--- /dev/null
+++ b/testsuites/sptests/spfatal31/spfatal31.doc
@@ -0,0 +1,12 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: spfatal31
+
+directives:
+
+ - _Internal_error()
+
+concepts:
+
+ - Provoke an illegal use of the floating point unit in interrupt context and
+ ensure that the right internal error occurs.
diff --git a/testsuites/sptests/spfatal31/spfatal31.scn b/testsuites/sptests/spfatal31/spfatal31.scn
new file mode 100644
index 0000000000..2210acec10
--- /dev/null
+++ b/testsuites/sptests/spfatal31/spfatal31.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST SPFATAL 31 ***
+*** END OF TEST SPFATAL 31 ***