diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-12 10:00:10 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-12 10:53:16 +0200 |
commit | ee537ea3dd964d4de3565a36b4857af31fb5a3f4 (patch) | |
tree | ad8b328a58469ca0632e3e61cd94f37c9d97cc25 /testsuites/ada/sptests/sp03 | |
parent | ada-tests: Use _SUBDIRS instead of SUBDIRS (diff) | |
download | rtems-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/sp03')
-rw-r--r-- | testsuites/ada/sptests/sp03/Makefile.am | 16 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp03/ada_sp03.scn | 26 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp03/config.h | 30 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp03/sp03.adb | 55 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp03/sptest.adb | 169 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp03/sptest.ads | 75 |
6 files changed, 371 insertions, 0 deletions
diff --git a/testsuites/ada/sptests/sp03/Makefile.am b/testsuites/ada/sptests/sp03/Makefile.am new file mode 100644 index 0000000000..9a7ccfa1b8 --- /dev/null +++ b/testsuites/ada/sptests/sp03/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_sp03 +ada_sp03_SOURCES = sp03.adb config.h sptest.adb sptest.ads +ada_sp03_SOURCES += ../../support/init.c + +ada_sp03$(EXEEXT): sp03.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_sp03.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/sptests/sp03/ada_sp03.scn b/testsuites/ada/sptests/sp03/ada_sp03.scn new file mode 100644 index 0000000000..a2a04c6951 --- /dev/null +++ b/testsuites/ada/sptests/sp03/ada_sp03.scn @@ -0,0 +1,26 @@ +*** TEST 3 *** +TA1 sets clock: 9:15: 0 12/31/1988 +TA1 going to sleep: 9:15: 0 12/31/1988 +TA2 9:15: 1 12/31/1988 +TA2 9:15: 2 12/31/1988 +TA2 9:15: 3 12/31/1988 +TA2 9:15: 4 12/31/1988 +TA1 awakened: 9:15: 5 12/31/1988 +TA1 going to sleep: 9:15: 5 12/31/1988 +TA2 9:15: 5 12/31/1988 +TA2 9:15: 6 12/31/1988 +TA2 9:15: 7 12/31/1988 +TA2 9:15: 8 12/31/1988 +TA2 9:15: 9 12/31/1988 +TA1 awakened: 9:15:10 12/31/1988 +TA1 going to sleep: 9:15:10 12/31/1988 +TA2 9:15:10 12/31/1988 +TA2 9:15:11 12/31/1988 +TA2 9:15:12 12/31/1988 +TA2 9:15:13 12/31/1988 +TA2 9:15:14 12/31/1988 +TA1 awakened: 9:15:15 12/31/1988 +TA1 going to sleep: 9:15:15 12/31/1988 +TA2 9:15:15 12/31/1988 +TA2 9:15:16 12/31/1988 +*** END OF TEST 3 *** diff --git a/testsuites/ada/sptests/sp03/config.h b/testsuites/ada/sptests/sp03/config.h new file mode 100644 index 0000000000..393afc4b28 --- /dev/null +++ b/testsuites/ada/sptests/sp03/config.h @@ -0,0 +1,30 @@ +/* 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_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_MAXIMUM_TASKS 3 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/sptests/sp03/sp03.adb b/testsuites/ada/sptests/sp03/sp03.adb new file mode 100644 index 0000000000..5f081d4879 --- /dev/null +++ b/testsuites/ada/sptests/sp03/sp03.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test SP03 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 SP03 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 SP03; + diff --git a/testsuites/ada/sptests/sp03/sptest.adb b/testsuites/ada/sptests/sp03/sptest.adb new file mode 100644 index 0000000000..24be47eb1c --- /dev/null +++ b/testsuites/ada/sptests/sp03/sptest.adb @@ -0,0 +1,169 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 3 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; +with RTEMS.CLOCK; + +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 3 ***" ); + + SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 1 ), + 1, + RTEMS.MINIMUM_STACK_SIZE, + 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, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" ); + + 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.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); + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + TIME := ( 1988, 12, 31, 9, 15, 0, 0 ); + + RTEMS.CLOCK.SET( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" ); + + TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE ); + TEST_SUPPORT.PRINT_TIME( "sets clock: ", TIME, "" ); + TEXT_IO.NEW_LINE; + + loop + + RTEMS.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE ); + TEST_SUPPORT.PRINT_TIME( "going to sleep: ", TIME, "" ); + TEXT_IO.NEW_LINE; + + TIME.SECOND := TIME.SECOND + 5; + TIME.MINUTE := TIME.MINUTE + (TIME.SECOND / 60 ); + TIME.SECOND := TIME.SECOND mod 60; + TIME.HOUR := TIME.HOUR + (TIME.MINUTE / 60 ); + TIME.MINUTE := TIME.MINUTE mod 60; + TIME.HOUR := TIME.HOUR mod 24; + + RTEMS.TASKS.WAKE_WHEN( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_WHEN" ); + + TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 1 ), FALSE ); + TEST_SUPPORT.PRINT_TIME( "awakened: ", TIME, "" ); + TEXT_IO.NEW_LINE; + + end loop; + + end TASK_1; + +-- +-- TASK_2 +-- + + procedure TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + loop + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + RTEMS.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + if TIME.SECOND >= 17 then + TEXT_IO.PUT_LINE( "*** END OF TEST 3 ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + end if; + + TEST_SUPPORT.PUT_NAME( SPTEST.TASK_NAME( 2 ), FALSE ); + TEST_SUPPORT.PRINT_TIME( " ", TIME, "" ); + TEXT_IO.NEW_LINE; + + end loop; + + end TASK_2; + +end SPTEST; diff --git a/testsuites/ada/sptests/sp03/sptest.ads b/testsuites/ada/sptests/sp03/sptest.ads new file mode 100644 index 0000000000..60a2531ba1 --- /dev/null +++ b/testsuites/ada/sptests/sp03/sptest.ads @@ -0,0 +1,75 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 3 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 the TASK_WAKE_WHEN directive of +-- the Task Manager. +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1); + +-- +-- TASK_2 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests the TASK_WAKE_AFTER directive of +-- the Task Manager. +-- + + procedure TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_2); + +end SPTEST; |