diff options
Diffstat (limited to 'testsuites')
27 files changed, 902 insertions, 9 deletions
diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 82f5322eb4..e757cf28eb 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -1,8 +1,6 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = -SUBDIRS += smpload01 - if SMPTESTS SUBDIRS += smp01 SUBDIRS += smp02 @@ -16,9 +14,16 @@ SUBDIRS += smpatomic01 SUBDIRS += smpfatal01 SUBDIRS += smpfatal02 SUBDIRS += smpfatal03 +SUBDIRS += smpfatal04 +SUBDIRS += smpfatal05 +SUBDIRS += smpfatal06 +SUBDIRS += smpfatal07 +SUBDIRS += smpfatal08 +SUBDIRS += smpload01 SUBDIRS += smplock01 SUBDIRS += smpmigration01 SUBDIRS += smpscheduler01 +SUBDIRS += smpscheduler02 SUBDIRS += smpsignal01 SUBDIRS += smpswitchextension01 SUBDIRS += smpthreadlife01 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index 97b825bccc..ee36b50568 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -57,7 +57,6 @@ AM_CONDITIONAL(HAS_CPUSET,test x"${ac_cv_header_sys_cpuset_h}" = x"yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile -smpload01/Makefile smp01/Makefile smp02/Makefile smp03/Makefile @@ -70,12 +69,19 @@ smpatomic01/Makefile smpfatal01/Makefile smpfatal02/Makefile smpfatal03/Makefile +smpfatal04/Makefile +smpfatal05/Makefile +smpfatal06/Makefile +smpfatal07/Makefile +smpfatal08/Makefile +smpload01/Makefile smplock01/Makefile smpmigration01/Makefile smppsxaffinity01/Makefile smppsxaffinity02/Makefile smppsxsignal01/Makefile smpscheduler01/Makefile +smpscheduler02/Makefile smpsignal01/Makefile smpswitchextension01/Makefile smpthreadlife01/Makefile diff --git a/testsuites/smptests/smpfatal04/Makefile.am b/testsuites/smptests/smpfatal04/Makefile.am new file mode 100644 index 0000000000..0ee1f365b8 --- /dev/null +++ b/testsuites/smptests/smpfatal04/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpfatal04 +smpfatal04_SOURCES = init.c + +dist_rtems_tests_DATA = smpfatal04.scn smpfatal04.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 = $(smpfatal04_OBJECTS) +LINK_LIBS = $(smpfatal04_LDLIBS) + +smpfatal04$(EXEEXT): $(smpfatal04_OBJECTS) $(smpfatal04_DEPENDENCIES) + @rm -f smpfatal04$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpfatal04/init.c b/testsuites/smptests/smpfatal04/init.c new file mode 100644 index 0000000000..39ceebfd7b --- /dev/null +++ b/testsuites/smptests/smpfatal04/init.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/test.h> +#include <rtems/score/smpimpl.h> + +#include <assert.h> +#include <stdlib.h> + +const char rtems_test_name[] = "SMPFATAL 4"; + +static void Init(rtems_task_argument arg) +{ + assert(0); +} + +static void fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code code +) +{ + rtems_test_begink(); + + if ( + source == RTEMS_FATAL_SOURCE_SMP + && !is_internal + && code == SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER + ) { + rtems_test_endk(); + } +} + +#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_SMP_APPLICATION + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1 + +#define CONFIGURE_SCHEDULER_CONTROLS + +#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpfatal04/smpfatal04.doc b/testsuites/smptests/smpfatal04/smpfatal04.doc new file mode 100644 index 0000000000..cac62867f0 --- /dev/null +++ b/testsuites/smptests/smpfatal04/smpfatal04.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpfatal04 + +directives: + + - _SMP_Handler_initialize() + +concepts: + + - Ensure that the boot processor has a scheduler assigned. diff --git a/testsuites/smptests/smpfatal04/smpfatal04.scn b/testsuites/smptests/smpfatal04/smpfatal04.scn new file mode 100644 index 0000000000..d449a9e385 --- /dev/null +++ b/testsuites/smptests/smpfatal04/smpfatal04.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST SMPFATAL 4 *** +*** END OF TEST SMPFATAL 4 *** diff --git a/testsuites/smptests/smpfatal05/Makefile.am b/testsuites/smptests/smpfatal05/Makefile.am new file mode 100644 index 0000000000..066498d054 --- /dev/null +++ b/testsuites/smptests/smpfatal05/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpfatal05 +smpfatal05_SOURCES = init.c + +dist_rtems_tests_DATA = smpfatal05.scn smpfatal05.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 = $(smpfatal05_OBJECTS) +LINK_LIBS = $(smpfatal05_LDLIBS) + +smpfatal05$(EXEEXT): $(smpfatal05_OBJECTS) $(smpfatal05_DEPENDENCIES) + @rm -f smpfatal05$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpfatal05/init.c b/testsuites/smptests/smpfatal05/init.c new file mode 100644 index 0000000000..37b3deea4f --- /dev/null +++ b/testsuites/smptests/smpfatal05/init.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/test.h> +#include <rtems/score/smpimpl.h> + +#include <assert.h> +#include <stdlib.h> + +const char rtems_test_name[] = "SMPFATAL 5"; + +static void Init(rtems_task_argument arg) +{ + assert(0); +} + +static void fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code code +) +{ + rtems_test_begink(); + + if ( + source == RTEMS_FATAL_SOURCE_SMP + && !is_internal + && code == SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT + ) { + rtems_test_endk(); + } +} + +#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_SMP_APPLICATION + +/* Lets see when the first RTEMS system hits this limit */ +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 64 + +#define CONFIGURE_SCHEDULER_SIMPLE_SMP + +#include <rtems/scheduler.h> + +RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a); + +#define CONFIGURE_SCHEDULER_CONTROLS \ + RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P')) + +#define ASSIGN \ + RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) + +#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, \ + ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN, ASSIGN + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpfatal05/smpfatal05.doc b/testsuites/smptests/smpfatal05/smpfatal05.doc new file mode 100644 index 0000000000..91c37ad034 --- /dev/null +++ b/testsuites/smptests/smpfatal05/smpfatal05.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpfatal05 + +directives: + + - _SMP_Handler_initialize() + +concepts: + + - Ensure that all mandatory processors are present. diff --git a/testsuites/smptests/smpfatal05/smpfatal05.scn b/testsuites/smptests/smpfatal05/smpfatal05.scn new file mode 100644 index 0000000000..d3dcb82d14 --- /dev/null +++ b/testsuites/smptests/smpfatal05/smpfatal05.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST SMPFATAL 5 *** +*** END OF TEST SMPFATAL 5 *** diff --git a/testsuites/smptests/smpfatal06/Makefile.am b/testsuites/smptests/smpfatal06/Makefile.am new file mode 100644 index 0000000000..c0bdf5bb23 --- /dev/null +++ b/testsuites/smptests/smpfatal06/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpfatal06 +smpfatal06_SOURCES = init.c + +dist_rtems_tests_DATA = smpfatal06.scn smpfatal06.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 = $(smpfatal06_OBJECTS) +LINK_LIBS = $(smpfatal06_LDLIBS) + +smpfatal06$(EXEEXT): $(smpfatal06_OBJECTS) $(smpfatal06_DEPENDENCIES) + @rm -f smpfatal06$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpfatal06/init.c b/testsuites/smptests/smpfatal06/init.c new file mode 100644 index 0000000000..739da7a35d --- /dev/null +++ b/testsuites/smptests/smpfatal06/init.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/test.h> +#include <rtems/score/smpimpl.h> + +#include <assert.h> +#include <stdlib.h> + +const char rtems_test_name[] = "SMPFATAL 6"; + +static void Init(rtems_task_argument arg) +{ + assert(0); +} + +static void fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code code +) +{ + rtems_test_begink(); + + if ( + source == RTEMS_FATAL_SOURCE_SMP + && !is_internal + && code == SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS + ) { + rtems_test_endk(); + } +} + +#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_SMP_APPLICATION + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1 + +#define CONFIGURE_SCHEDULER_SIMPLE_SMP + +#include <rtems/scheduler.h> + +RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a); +RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(b); + +#define CONFIGURE_SCHEDULER_CONTROLS \ + RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P')), \ + RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(b, rtems_build_name('S', 'I', 'M', 'P')) + +#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \ + RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpfatal06/smpfatal06.doc b/testsuites/smptests/smpfatal06/smpfatal06.doc new file mode 100644 index 0000000000..e35b3b0a8e --- /dev/null +++ b/testsuites/smptests/smpfatal06/smpfatal06.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpfatal06 + +directives: + + - _SMP_Handler_initialize() + +concepts: + + - Ensure that a scheduler without processor leads to a fatal error. diff --git a/testsuites/smptests/smpfatal06/smpfatal06.scn b/testsuites/smptests/smpfatal06/smpfatal06.scn new file mode 100644 index 0000000000..575b2b3fb1 --- /dev/null +++ b/testsuites/smptests/smpfatal06/smpfatal06.scn @@ -0,0 +1,2 @@ +*** TEST SMPFATAL 6 *** +*** END OF TEST SMPFATAL 6 *** diff --git a/testsuites/smptests/smpfatal07/Makefile.am b/testsuites/smptests/smpfatal07/Makefile.am new file mode 100644 index 0000000000..724ff93d36 --- /dev/null +++ b/testsuites/smptests/smpfatal07/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpfatal07 +smpfatal07_SOURCES = init.c + +dist_rtems_tests_DATA = smpfatal07.scn smpfatal07.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 = $(smpfatal07_OBJECTS) +LINK_LIBS = $(smpfatal07_LDLIBS) + +smpfatal07$(EXEEXT): $(smpfatal07_OBJECTS) $(smpfatal07_DEPENDENCIES) + @rm -f smpfatal07$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpfatal07/init.c b/testsuites/smptests/smpfatal07/init.c new file mode 100644 index 0000000000..126274209d --- /dev/null +++ b/testsuites/smptests/smpfatal07/init.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/test.h> +#include <rtems/score/smpimpl.h> +#include <rtems/score/threadimpl.h> + +#include <assert.h> +#include <stdlib.h> + +const char rtems_test_name[] = "SMPFATAL 7"; + +static void Init(rtems_task_argument arg) +{ + Per_CPU_Control *cpu_self; + + _Thread_Disable_dispatch(); + cpu_self = _Per_CPU_Get(); + cpu_self->started = false; + _SMP_Start_multitasking_on_secondary_processor(); + + assert(0); +} + +static void fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code code +) +{ + rtems_test_begink(); + + if ( + source == RTEMS_FATAL_SOURCE_SMP + && !is_internal + && code == SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR + ) { + rtems_test_endk(); + } +} + +#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_SMP_APPLICATION + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1 + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpfatal07/smpfatal07.doc b/testsuites/smptests/smpfatal07/smpfatal07.doc new file mode 100644 index 0000000000..5f37225085 --- /dev/null +++ b/testsuites/smptests/smpfatal07/smpfatal07.doc @@ -0,0 +1,12 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpfatal07 + +directives: + + - _SMP_Start_multitasking_on_secondary_processor() + +concepts: + + - Ensure that a multitasking start on an unassigned processor leads to a + fatal error. diff --git a/testsuites/smptests/smpfatal07/smpfatal07.scn b/testsuites/smptests/smpfatal07/smpfatal07.scn new file mode 100644 index 0000000000..10252a6ca0 --- /dev/null +++ b/testsuites/smptests/smpfatal07/smpfatal07.scn @@ -0,0 +1,2 @@ +*** TEST SMPFATAL 7 *** +*** END OF TEST SMPFATAL 7 *** diff --git a/testsuites/smptests/smpfatal08/Makefile.am b/testsuites/smptests/smpfatal08/Makefile.am new file mode 100644 index 0000000000..da4e316af6 --- /dev/null +++ b/testsuites/smptests/smpfatal08/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpfatal08 +smpfatal08_SOURCES = init.c + +dist_rtems_tests_DATA = smpfatal08.scn smpfatal08.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 = $(smpfatal08_OBJECTS) +LINK_LIBS = $(smpfatal08_LDLIBS) + +smpfatal08$(EXEEXT): $(smpfatal08_OBJECTS) $(smpfatal08_DEPENDENCIES) + @rm -f smpfatal08$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpfatal08/init.c b/testsuites/smptests/smpfatal08/init.c new file mode 100644 index 0000000000..59fe4a6543 --- /dev/null +++ b/testsuites/smptests/smpfatal08/init.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/test.h> +#include <rtems/score/smpimpl.h> + +#include <assert.h> +#include <stdlib.h> + +const char rtems_test_name[] = "SMPFATAL 8"; + +/* + * This test is a hack since there is no easy way to test this fatal error path + * without BSP support. + */ + +#if defined(__PPC__) +void qoriq_secondary_cpu_initialize(void) +{ + /* Provided to avoid multiple definitions of the CPU SMP support functions */ +} +#endif + +#if defined(__sparc__) +void leon3_secondary_cpu_initialize(uint32_t cpu_index) +{ + (void) cpu_index; + + /* Provided to avoid multiple definitions of the CPU SMP support functions */ +} +#endif + +uint32_t _CPU_SMP_Initialize(void) +{ + return 2; +} + +bool _CPU_SMP_Start_processor(uint32_t cpu_index) +{ + (void) cpu_index; + + return false; +} + +void _CPU_SMP_Finalize_initialization(uint32_t cpu_count) +{ + (void) cpu_count; + + assert(0); +} + +#if !defined(__leon__) && !defined(__PPC__) && !defined(__arm__) +uint32_t _CPU_SMP_Get_current_processor(void) +{ + return 0; +} +#endif + +void _CPU_SMP_Send_interrupt(uint32_t target_processor_index) +{ + (void) target_processor_index; +} + +static void Init(rtems_task_argument arg) +{ + assert(0); +} + +static void fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code code +) +{ + rtems_test_begink(); + + if ( + source == RTEMS_FATAL_SOURCE_SMP + && !is_internal + && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED + ) { + rtems_test_endk(); + } +} + +#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_SMP_APPLICATION + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2 + +#define CONFIGURE_SCHEDULER_SIMPLE_SMP + +#include <rtems/scheduler.h> + +RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a); + +#define CONFIGURE_SCHEDULER_CONTROLS \ + RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P')) + +#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \ + RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ + RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpfatal08/smpfatal08.doc b/testsuites/smptests/smpfatal08/smpfatal08.doc new file mode 100644 index 0000000000..df52c9624c --- /dev/null +++ b/testsuites/smptests/smpfatal08/smpfatal08.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpfatal08 + +directives: + + - _SMP_Handler_initialize() + +concepts: + + - Ensure that a failed start of a mandatory processor leads to a fatal error. diff --git a/testsuites/smptests/smpfatal08/smpfatal08.scn b/testsuites/smptests/smpfatal08/smpfatal08.scn new file mode 100644 index 0000000000..10252a6ca0 --- /dev/null +++ b/testsuites/smptests/smpfatal08/smpfatal08.scn @@ -0,0 +1,2 @@ +*** TEST SMPFATAL 7 *** +*** END OF TEST SMPFATAL 7 *** diff --git a/testsuites/smptests/smpscheduler02/Makefile.am b/testsuites/smptests/smpscheduler02/Makefile.am new file mode 100644 index 0000000000..48a7072b02 --- /dev/null +++ b/testsuites/smptests/smpscheduler02/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpscheduler02 +smpscheduler02_SOURCES = init.c + +dist_rtems_tests_DATA = smpscheduler02.scn smpscheduler02.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 = $(smpscheduler02_OBJECTS) +LINK_LIBS = $(smpscheduler02_LDLIBS) + +smpscheduler02$(EXEEXT): $(smpscheduler02_OBJECTS) $(smpscheduler02_DEPENDENCIES) + @rm -f smpscheduler02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpscheduler02/init.c b/testsuites/smptests/smpscheduler02/init.c new file mode 100644 index 0000000000..f958744415 --- /dev/null +++ b/testsuites/smptests/smpscheduler02/init.c @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2014 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 + +#include <rtems.h> +#include <rtems/libcsupport.h> + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDULER 2"; + +#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) + +#define CPU_COUNT 2 + +#define SCHED_A rtems_build_name(' ', ' ', ' ', 'A') + +#define SCHED_B rtems_build_name(' ', ' ', ' ', 'B') + +static rtems_id main_task_id; + +static void task(rtems_task_argument arg) +{ + rtems_status_code sc; + + (void) arg; + + rtems_test_assert(rtems_get_current_processor() == 1); + + sc = rtems_event_transient_send(main_task_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + while (1) { + /* Do nothing */ + } +} + +static void test(void) +{ + rtems_status_code sc; + rtems_id task_id; + rtems_id scheduler_id; + rtems_id scheduler_a_id; + rtems_id scheduler_b_id; + cpu_set_t cpuset; + cpu_set_t first_cpu; + cpu_set_t second_cpu; + cpu_set_t all_cpus; + + main_task_id = rtems_task_self(); + + CPU_ZERO(&first_cpu); + CPU_SET(0, &first_cpu); + + CPU_ZERO(&second_cpu); + CPU_SET(1, &second_cpu); + + CPU_ZERO(&all_cpus); + CPU_SET(0, &all_cpus); + CPU_SET(1, &all_cpus); + + rtems_test_assert(rtems_get_current_processor() == 0); + + sc = rtems_scheduler_ident(SCHED_A, &scheduler_a_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_scheduler_ident(SCHED_B, &scheduler_b_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(scheduler_a_id != scheduler_b_id); + + CPU_ZERO(&cpuset); + sc = rtems_scheduler_get_processor_set( + scheduler_a_id, + sizeof(cpuset), + &cpuset + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(CPU_EQUAL(&cpuset, &first_cpu)); + + CPU_ZERO(&cpuset); + sc = rtems_scheduler_get_processor_set( + scheduler_b_id, + sizeof(cpuset), + &cpuset + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(CPU_EQUAL(&cpuset, &second_cpu)); + + 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_get_scheduler(task_id, &scheduler_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(scheduler_id == scheduler_a_id); + + CPU_ZERO(&cpuset); + sc = rtems_task_get_affinity(task_id, sizeof(cpuset), &cpuset); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(CPU_EQUAL(&cpuset, &first_cpu)); + + sc = rtems_task_set_scheduler(task_id, scheduler_b_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_get_scheduler(task_id, &scheduler_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(scheduler_id == scheduler_b_id); + + CPU_ZERO(&cpuset); + sc = rtems_task_get_affinity(task_id, sizeof(cpuset), &cpuset); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(CPU_EQUAL(&cpuset, &second_cpu)); + + sc = rtems_task_set_affinity(task_id, sizeof(all_cpus), &all_cpus); + rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + + sc = rtems_task_set_affinity(task_id, sizeof(first_cpu), &first_cpu); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_get_scheduler(task_id, &scheduler_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(scheduler_id == scheduler_a_id); + + sc = rtems_task_set_affinity(task_id, sizeof(second_cpu), &second_cpu); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_get_scheduler(task_id, &scheduler_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(scheduler_id == scheduler_b_id); + + sc = rtems_task_start(task_id, task, 0); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_set_scheduler(task_id, scheduler_a_id); + rtems_test_assert(sc == RTEMS_INCORRECT_STATE); + + sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_delete(task_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); +} + +#else /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */ + +static void test(void) +{ + /* Nothing to do */ +} + +#endif /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */ + +static void Init(rtems_task_argument arg) +{ + rtems_resource_snapshot snapshot; + + TEST_BEGIN(); + + rtems_resource_snapshot_take(&snapshot); + + test(); + + rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_SMP_APPLICATION + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS CPU_COUNT + +#define CONFIGURE_MAXIMUM_PRIORITY 255 + +#define CONFIGURE_SCHEDULER_PRIORITY_SMP + +#include <rtems/scheduler.h> + +RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(a, CONFIGURE_MAXIMUM_PRIORITY + 1); + +RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(b, CONFIGURE_MAXIMUM_PRIORITY + 1); + +#define CONFIGURE_SCHEDULER_CONTROLS \ + RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(a, SCHED_A), \ + RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(b, SCHED_B) + +#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \ + RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ + RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) + +#define CONFIGURE_MAXIMUM_TASKS CPU_COUNT + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/smptests/smpscheduler02/smpscheduler02.doc b/testsuites/smptests/smpscheduler02/smpscheduler02.doc new file mode 100644 index 0000000000..13c35c0b43 --- /dev/null +++ b/testsuites/smptests/smpscheduler02/smpscheduler02.doc @@ -0,0 +1,12 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpscheduler02 + +directives: + + - rtems_task_set_scheduler() + - rtems_task_start() + +concepts: + + - Ensure that start of a thread for another partition works. diff --git a/testsuites/smptests/smpscheduler02/smpscheduler02.scn b/testsuites/smptests/smpscheduler02/smpscheduler02.scn new file mode 100644 index 0000000000..47903c4abe --- /dev/null +++ b/testsuites/smptests/smpscheduler02/smpscheduler02.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST SMPSCHEDULER 2 *** +*** END OF TEST SMPSCHEDULER 2 *** diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c index 6c19abcfd0..30ea4ce8f9 100644 --- a/testsuites/sptests/spscheduler01/init.c +++ b/testsuites/sptests/spscheduler01/init.c @@ -35,6 +35,7 @@ static void test_task_get_set_affinity(void) { #if defined(__RTEMS_HAVE_SYS_CPUSET_H__) rtems_id self_id = rtems_task_self(); + rtems_id task_id; rtems_status_code sc; cpu_set_t cpusetone; cpu_set_t cpuset; @@ -46,6 +47,16 @@ static void test_task_get_set_affinity(void) CPU_ZERO(&cpusetone); CPU_SET(0, &cpusetone); + sc = rtems_task_create( + rtems_build_name('T', 'A', 'S', 'K'), + 2, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_affinity(RTEMS_SELF, sizeof(cpuset), NULL); rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); @@ -70,16 +81,19 @@ static void test_task_get_set_affinity(void) rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); sc = rtems_task_set_affinity(RTEMS_SELF, sizeof(cpuset), &cpuset); + rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + + sc = rtems_task_set_affinity(self_id, sizeof(cpuset), &cpuset); + rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + + sc = rtems_task_set_affinity(task_id, sizeof(cpuset), &cpuset); rtems_test_assert(sc == RTEMS_SUCCESSFUL); - sc = rtems_task_get_affinity(self_id, sizeof(cpuset), &cpuset); + sc = rtems_task_get_affinity(task_id, sizeof(cpuset), &cpuset); rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); - sc = rtems_task_set_affinity(self_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - cpusetbigone = CPU_ALLOC(big); rtems_test_assert(cpusetbigone != NULL); @@ -89,12 +103,15 @@ static void test_task_get_set_affinity(void) CPU_ZERO_S(cpusetbigsize, cpusetbigone); CPU_SET_S(0, cpusetbigsize, cpusetbigone); - sc = rtems_task_get_affinity(RTEMS_SELF, cpusetbigsize, cpusetbig); + sc = rtems_task_get_affinity(task_id, cpusetbigsize, cpusetbig); rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(CPU_EQUAL_S(cpusetbigsize, cpusetbig, cpusetbigone)); - sc = rtems_task_set_affinity(RTEMS_SELF, cpusetbigsize, cpusetbig); + sc = rtems_task_set_affinity(task_id, cpusetbigsize, cpusetbig); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_delete(task_id); rtems_test_assert(sc == RTEMS_SUCCESSFUL); CPU_FREE(cpusetbig); |