From 4575ae0a40c3dcd7a03b52d93d0d3a2adb2b154c Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 10 Mar 2014 13:39:31 +0100 Subject: smptests/smpload01: New test --- testsuites/smptests/Makefile.am | 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpload01/Makefile.am | 19 +++ testsuites/smptests/smpload01/init.c | 138 ++++++++++++++++++++++ testsuites/smptests/smpload01/smpload01.doc | 13 +++ testsuites/smptests/smpload01/smpload01.scn | 172 ++++++++++++++++++++++++++++ 6 files changed, 344 insertions(+) create mode 100644 testsuites/smptests/smpload01/Makefile.am create mode 100644 testsuites/smptests/smpload01/init.c create mode 100644 testsuites/smptests/smpload01/smpload01.doc create mode 100644 testsuites/smptests/smpload01/smpload01.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 1f4b0b3f0d..c7fa0286ab 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -1,6 +1,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = +SUBDIRS += smpload01 if SMPTESTS SUBDIRS += smp01 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index a2e99ebd8b..0d08f0db1a 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -57,6 +57,7 @@ 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 diff --git a/testsuites/smptests/smpload01/Makefile.am b/testsuites/smptests/smpload01/Makefile.am new file mode 100644 index 0000000000..7e41337866 --- /dev/null +++ b/testsuites/smptests/smpload01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpload01 +smpload01_SOURCES = init.c + +dist_rtems_tests_DATA = smpload01.scn smpload01.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 = $(smpload01_OBJECTS) +LINK_LIBS = $(smpload01_LDLIBS) + +smpload01$(EXEEXT): $(smpload01_OBJECTS) $(smpload01_DEPENDENCIES) + @rm -f smpload01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpload01/init.c b/testsuites/smptests/smpload01/init.c new file mode 100644 index 0000000000..c7bfb37c16 --- /dev/null +++ b/testsuites/smptests/smpload01/init.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2014 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 + +#include "tmacros.h" + +#include +#include + +#define CPU_COUNT 32 + +#define WORKER_COUNT (3 * CPU_COUNT) + +struct { + rtems_id sema_prio_inherit; + rtems_id sema_prio_ceiling; +} test_context; + +static uint32_t simple_random(uint32_t v) +{ + v *= 1664525; + v += 1013904223; + + return v; +} + +static void worker_task(rtems_task_argument arg) +{ + uint32_t v = arg; + + while (true) { + rtems_status_code sc; + rtems_id id; + + v = simple_random(v); + + if ((v & 0x80000000) != 0) { + id = test_context.sema_prio_inherit; + } else { + id = test_context.sema_prio_ceiling; + } + + sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_wake_after(1); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_semaphore_release(id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + } +} + +static void test(void) +{ + uint32_t i; + rtems_status_code sc; + rtems_id id; + + sc = rtems_semaphore_create( + rtems_build_name('I', 'N', 'H', 'R'), + 1, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, + 0, + &test_context.sema_prio_inherit + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_semaphore_create( + rtems_build_name('C', 'E', 'I', 'L'), + 1, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING, + 2, + &test_context.sema_prio_ceiling + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + for (i = 0; i < WORKER_COUNT; ++i) { + sc = rtems_task_create( + rtems_build_name('W', 'O', 'R', 'K'), + 3 + i, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_task_start(id, worker_task, i); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + } + + sc = rtems_task_wake_after(10 * rtems_clock_get_ticks_per_second()); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + rtems_profiling_report_xml("SMPLOAD 1", rtems_printf_plugin, NULL, 1, " "); +} + +static void Init(rtems_task_argument arg) +{ + puts("\n\n*** TEST SMPLOAD 1 ***"); + + test(); + + puts("*** END OF TEST SMPLOAD 1 ***"); + + 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_TASKS (1 + WORKER_COUNT) +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include diff --git a/testsuites/smptests/smpload01/smpload01.doc b/testsuites/smptests/smpload01/smpload01.doc new file mode 100644 index 0000000000..9777502839 --- /dev/null +++ b/testsuites/smptests/smpload01/smpload01.doc @@ -0,0 +1,13 @@ +This file describes the directives and concepts tested by this test set. + +test set name: smpload01 + +directives: + + - rtems_semaphore_obtain() + - rtems_semaphore_release() + - rtems_profiling_report_xml() + +concepts: + + - Produce some system load to get profiling data samples. diff --git a/testsuites/smptests/smpload01/smpload01.scn b/testsuites/smptests/smpload01/smpload01.scn new file mode 100644 index 0000000000..b97c719330 --- /dev/null +++ b/testsuites/smptests/smpload01/smpload01.scn @@ -0,0 +1,172 @@ +*** TEST SMPLOAD 1 *** + + + 110405 + 5165 + 170810415 + 215600 + 78390 + 1061 + 89412555 + + + 132930 + 4105 + 142276895 + 8030 + 0 + 1029 + 3350735 + + + 96015 + 4086 + 138497785 + 8645 + 0 + 1025 + 3154355 + + + 207895 + 4143 + 151584650 + 11145 + 0 + 1122 + 2717540 + + + 7415 + 19980 + 13 + 29500 + 63445 + 13 + 0 + 0 + 0 + + + 2080 + 5300 + 3 + 5810 + 14905 + 3 + 0 + 0 + 0 + + + 66395 + 16045 + 12 + 169185 + 84470 + 7 + 4 + 1 + 0 + + + 27355 + 81595 + 6526 + 16099290 + 89849335 + 5922 + 604 + 0 + 0 + + + 36025 + 146465 + 5552 + 22070045 + 74385305 + 4629 + 923 + 0 + 0 + + + 16895 + 83280 + 4728 + 18585920 + 59083815 + 3868 + 860 + 0 + 0 + + + 26365 + 94130 + 6506 + 17592735 + 92991200 + 6170 + 336 + 0 + 0 + + + 245180 + 232130 + 10102 + 416556635 + 529718895 + 1950 + 4735 + 2441 + 976 + + + 7555 + 8805 + 12 + 24785 + 28550 + 12 + 0 + 0 + 0 + + + 8400 + 18135 + 12736 + 36411665 + 51414560 + 12728 + 8 + 0 + 0 + + + 2940 + 4835 + 43 + 74160 + 86065 + 43 + 0 + 0 + 0 + + + 9740 + 15735 + 1 + 9740 + 15735 + 1 + 0 + 0 + 0 + + +*** END OF TEST SMPLOAD 1 *** -- cgit v1.2.3