From 3a2724805421098df505c0acea106fb294bc2f6a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 21 Oct 2016 09:23:58 +0200 Subject: score: First part of new MrsP implementation Update #2556. --- testsuites/smptests/smpfatal03/Makefile.am | 19 +++++ testsuites/smptests/smpfatal03/init.c | 108 ++++++++++++++++++++++++++ testsuites/smptests/smpfatal03/smpfatal03.doc | 12 +++ testsuites/smptests/smpfatal03/smpfatal03.scn | 2 + 4 files changed, 141 insertions(+) create mode 100644 testsuites/smptests/smpfatal03/Makefile.am create mode 100644 testsuites/smptests/smpfatal03/init.c create mode 100644 testsuites/smptests/smpfatal03/smpfatal03.doc create mode 100644 testsuites/smptests/smpfatal03/smpfatal03.scn (limited to 'testsuites/smptests/smpfatal03') 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 + * + * + * 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 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 *** -- cgit v1.2.3