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/sp24 | |
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/sp24')
-rw-r--r-- | testsuites/ada/sptests/sp24/Makefile.am | 16 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp24/ada_sp24.scn | 16 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp24/config.h | 31 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp24/sp24.adb | 55 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp24/sptest.adb | 167 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp24/sptest.ads | 83 |
6 files changed, 368 insertions, 0 deletions
diff --git a/testsuites/ada/sptests/sp24/Makefile.am b/testsuites/ada/sptests/sp24/Makefile.am new file mode 100644 index 0000000000..a8ebaecb52 --- /dev/null +++ b/testsuites/ada/sptests/sp24/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_sp24 +ada_sp24_SOURCES = sp24.adb config.h sptest.adb sptest.ads +ada_sp24_SOURCES += ../../support/init.c + +ada_sp24$(EXEEXT): sp24.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_sp24.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/sptests/sp24/ada_sp24.scn b/testsuites/ada/sptests/sp24/ada_sp24.scn new file mode 100644 index 0000000000..eb626eb6b2 --- /dev/null +++ b/testsuites/ada/sptests/sp24/ada_sp24.scn @@ -0,0 +1,16 @@ +*** TEST 24 *** +TA1 - clock_get - 9: 0: 0 12/31/1988 +TA2 - clock_get - 9: 0: 0 12/31/1988 +TA3 - clock_get - 9: 0: 0 12/31/1988 +TA1 - clock_get - 9: 0: 5 12/31/1988 +TA1 - clock_get - 9: 0:10 12/31/1988 +TA2 - clock_get - 9: 0:10 12/31/1988 +TA1 - clock_get - 9: 0:15 12/31/1988 +TA3 - clock_get - 9: 0:15 12/31/1988 +TA1 - clock_get - 9: 0:20 12/31/1988 +TA2 - clock_get - 9: 0:20 12/31/1988 +TA1 - clock_get - 9: 0:25 12/31/1988 +TA1 - clock_get - 9: 0:30 12/31/1988 +TA3 - clock_get - 9: 0:30 12/31/1988 +TA2 - clock_get - 9: 0:30 12/31/1988 +*** END OF TEST 24 *** diff --git a/testsuites/ada/sptests/sp24/config.h b/testsuites/ada/sptests/sp24/config.h new file mode 100644 index 0000000000..a72dd35dac --- /dev/null +++ b/testsuites/ada/sptests/sp24/config.h @@ -0,0 +1,31 @@ +/* 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_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TIMERS 3 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/sptests/sp24/sp24.adb b/testsuites/ada/sptests/sp24/sp24.adb new file mode 100644 index 0000000000..e56802640b --- /dev/null +++ b/testsuites/ada/sptests/sp24/sp24.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test SP24 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 SP24 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 SP24; + diff --git a/testsuites/ada/sptests/sp24/sptest.adb b/testsuites/ada/sptests/sp24/sptest.adb new file mode 100644 index 0000000000..4245036995 --- /dev/null +++ b/testsuites/ada/sptests/sp24/sptest.adb @@ -0,0 +1,167 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 24 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; +with RTEMS.TIMER; + +package body SPTEST is + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** TEST 24 ***" ); + + TIME := ( 1988, 12, 31, 9, 0, 0, 0 ); + + RTEMS.CLOCK.SET( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" ); + + 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', ' ' ); + + SPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + SPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' ); + SPTEST.TIMER_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'M', '3', ' ' ); + + for INDEX in 1 .. 3 + loop + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( INDEX ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" ); + + RTEMS.TIMER.CREATE( + SPTEST.TIMER_NAME( INDEX ), + SPTEST.TIMER_ID( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE LOOP" ); + + end loop; + + for INDEX in 1 .. 3 + loop + + RTEMS.TASKS.START( + SPTEST.TASK_ID( INDEX ), + SPTEST.TASK_1_THROUGH_3'ACCESS, + RTEMS.TASKS.ARGUMENT( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" ); + + end loop; + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- RESUME_TASK +-- + + procedure RESUME_TASK ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + pragma Unreferenced(IGNORED_ADDRESS); + TASK_TO_RESUME : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + TASK_TO_RESUME := SPTEST.TASK_ID(INTEGER( RTEMS.GET_INDEX( TIMER_ID ) )); + RTEMS.TASKS.RESUME( TASK_TO_RESUME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" ); + + end RESUME_TASK; + +-- +-- TASK_1_THROUGH_3 +-- + + procedure TASK_1_THROUGH_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TID : RTEMS.ID; + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" ); + + loop + + RTEMS.TIMER.FIRE_AFTER( + SPTEST.TIMER_ID( INTEGER( ARGUMENT ) ), + TEST_SUPPORT.TASK_NUMBER( TID ) * 5 * + TEST_SUPPORT.TICKS_PER_SECOND, + SPTEST.RESUME_TASK'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + RTEMS.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + if TIME.SECOND >= 35 then + TEXT_IO.PUT_LINE( "*** END OF TEST 24 ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + end if; + + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( INTEGER( TEST_SUPPORT.TASK_NUMBER( TID ) ) ), + FALSE + ); + + TEST_SUPPORT.PRINT_TIME( " - clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + RTEMS.TASKS.SUSPEND( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" ); + + end loop; + + end TASK_1_THROUGH_3; + +end SPTEST; diff --git a/testsuites/ada/sptests/sp24/sptest.ads b/testsuites/ada/sptests/sp24/sptest.ads new file mode 100644 index 0000000000..166ee812b3 --- /dev/null +++ b/testsuites/ada/sptests/sp24/sptest.ads @@ -0,0 +1,83 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 24 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 ( 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( 1 .. 3 ) of RTEMS.ID; + TIMER_NAME : array ( 1 .. 3 ) of RTEMS.NAME; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- RESUME_TASK +-- +-- DESCRIPTION: +-- +-- This subprogram is scheduled as a timer service routine. When +-- it fires it resumes the task which is mapped to this timer. +-- + + procedure RESUME_TASK ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + pragma Convention (C, RESUME_TASK); + +-- +-- TASK_1_THROUGH_3 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests the Timer Manager. +-- + + procedure TASK_1_THROUGH_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1_THROUGH_3); + +end SPTEST; |