summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-06-29 15:21:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-06-29 15:21:30 +0200
commit7adf4941a8e4505a1d345607fb5a5d007595eb05 (patch)
tree73918bd39486b521b4389d506d00d0ed84ec93ba
parenttests: Move busy loop to test support (diff)
downloadrtems-7adf4941a8e4505a1d345607fb5a5d007595eb05.tar.bz2
smptests/smpschededf01: New test
Update #3056.
-rw-r--r--testsuites/smptests/Makefile.am1
-rw-r--r--testsuites/smptests/configure.ac1
-rw-r--r--testsuites/smptests/smpschededf01/Makefile.am19
-rw-r--r--testsuites/smptests/smpschededf01/init.c161
-rw-r--r--testsuites/smptests/smpschededf01/smpschededf01.doc12
-rw-r--r--testsuites/smptests/smpschededf01/smpschededf01.scn21
6 files changed, 215 insertions, 0 deletions
diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am
index 6c1bd1294f..01dc52e524 100644
--- a/testsuites/smptests/Makefile.am
+++ b/testsuites/smptests/Makefile.am
@@ -35,6 +35,7 @@ _SUBDIRS += smppsxaffinity02
_SUBDIRS += smpschedaffinity03
_SUBDIRS += smpschedaffinity04
_SUBDIRS += smpschedaffinity05
+_SUBDIRS += smpschededf01
_SUBDIRS += smpschedsem01
_SUBDIRS += smpscheduler01
_SUBDIRS += smpscheduler02
diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac
index 59b27ef397..f3a840b593 100644
--- a/testsuites/smptests/configure.ac
+++ b/testsuites/smptests/configure.ac
@@ -90,6 +90,7 @@ smpschedaffinity02/Makefile
smpschedaffinity03/Makefile
smpschedaffinity04/Makefile
smpschedaffinity05/Makefile
+smpschededf01/Makefile
smpschedsem01/Makefile
smpscheduler01/Makefile
smpscheduler02/Makefile
diff --git a/testsuites/smptests/smpschededf01/Makefile.am b/testsuites/smptests/smpschededf01/Makefile.am
new file mode 100644
index 0000000000..aaed6bcd33
--- /dev/null
+++ b/testsuites/smptests/smpschededf01/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = smpschededf01
+smpschededf01_SOURCES = init.c
+
+dist_rtems_tests_DATA = smpschededf01.scn smpschededf01.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 = $(smpschededf01_OBJECTS)
+LINK_LIBS = $(smpschededf01_LDLIBS)
+
+smpschededf01$(EXEEXT): $(smpschededf01_OBJECTS) $(smpschededf01_DEPENDENCIES)
+ @rm -f smpschededf01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smpschededf01/init.c b/testsuites/smptests/smpschededf01/init.c
new file mode 100644
index 0000000000..c1c995e69b
--- /dev/null
+++ b/testsuites/smptests/smpschededf01/init.c
@@ -0,0 +1,161 @@
+/*
+ * 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
+
+#include <rtems.h>
+#include <rtems/cpuuse.h>
+#include <rtems/printer.h>
+
+#include "tmacros.h"
+
+const char rtems_test_name[] = "SMPSCHEDEDF 1";
+
+typedef struct {
+ uint_fast32_t one_tick_busy;
+ rtems_id task[2];
+} test_context;
+
+static test_context test_instance;
+
+static void t(test_context *ctx, rtems_interval p, uint_fast32_t c)
+{
+ rtems_status_code sc;
+ rtems_id period;
+ rtems_name name;
+ uint_fast32_t busy;
+
+ sc = rtems_object_get_classic_name(rtems_task_self(), &name);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_rate_monotonic_create(name, &period);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ busy = (c - 1) * ctx->one_tick_busy + (4 * ctx->one_tick_busy) / 5;
+
+ while (true) {
+ rtems_test_busy(busy);
+
+ sc = rtems_rate_monotonic_period(period, p);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ }
+}
+
+static void t1(rtems_task_argument arg)
+{
+ test_context *ctx = (test_context *) arg;
+
+ t(ctx, 50, 25);
+}
+
+static void t2(rtems_task_argument arg)
+{
+ test_context *ctx = (test_context *) arg;
+
+ t(ctx, 75, 30);
+}
+
+static void test(test_context *ctx)
+{
+ rtems_status_code sc;
+ rtems_printer printer;
+
+ ctx->one_tick_busy = rtems_test_get_one_tick_busy_count();
+
+ sc = rtems_task_create(
+ rtems_build_name('T', '1', ' ', ' '),
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &ctx->task[0]
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_create(
+ rtems_build_name('T', '2', ' ', ' '),
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &ctx->task[1]
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_wake_after(1);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_start(ctx->task[0], t1, (rtems_task_argument) ctx);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_start(ctx->task[1], t2, (rtems_task_argument) ctx);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_cpu_usage_reset();
+
+ sc = rtems_task_wake_after(50 * 75);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_suspend(ctx->task[0]);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_suspend(ctx->task[1]);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_print_printer_printf(&printer);
+ rtems_cpu_usage_report_with_plugin(&printer);
+ rtems_rate_monotonic_report_statistics_with_plugin(&printer);
+}
+
+static void Init(rtems_task_argument arg)
+{
+ test_context *ctx = &test_instance;
+
+ TEST_BEGIN();
+
+ test(ctx);
+
+ TEST_END();
+ rtems_test_exit(0);
+}
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 1000
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+#define CONFIGURE_MAXIMUM_PERIODS 2
+
+#define CONFIGURE_SCHEDULER_EDF_SMP
+
+#include <rtems/scheduler.h>
+
+RTEMS_SCHEDULER_CONTEXT_EDF_SMP(a);
+
+#define CONFIGURE_SCHEDULER_CONTROLS \
+ RTEMS_SCHEDULER_CONTROL_EDF_SMP(a, rtems_build_name('E', 'D', 'F', ' '))
+
+#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \
+ RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY)
+
+#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/smpschededf01/smpschededf01.doc b/testsuites/smptests/smpschededf01/smpschededf01.doc
new file mode 100644
index 0000000000..ce5d6d4121
--- /dev/null
+++ b/testsuites/smptests/smpschededf01/smpschededf01.doc
@@ -0,0 +1,12 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: smpschededf01
+
+directives:
+
+ - EDF SMP scheduler job release/cancel operations
+
+concepts:
+
+ - Ensure that a task set schedulable with EDF runs correctly. This task set
+ is not schedulable with RMS.
diff --git a/testsuites/smptests/smpschededf01/smpschededf01.scn b/testsuites/smptests/smpschededf01/smpschededf01.scn
new file mode 100644
index 0000000000..0d8c0902d2
--- /dev/null
+++ b/testsuites/smptests/smpschededf01/smpschededf01.scn
@@ -0,0 +1,21 @@
+*** BEGIN OF TEST SMPSCHEDEDF 1 ***
+-------------------------------------------------------------------------------
+ CPU USAGE BY THREAD
+------------+----------------------------------------+---------------+---------
+ ID | NAME | SECONDS | PERCENT
+------------+----------------------------------------+---------------+---------
+ 0x09010001 | IDLE | 0.280040 | 7.420
+ 0x0a010001 | UI1 | 0.014090 | 0.372
+ 0x0a010002 | T1 | 1.943912 | 51.413
+ 0x0a010003 | T2 | 1.539647 | 40.679
+------------+----------------------------------------+---------------+---------
+ TIME SINCE LAST CPU USAGE RESET IN SECONDS: 3.784815
+-------------------------------------------------------------------------------
+Period information by period
+--- CPU times are in seconds ---
+--- Wall times are in seconds ---
+ ID OWNER COUNT MISSED CPU TIME WALL TIME
+ MIN/MAX/AVG MIN/MAX/AVG
+0x42010001 T1 75 0 0.025057/0.025513/0.025233 0.025134/0.031772/0.027562
+0x42010002 T2 49 0 0.030511/0.030741/0.030615 0.049538/0.056644/0.053052
+*** END OF TEST SMPSCHEDEDF 1 ***