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/samples | |
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/samples')
33 files changed, 1403 insertions, 0 deletions
diff --git a/testsuites/ada/samples/Makefile.am b/testsuites/ada/samples/Makefile.am new file mode 100644 index 0000000000..0aa25affad --- /dev/null +++ b/testsuites/ada/samples/Makefile.am @@ -0,0 +1,9 @@ +_SUBDIRS = hello ticker base_sp nsecs + +if HAS_MP +_SUBDIRS += base_mp +endif +DIST_SUBDIRS = hello ticker base_sp base_mp nsecs + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_mp/Makefile.am b/testsuites/ada/samples/base_mp/Makefile.am new file mode 100644 index 0000000000..ed05ebbd72 --- /dev/null +++ b/testsuites/ada/samples/base_mp/Makefile.am @@ -0,0 +1,21 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +_SUBDIRS = node1 node2 +#include $(top_srcdir)/ada.am + +#mptest$(EXEEXT): mptest.adb +# $(GNATCOMPILE) -margs -a $< -o $@ + +#if EXPADA +#noinst_PROGRAMS = mptest +#endif + +#mptest_exe_SOURCES = mptest.adb mptest.ads + +#EXTRA_DIST += node1/mptest-per_node_configuration.adb + +#EXTRA_DIST += node2/mptest-per_node_configuration.adb + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_mp/config.h b/testsuites/ada/samples/base_mp/config.h new file mode 100644 index 0000000000..33c9288f4c --- /dev/null +++ b/testsuites/ada/samples/base_mp/config.h @@ -0,0 +1,34 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* configuration information */ + +#define CONFIGURE_MP_APPLICATION + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +/* + * Put the overrides of default configuration parameters here. + */ + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/base_mp/mptest.adb b/testsuites/ada/samples/base_mp/mptest.adb new file mode 100644 index 0000000000..d4eef0a29f --- /dev/null +++ b/testsuites/ada/samples/base_mp/mptest.adb @@ -0,0 +1,100 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 1 of the RTEMS +-- Multiprocessor 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 RTEMS; +with RTEMS.INTERRUPT; +with RTEMS.TASKS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** SAMPLE MULTIPROCESSOR APPLICATION ***" ); + TEXT_IO.PUT( "Creating and starting an application task" ); + + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.INTERRUPT_LEVEL( 0 ), + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.APPLICATION_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- APPLICATION_TASK +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TID : RTEMS.ID; + 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" ); + + TEXT_IO.PUT( "This task was invoked with node argument (" ); + UNSIGNED32_IO.PUT( ARGUMENT ); + TEXT_IO.PUT_LINE( ")" ); + + TEXT_IO.PUT( "This task has the id of 0x" ); + UNSIGNED32_IO.PUT( TID, BASE => 16 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end APPLICATION_TASK; + +end MPTEST; diff --git a/testsuites/ada/samples/base_mp/mptest.ads b/testsuites/ada/samples/base_mp/mptest.ads new file mode 100644 index 0000000000..f246b4e0ed --- /dev/null +++ b/testsuites/ada/samples/base_mp/mptest.ads @@ -0,0 +1,62 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 1 of the RTEMS +-- Multiprocessor 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 MPTEST 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); + +-- +-- APPLICATION_TASK +-- +-- DESCRIPTION: +-- +-- This routine is as an example of an application task which +-- prints a message including its RTEMS task id. This task +-- then invokes exit to return to the monitor. +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, APPLICATION_TASK); + +end MPTEST; diff --git a/testsuites/ada/samples/base_mp/node1/Makefile.am b/testsuites/ada/samples/base_mp/node1/Makefile.am new file mode 100644 index 0000000000..c6ec8cd42b --- /dev/null +++ b/testsuites/ada/samples/base_mp/node1/Makefile.am @@ -0,0 +1,22 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +AM_ADAFLAGS += -I$(srcdir)/.. + +if EXPADA +noinst_PROGRAMS = ada_base_mp_node1 +ada_base_mp_node1_SOURCES = mptest-per_node_configuration.adb +endif + +ada_base_mp_node1$(EXEEXT): ../mptest.adb init.o + $(GNATCOMPILE) -margs -a $< -o $@ + +init.o: ../../../support/init.c + $(COMPILE.c) -DNODE_NUMBER=1 -I$(srcdir)/.. -c $< + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_base_mp-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_mp/node1/ada_base_mp-node1.scn b/testsuites/ada/samples/base_mp/node1/ada_base_mp-node1.scn new file mode 100644 index 0000000000..a2d2f359be --- /dev/null +++ b/testsuites/ada/samples/base_mp/node1/ada_base_mp-node1.scn @@ -0,0 +1,5 @@ +*** SAMPLE MULTIPROCESSOR APPLICATION *** +Creating and starting an application task +This task was invoked with the node argument (1) +This task has the id of 0x10002 +*** END OF SAMPLE MULTIPROCESSOR APPLICATION *** diff --git a/testsuites/ada/samples/base_mp/node2/Makefile.am b/testsuites/ada/samples/base_mp/node2/Makefile.am new file mode 100644 index 0000000000..9095902a0b --- /dev/null +++ b/testsuites/ada/samples/base_mp/node2/Makefile.am @@ -0,0 +1,22 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +AM_ADAFLAGS += -I$(srcdir)/.. + +if EXPADA +noinst_PROGRAMS = ada_base_mp_node2 +ada_base_mp_node2_SOURCES = mptest-per_node_configuration.adb +endif + +ada_base_mp_node2$(EXEEXT): ../mptest.adb init.o + $(GNATCOMPILE) -margs -a $< -o $@ + +init.o: ../../../support/init.c + $(COMPILE.c) -DNODE_NUMBER=2 -I$(srcdir)/.. -c $< + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_base_mp-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_mp/node2/ada_base_mp-node2.scn b/testsuites/ada/samples/base_mp/node2/ada_base_mp-node2.scn new file mode 100644 index 0000000000..95bc96a808 --- /dev/null +++ b/testsuites/ada/samples/base_mp/node2/ada_base_mp-node2.scn @@ -0,0 +1,5 @@ +*** SAMPLE MULTIPROCESSOR APPLICATION *** +Creating and starting an application task +This task was invoked with the node argument (2) +This task has the id of 0x20002 +*** END OF SAMPLE MULTIPROCESSOR APPLICATION *** diff --git a/testsuites/ada/samples/base_sp/Makefile.am b/testsuites/ada/samples/base_sp/Makefile.am new file mode 100644 index 0000000000..c6b2628735 --- /dev/null +++ b/testsuites/ada/samples/base_sp/Makefile.am @@ -0,0 +1,19 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +ada_base_sp$(EXEEXT): base_sp.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +init.$(OBJEXT): ../../support/init.c + $(COMPILE.c) -I$(srcdir) -c $< + +noinst_PROGRAMS = ada_base_sp + +ada_base_sp_SOURCES = base_sp.adb config.h sptest.adb sptest.ads + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_base_sp.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_sp/ada_base_sp.scn b/testsuites/ada/samples/base_sp/ada_base_sp.scn new file mode 100644 index 0000000000..7b8867dc85 --- /dev/null +++ b/testsuites/ada/samples/base_sp/ada_base_sp.scn @@ -0,0 +1,4 @@ +*** SAMPLE SINGLE PROCESSOR APPLICATION *** +Creating and starting an application task +Application task was invoked with argument ( 0) and has id of 0x16#A010002# +*** END OF SAMPLE SINGLE PROCESSOR APPLICATION *** diff --git a/testsuites/ada/samples/base_sp/base_sp.adb b/testsuites/ada/samples/base_sp/base_sp.adb new file mode 100644 index 0000000000..aaa1ab3bca --- /dev/null +++ b/testsuites/ada/samples/base_sp/base_sp.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Base Single Process Example of the +-- Sample 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 Base_SP 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 Base_SP; + diff --git a/testsuites/ada/samples/base_sp/config.h b/testsuites/ada/samples/base_sp/config.h new file mode 100644 index 0000000000..083d52515e --- /dev/null +++ b/testsuites/ada/samples/base_sp/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 2 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/base_sp/sptest.adb b/testsuites/ada/samples/base_sp/sptest.adb new file mode 100644 index 0000000000..85a847f281 --- /dev/null +++ b/testsuites/ada/samples/base_sp/sptest.adb @@ -0,0 +1,93 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 1 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 TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_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( "*** SAMPLE SINGLE PROCESSOR APPLICATION ***" ); + TEXT_IO.PUT_LINE( "Creating and starting an application task" ); + + SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.INTERRUPT_LEVEL( 0 ), + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 1 ), + SPTEST.APPLICATION_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- APPLICATION_TASK +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + + TEXT_IO.PUT( "Application task was invoked with argument (" ); + UNSIGNED32_IO.PUT( ARGUMENT ); + TEXT_IO.PUT( ") and has id of 0x" ); + UNSIGNED32_IO.PUT( TID, BASE => 16 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end APPLICATION_TASK; + +end SPTEST; diff --git a/testsuites/ada/samples/base_sp/sptest.ads b/testsuites/ada/samples/base_sp/sptest.ads new file mode 100644 index 0000000000..e35751cd32 --- /dev/null +++ b/testsuites/ada/samples/base_sp/sptest.ads @@ -0,0 +1,60 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 1 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); + +-- +-- APPLICATION_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS task which constitutes this test. +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, APPLICATION_TASK); + +end SPTEST; diff --git a/testsuites/ada/samples/hello/Makefile.am b/testsuites/ada/samples/hello/Makefile.am new file mode 100644 index 0000000000..9a6aa5eeb6 --- /dev/null +++ b/testsuites/ada/samples/hello/Makefile.am @@ -0,0 +1,19 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +ada_hello$(EXEEXT): hello.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +init.$(OBJEXT): ../../support/init.c + $(COMPILE.c) -I$(srcdir) -c $< + +noinst_PROGRAMS = ada_hello + +ada_hello_SOURCES = hello.adb config.h sptest.adb sptest.ads + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_hello.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/hello/ada_hello.scn b/testsuites/ada/samples/hello/ada_hello.scn new file mode 100644 index 0000000000..d9e92d81d5 --- /dev/null +++ b/testsuites/ada/samples/hello/ada_hello.scn @@ -0,0 +1,3 @@ +*** HELLO WORLD TEST *** +Hello World +*** END OF HELLO WORLD TEST *** diff --git a/testsuites/ada/samples/hello/config.h b/testsuites/ada/samples/hello/config.h new file mode 100644 index 0000000000..2be186cc2a --- /dev/null +++ b/testsuites/ada/samples/hello/config.h @@ -0,0 +1,31 @@ +/* config.h + * + * This include file defines the Configuration Table for this test. + * + * COPYRIGHT (c) 1989-2008. + * 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_APPLICATION + +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/hello/hello.adb b/testsuites/ada/samples/hello/hello.adb new file mode 100644 index 0000000000..f7748f3607 --- /dev/null +++ b/testsuites/ada/samples/hello/hello.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test Hello of the Sample 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 Hello 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 Hello; + diff --git a/testsuites/ada/samples/hello/sptest.adb b/testsuites/ada/samples/hello/sptest.adb new file mode 100644 index 0000000000..8c29155eba --- /dev/null +++ b/testsuites/ada/samples/hello/sptest.adb @@ -0,0 +1,44 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 1 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 TEXT_IO; + +package body SPTEST is + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** HELLO WORLD TEST ***" ); + TEXT_IO.PUT_LINE( "Hello World" ); + TEXT_IO.PUT_LINE( "*** END OF HELLO WORLD TEST ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end SPTEST; diff --git a/testsuites/ada/samples/hello/sptest.ads b/testsuites/ada/samples/hello/sptest.ads new file mode 100644 index 0000000000..62993b0220 --- /dev/null +++ b/testsuites/ada/samples/hello/sptest.ads @@ -0,0 +1,48 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for the Hello World Test of the RTEMS +-- Sample 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); + + +end SPTEST; diff --git a/testsuites/ada/samples/nsecs/Makefile.am b/testsuites/ada/samples/nsecs/Makefile.am new file mode 100644 index 0000000000..64a8145818 --- /dev/null +++ b/testsuites/ada/samples/nsecs/Makefile.am @@ -0,0 +1,19 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +ada_nsecs$(EXEEXT): nsecs.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +init.$(OBJEXT): ../../support/init.c + $(COMPILE.c) -I$(srcdir) -c $< + +noinst_PROGRAMS = ada_nsecs + +ada_nsecs_SOURCES = nsecs.adb config.h sptest.adb sptest.ads + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_nsecs.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/nsecs/ada_nsecs.scn b/testsuites/ada/samples/nsecs/ada_nsecs.scn new file mode 100644 index 0000000000..458f12c874 --- /dev/null +++ b/testsuites/ada/samples/nsecs/ada_nsecs.scn @@ -0,0 +1,27 @@ +*** NANOSECOND CLOCK TEST *** +10 iterations of getting TOD NOT tested in Ada + +10 iterations of getting Uptime +0: 9025000 0: 9034000 --> 0: 9000 +0: 10724000 0: 10733000 --> 0: 9000 +0: 12400000 0: 12409000 --> 0: 9000 +0: 14076000 0: 14085000 --> 0: 9000 +0: 15752000 0: 15761000 --> 0: 9000 +0: 17428000 0: 17438000 --> 0: 10000 +0: 19108000 0: 19117000 --> 0: 9000 +0: 20814000 0: 20823000 --> 0: 9000 +0: 22490000 0: 22499000 --> 0: 9000 +0: 24166000 0: 24175000 --> 0: 9000 + +10 iterations of getting Uptime with different loop values +loop of 10000 0: 26747000 0: 29758000 --> 0: 3011000 +loop of 20000 0: 31927000 0: 37938000 --> 0: 6011000 +loop of 30000 0: 40108000 0: 49118000 --> 0: 9010000 +loop of 40000 0: 51287000 0: 63327000 --> 0: 12040000 +loop of 50000 0: 65471000 0: 80541000 --> 0: 15070000 +loop of 60000 0: 82684000 0:100754000 --> 0: 18070000 +loop of 70000 0:102892000 0:123963000 --> 0: 21071000 +loop of 80000 0:126096000 0:150196000 --> 0: 24100000 +loop of 90000 0:152329000 0:179399000 --> 0: 27070000 +loop of 100000 0:181562000 0:211662000 --> 0: 30100000 +*** END OF NANOSECOND CLOCK TEST *** diff --git a/testsuites/ada/samples/nsecs/config.h b/testsuites/ada/samples/nsecs/config.h new file mode 100644 index 0000000000..7703e721f0 --- /dev/null +++ b/testsuites/ada/samples/nsecs/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_APPLICATION + +#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 1 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/nsecs/nsecs.adb b/testsuites/ada/samples/nsecs/nsecs.adb new file mode 100644 index 0000000000..0a8f84a606 --- /dev/null +++ b/testsuites/ada/samples/nsecs/nsecs.adb @@ -0,0 +1,54 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test Nsecs of the Sample 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 Nsecs 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 Nsecs; + diff --git a/testsuites/ada/samples/nsecs/sptest.adb b/testsuites/ada/samples/nsecs/sptest.adb new file mode 100644 index 0000000000..193fa09a45 --- /dev/null +++ b/testsuites/ada/samples/nsecs/sptest.adb @@ -0,0 +1,153 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of the Nanosecond test of the +-- Sample 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 Ada.Integer_Text_IO; +with Interfaces.C; +with RTEMS; +with RTEMS.Clock; +with Text_IO; +use type Interfaces.C.Long; +use type RTEMS.Time_T; + +package body SPTEST is + + Dummy_Variable : Natural := 0; + + procedure Simple_Procedure is + begin + Dummy_Variable := Dummy_Variable + 1; + end Simple_Procedure; + + procedure Subtract_Em ( + Start : in RTEMS.Timespec; + Stop : in RTEMS.Timespec; + Result : out RTEMS.Timespec + ) is + Nanoseconds_Per_Second : constant := 1000000000; + begin + if (Stop.TV_Nsec < Start.TV_Nsec) then + Result.TV_Sec := Stop.TV_Sec - Start.TV_Sec - 1; + Result.TV_Nsec := + (Nanoseconds_Per_Second - Start.TV_Nsec) + Stop.TV_Nsec; + else + Result.TV_Sec := Stop.TV_Sec - Start.TV_Sec; + Result.TV_Nsec := Stop.TV_Nsec - Start.TV_Nsec; + end if; + end Subtract_Em; + + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + Status : RTEMS.Status_Codes; + Start : RTEMS.Timespec; + Stop : RTEMS.Timespec; + Diff : RTEMS.Timespec; + Max : Integer; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** NANOSECOND CLOCK TEST ***" ); + + -- + -- Iterate 10 times showing difference in TOD + -- + + TEXT_IO.PUT_LINE( "10 iterations of getting TOD NOT tested in Ada" ); + + -- + -- Iterate 10 times showing difference in Uptime + -- + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( "10 iterations of getting Uptime" ); + + for Index in 1 .. 10 loop + + RTEMS.Clock.Get_Uptime( Start, Status ); + RTEMS.Clock.Get_Uptime( Stop, Status ); + + Subtract_Em( Start, Stop, Diff ); + + Ada.Integer_Text_IO.Put( Integer( Start.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Start.TV_Nsec ), 9 ); + Text_IO.Put( " " ); + Ada.Integer_Text_IO.Put( Integer( Stop.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Stop.TV_Nsec ), 9 ); + Text_IO.Put( " --> " ); + Ada.Integer_Text_IO.Put( Integer( Diff.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Diff.TV_Nsec ), 9 ); + Text_IO.New_Line; + end loop; + + -- + -- Iterate 10 times showing difference in Uptime with different counts + -- + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( + "10 iterations of getting Uptime with different loop values" + ); + + for Index in 1 .. 10 loop + Max := (Index * 10000); + RTEMS.Clock.Get_Uptime( Start, Status ); + for j in 1 .. Max loop + Simple_Procedure; + end loop; + RTEMS.Clock.Get_Uptime( Stop, Status ); + + Subtract_Em( Start, Stop, Diff ); + + Text_IO.Put( "loop of " ); + Ada.Integer_Text_IO.Put( Max, 6 ); + Text_IO.Put( " " ); + Ada.Integer_Text_IO.Put( Integer( Start.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Start.TV_Nsec ), 9 ); + Text_IO.Put( " " ); + Ada.Integer_Text_IO.Put( Integer( Stop.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Stop.TV_Nsec ), 9 ); + Text_IO.Put( " --> " ); + Ada.Integer_Text_IO.Put( Integer( Diff.TV_Sec ), 1 ); + Text_IO.Put( ":" ); + Ada.Integer_Text_IO.Put( Integer( Diff.TV_Nsec ), 9 ); + Text_IO.New_Line; + + end loop; + + delay( 1.0 ); + + TEXT_IO.PUT_LINE( "*** END OF NANOSECOND CLOCK TEST ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end SPTEST; diff --git a/testsuites/ada/samples/nsecs/sptest.ads b/testsuites/ada/samples/nsecs/sptest.ads new file mode 100644 index 0000000000..97fa00ac2c --- /dev/null +++ b/testsuites/ada/samples/nsecs/sptest.ads @@ -0,0 +1,39 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for the Nsecs Test of the RTEMS +-- Sample 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 + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +end SPTEST; diff --git a/testsuites/ada/samples/ticker/Makefile.am b/testsuites/ada/samples/ticker/Makefile.am new file mode 100644 index 0000000000..12594586b3 --- /dev/null +++ b/testsuites/ada/samples/ticker/Makefile.am @@ -0,0 +1,19 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +ada_ticker$(EXEEXT): ticker.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +init.$(OBJEXT): ../../support/init.c + $(COMPILE.c) -I$(srcdir) -c $< + +noinst_PROGRAMS = ada_ticker + +ada_ticker_SOURCES = ticker.adb config.h sptest.adb sptest.ads + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_ticker.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/ticker/ada_ticker.scn b/testsuites/ada/samples/ticker/ada_ticker.scn new file mode 100644 index 0000000000..89cd8b3204 --- /dev/null +++ b/testsuites/ada/samples/ticker/ada_ticker.scn @@ -0,0 +1,16 @@ +*** TEST 1 *** +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 +TA2 - clock_get - 9: 0:10 12/31/1988 +TA1 - clock_get - 9: 0:10 12/31/1988 +TA3 - clock_get - 9: 0:15 12/31/1988 +TA1 - clock_get - 9: 0:15 12/31/1988 +TA2 - clock_get - 9: 0:20 12/31/1988 +TA1 - clock_get - 9: 0:20 12/31/1988 +TA1 - clock_get - 9: 0:25 12/31/1988 +TA3 - clock_get - 9: 0:30 12/31/1988 +TA1 - clock_get - 9: 0:30 12/31/1988 +TA2 - clock_get - 9: 0:30 12/31/1988 +*** END OF CLOCK TICK TEST *** diff --git a/testsuites/ada/samples/ticker/config.h b/testsuites/ada/samples/ticker/config.h new file mode 100644 index 0000000000..17d957c94a --- /dev/null +++ b/testsuites/ada/samples/ticker/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 4 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/ticker/sptest.adb b/testsuites/ada/samples/ticker/sptest.adb new file mode 100644 index 0000000000..2de8b35b79 --- /dev/null +++ b/testsuites/ada/samples/ticker/sptest.adb @@ -0,0 +1,159 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 1 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); + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** TEST 1 ***" ); + + 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', ' ' ); + + 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_THROUGH_3'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 2 ), + SPTEST.TASK_1_THROUGH_3'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 3 ), + SPTEST.TASK_1_THROUGH_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_THROUGH_3 +-- + + procedure TASK_1_THROUGH_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + 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.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + if TIME.SECOND >= 35 then + TEXT_IO.PUT_LINE( "*** END OF CLOCK TICK TEST ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + end if; + + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + RTEMS.TASKS.WAKE_AFTER( + TEST_SUPPORT.TASK_NUMBER( TID ) * 5 * + TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end loop; + + end TASK_1_THROUGH_3; + +end SPTEST; diff --git a/testsuites/ada/samples/ticker/sptest.ads b/testsuites/ada/samples/ticker/sptest.ads new file mode 100644 index 0000000000..8753d3edad --- /dev/null +++ b/testsuites/ada/samples/ticker/sptest.ads @@ -0,0 +1,60 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 1 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_THROUGH_3 +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TASK_1_THROUGH_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1_THROUGH_3); + +end SPTEST; diff --git a/testsuites/ada/samples/ticker/ticker.adb b/testsuites/ada/samples/ticker/ticker.adb new file mode 100644 index 0000000000..08a1fb9e31 --- /dev/null +++ b/testsuites/ada/samples/ticker/ticker.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test Ticker of the Sample 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 Ticker 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 Ticker; + |