summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests/smpfatal03
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-21 09:23:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 10:05:43 +0100
commit3a2724805421098df505c0acea106fb294bc2f6a (patch)
tree07b225c4fdc140786851750df34433526ed2ddff /testsuites/smptests/smpfatal03
parentscore: Use scheduler instance specific locks (diff)
downloadrtems-3a2724805421098df505c0acea106fb294bc2f6a.tar.bz2
score: First part of new MrsP implementation
Update #2556.
Diffstat (limited to 'testsuites/smptests/smpfatal03')
-rw-r--r--testsuites/smptests/smpfatal03/Makefile.am19
-rw-r--r--testsuites/smptests/smpfatal03/init.c108
-rw-r--r--testsuites/smptests/smpfatal03/smpfatal03.doc12
-rw-r--r--testsuites/smptests/smpfatal03/smpfatal03.scn2
4 files changed, 141 insertions, 0 deletions
diff --git a/testsuites/smptests/smpfatal03/Makefile.am b/testsuites/smptests/smpfatal03/Makefile.am
new file mode 100644
index 0000000000..4ec2862357
--- /dev/null
+++ b/testsuites/smptests/smpfatal03/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = smpfatal03
+smpfatal03_SOURCES = init.c
+
+dist_rtems_tests_DATA = smpfatal03.scn smpfatal03.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 = $(smpfatal03_OBJECTS)
+LINK_LIBS = $(smpfatal03_LDLIBS)
+
+smpfatal03$(EXEEXT): $(smpfatal03_OBJECTS) $(smpfatal03_DEPENDENCIES)
+ @rm -f smpfatal03$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smpfatal03/init.c b/testsuites/smptests/smpfatal03/init.c
new file mode 100644
index 0000000000..0eb15aae81
--- /dev/null
+++ b/testsuites/smptests/smpfatal03/init.c
@@ -0,0 +1,108 @@
+/*
+ * 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.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define TESTS_USE_PRINTK
+#include "tmacros.h"
+
+const char rtems_test_name[] = "SMPFATAL 3";
+
+static void task(rtems_task_argument arg)
+{
+ rtems_status_code sc;
+ rtems_id *sem_id;
+
+ sem_id = (rtems_id *) arg;
+
+ sc = rtems_semaphore_obtain(*sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_test_assert(0);
+}
+
+static void Init(rtems_task_argument arg)
+{
+ rtems_status_code sc;
+ rtems_id task_id;
+ rtems_id sem_id;
+
+ TEST_BEGIN();
+
+ sc = rtems_semaphore_create(
+ rtems_build_name('M', 'R', 'S', 'P'),
+ 1,
+ RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
+ | RTEMS_BINARY_SEMAPHORE,
+ 1,
+ &sem_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_create(
+ rtems_build_name('T', 'A', 'S', 'K'),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_start(task_id, task, (rtems_task_argument) &sem_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ _Thread_Dispatch_disable();
+ rtems_semaphore_obtain(sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+ rtems_test_assert(0);
+}
+
+static void fatal_extension(
+ rtems_fatal_source source,
+ bool is_internal,
+ rtems_fatal_code code
+)
+{
+ if (
+ source == INTERNAL_ERROR_CORE
+ && !is_internal
+ && code == INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
+ ) {
+ TEST_END();
+ }
+}
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_INITIAL_EXTENSIONS \
+ { .fatal = fatal_extension }, \
+ RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/smptests/smpfatal03/smpfatal03.doc b/testsuites/smptests/smpfatal03/smpfatal03.doc
new file mode 100644
index 0000000000..6d7e829a00
--- /dev/null
+++ b/testsuites/smptests/smpfatal03/smpfatal03.doc
@@ -0,0 +1,12 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: smpfatal03
+
+directives:
+
+ - _Thread_queue_Enqueue_sticky()
+
+concepts:
+
+ - Trigger the INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE fatal
+ error.
diff --git a/testsuites/smptests/smpfatal03/smpfatal03.scn b/testsuites/smptests/smpfatal03/smpfatal03.scn
new file mode 100644
index 0000000000..5ec996f50b
--- /dev/null
+++ b/testsuites/smptests/smpfatal03/smpfatal03.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST SMPFATAL 3 ***
+*** END OF TEST SMPFATAL 3 ***