summaryrefslogtreecommitdiffstats
path: root/testsuites/ada/sptests/sp05
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-12 10:00:10 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-12 10:53:16 +0200
commitee537ea3dd964d4de3565a36b4857af31fb5a3f4 (patch)
treead8b328a58469ca0632e3e61cd94f37c9d97cc25 /testsuites/ada/sptests/sp05
parentada-tests: Use _SUBDIRS instead of SUBDIRS (diff)
downloadrtems-ee537ea3dd964d4de3565a36b4857af31fb5a3f4.tar.bz2
ada-tests: Move to testsuites/ada
This solves a build dependency issue, e.g. building tests before librtemsbsp.a exists. Close #3079.
Diffstat (limited to 'testsuites/ada/sptests/sp05')
-rw-r--r--testsuites/ada/sptests/sp05/Makefile.am16
-rw-r--r--testsuites/ada/sptests/sp05/ada_sp05.scn47
-rw-r--r--testsuites/ada/sptests/sp05/config.h32
-rw-r--r--testsuites/ada/sptests/sp05/sp05.adb55
-rw-r--r--testsuites/ada/sptests/sp05/sptest.adb224
-rw-r--r--testsuites/ada/sptests/sp05/sptest.ads86
6 files changed, 460 insertions, 0 deletions
diff --git a/testsuites/ada/sptests/sp05/Makefile.am b/testsuites/ada/sptests/sp05/Makefile.am
new file mode 100644
index 0000000000..d206e1b5da
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/Makefile.am
@@ -0,0 +1,16 @@
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+
+include $(top_srcdir)/ada.am
+
+noinst_PROGRAMS = ada_sp05
+ada_sp05_SOURCES = sp05.adb config.h sptest.adb sptest.ads
+ada_sp05_SOURCES += ../../support/init.c
+
+ada_sp05$(EXEEXT): sp05.adb init.$(OBJEXT)
+ $(GNATCOMPILE) -margs -a $< -o $@
+
+scndir = $(rtems_ada_testsdir)
+dist_scn_DATA = ada_sp05.scn
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/ada/sptests/sp05/ada_sp05.scn b/testsuites/ada/sptests/sp05/ada_sp05.scn
new file mode 100644
index 0000000000..591397f760
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/ada_sp05.scn
@@ -0,0 +1,47 @@
+*** TEST 5 ***
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_suspend - suspend self
+TA3 - task_suspend - suspend self
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+TA1 - task_wake_after - sleep 5 seconds
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA3 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA3
+TA1 - task_resume - resume TA2
+TA1 - task_wake_after - sleep 5 seconds
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA2 - task_wake_after - sleep 1 second
+TA1 - task_suspend - suspend TA2
+TA1 - task_resume - resume TA3
+*** END OF TEST 5 ***
diff --git a/testsuites/ada/sptests/sp05/config.h b/testsuites/ada/sptests/sp05/config.h
new file mode 100644
index 0000000000..d85c77e62b
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/config.h
@@ -0,0 +1,32 @@
+/* config.h
+ *
+ * This include file defines the Configuration Table for this test.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may in
+ * the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_TICKS_PER_TIMESLICE 100
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/ada/sptests/sp05/sp05.adb b/testsuites/ada/sptests/sp05/sp05.adb
new file mode 100644
index 0000000000..842657a699
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sp05.adb
@@ -0,0 +1,55 @@
+--
+-- MAIN / BODY
+--
+-- DESCRIPTION:
+--
+-- This is the entry point for Test SP05 of the Single Processor Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2011.
+-- On-Line Applications Research Corporation (OAR).
+--
+-- The license and distribution terms for this file may in
+-- the file LICENSE in this distribution or at
+-- http://www.rtems.org/license/LICENSE.
+--
+
+with RTEMS;
+with RTEMS.TASKS;
+with SPTEST;
+with TEST_SUPPORT;
+
+procedure SP05 is
+ INIT_ID : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+begin
+
+ RTEMS.TASKS.CREATE(
+ RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ),
+ 1,
+ RTEMS.MINIMUM_STACK_SIZE,
+ RTEMS.NO_PREEMPT,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ INIT_ID,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" );
+
+
+ RTEMS.TASKS.START(
+ INIT_ID,
+ SPTEST.INIT'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" );
+
+ loop
+ delay 120.0;
+ end loop;
+
+end SP05;
+
diff --git a/testsuites/ada/sptests/sp05/sptest.adb b/testsuites/ada/sptests/sp05/sptest.adb
new file mode 100644
index 0000000000..1a9b974419
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sptest.adb
@@ -0,0 +1,224 @@
+--
+-- SPTEST / BODY
+--
+-- DESCRIPTION:
+--
+-- This package is the implementation of Test 5 of the RTEMS
+-- Single Processor Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2011.
+-- On-Line Applications Research Corporation (OAR).
+--
+-- The license and distribution terms for this file may in
+-- the file LICENSE in this distribution or at
+-- http://www.rtems.org/license/LICENSE.
+--
+
+with INTERFACES; use INTERFACES;
+with TEST_SUPPORT;
+with TEXT_IO;
+
+package body SPTEST is
+
+--
+-- INIT
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.NEW_LINE( 2 );
+ TEXT_IO.PUT_LINE( "*** TEST 5 ***" );
+
+ SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' );
+ SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' );
+ SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 1 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 1 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 2 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" );
+
+ RTEMS.TASKS.CREATE(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ 2048,
+ RTEMS.DEFAULT_MODES,
+ RTEMS.DEFAULT_ATTRIBUTES,
+ SPTEST.TASK_ID( 3 ),
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 1 ),
+ SPTEST.TASK_1'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 2 ),
+ SPTEST.TASK_2'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" );
+
+ RTEMS.TASKS.START(
+ SPTEST.TASK_ID( 3 ),
+ SPTEST.TASK_3'ACCESS,
+ 0,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" );
+
+ RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
+
+ end INIT;
+
+--
+-- TASK_1
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ TID2 : RTEMS.ID;
+ TID3 : RTEMS.ID;
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 2 ),
+ 1,
+ TID2,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" );
+
+ RTEMS.TASKS.IDENT(
+ SPTEST.TASK_NAME( 3 ),
+ 1,
+ TID3,
+ STATUS
+ );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA3" );
+
+ for PASS in 1 .. 3
+ loop
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA1" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA3" );
+ RTEMS.TASKS.SUSPEND( TID3, STATUS );
+ if PASS = 1 then
+ TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
+ STATUS,
+ RTEMS.ALREADY_SUSPENDED,
+ "TASK_SUSPEND OF TA3"
+ );
+ else
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA3" );
+ end if;
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - resume TA2" );
+ RTEMS.TASKS.RESUME( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 5 seconds" );
+ RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA2" );
+ RTEMS.TASKS.SUSPEND( TID2, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ TEXT_IO.PUT_LINE( "TA1 - task_resume - resume TA3" );
+ RTEMS.TASKS.RESUME( TID3, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME OF TA3" );
+
+ end loop;
+
+ TEXT_IO.PUT_LINE( "*** END OF TEST 5 ***" );
+ RTEMS.SHUTDOWN_EXECUTIVE( 0 );
+
+ end TASK_1;
+
+--
+-- TASK_2
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA2 - task_suspend - suspend self" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA2" );
+
+ loop
+ TEXT_IO.PUT_LINE( "TA2 - task_wake_after - sleep 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA2" );
+ end loop;
+
+ end TASK_2;
+
+--
+-- TASK_3
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ ) is
+ pragma Unreferenced(ARGUMENT);
+ STATUS : RTEMS.STATUS_CODES;
+ begin
+
+ TEXT_IO.PUT_LINE( "TA3 - task_suspend - suspend self" );
+ RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND OF TA3" );
+
+ loop
+ TEXT_IO.PUT_LINE( "TA3 - task_wake_after - sleep 1 second" );
+ RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
+ TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER OF TA3" );
+ end loop;
+
+ end TASK_3;
+
+end SPTEST;
diff --git a/testsuites/ada/sptests/sp05/sptest.ads b/testsuites/ada/sptests/sp05/sptest.ads
new file mode 100644
index 0000000000..9fe136ec8b
--- /dev/null
+++ b/testsuites/ada/sptests/sp05/sptest.ads
@@ -0,0 +1,86 @@
+--
+-- SPTEST / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package is the specification for Test 5 of the RTEMS
+-- Single Processor Test Suite.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989-2011.
+-- On-Line Applications Research Corporation (OAR).
+--
+-- The license and distribution terms for this file may in
+-- the file LICENSE in this distribution or at
+-- http://www.rtems.org/license/LICENSE.
+--
+
+with RTEMS;
+with RTEMS.TASKS;
+
+package SPTEST is
+
+--
+-- These arrays contain the IDs and NAMEs of all RTEMS tasks created
+-- by this test.
+--
+
+ TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID;
+ TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME;
+
+--
+-- INIT
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task initializes the application.
+--
+
+ procedure INIT (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, INIT);
+
+--
+-- TASK_1
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_1 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_1);
+
+--
+-- TASK_2
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests some of the capabilities of the Task Manager.
+--
+
+ procedure TASK_2 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_2);
+
+--
+-- TASK_3
+--
+-- DESCRIPTION:
+--
+-- This RTEMS task tests the Message Queue Manager.
+--
+
+ procedure TASK_3 (
+ ARGUMENT : in RTEMS.TASKS.ARGUMENT
+ );
+ pragma Convention (C, TASK_3);
+
+end SPTEST;