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/mptests | |
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/mptests')
158 files changed, 8466 insertions, 0 deletions
diff --git a/testsuites/ada/mptests/Makefile.am b/testsuites/ada/mptests/Makefile.am new file mode 100644 index 0000000000..733c9edb94 --- /dev/null +++ b/testsuites/ada/mptests/Makefile.am @@ -0,0 +1,17 @@ +_SUBDIRS = +_SUBDIRS += mp01 +_SUBDIRS += mp03 +_SUBDIRS += mp04 +_SUBDIRS += mp05 +_SUBDIRS += mp06 +_SUBDIRS += mp07 +_SUBDIRS += mp08 +_SUBDIRS += mp09 +_SUBDIRS += mp10 +_SUBDIRS += mp11 +_SUBDIRS += mp12 +_SUBDIRS += mp13 +_SUBDIRS += mp14 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp01/Makefile.am b/testsuites/ada/mptests/mp01/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp01/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp01/config_base.h b/testsuites/ada/mptests/mp01/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp01/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp01/mp01.adb b/testsuites/ada/mptests/mp01/mp01.adb new file mode 100644 index 0000000000..6e89f9306d --- /dev/null +++ b/testsuites/ada/mptests/mp01/mp01.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP01 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP01 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.GLOBAL, + INIT_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" ); + + + RTEMS.TASKS.START( + INIT_ID, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP01; + diff --git a/testsuites/ada/mptests/mp01/mptest.adb b/testsuites/ada/mptests/mp01/mptest.adb new file mode 100644 index 0000000000..b76a1af8dc --- /dev/null +++ b/testsuites/ada/mptests/mp01/mptest.adb @@ -0,0 +1,230 @@ +-- +-- 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.CLOCK; +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 + C : CHARACTER; + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 1 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + if TEST_SUPPORT.NODE /= 1 then + C := 'S'; + else + C := 'M'; + end if; + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( C, 'A', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( C, 'A', '2', ' ' ); + MPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( C, 'A', '3', ' ' ); + + TIME := ( 1988, 12, 31, 9, 0, 0, 0 ); + + RTEMS.CLOCK.SET( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" ); + + TEXT_IO.PUT_LINE( "Creating task 1 (Global)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + TEXT_IO.PUT_LINE( "Creating task 2 (Global)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" ); + + TEXT_IO.PUT_LINE( "Creating task 3 (Local)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 3 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 3 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 3 ), + MPTEST.TEST_TASK'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; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TIME : RTEMS.TIME_OF_DAY; + 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" ); + + RTEMS.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + TEST_SUPPORT.PUT_NAME( + MPTEST.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" ); + + RTEMS.CLOCK.GET_TOD( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET_TOD" ); + + TEST_SUPPORT.PUT_NAME( + MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + if TEST_SUPPORT.TASK_NUMBER( TID ) = 1 then -- TASK 1 + + TEST_SUPPORT.PUT_NAME( + MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEXT_IO.PUT_LINE( " - deleting self" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + else if TEST_SUPPORT.TASK_NUMBER( TID ) = 2 then -- TASK 2 + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), FALSE ); + TEXT_IO.PUT( " - waiting to be deleted by " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), TRUE ); + + loop + TEST_SUPPORT.DO_NOTHING; -- can't be optimized away + end loop; + + else -- TASK 3 + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE ); + TEXT_IO.PUT( " - getting TID of " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE ); + + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( 2 ), + RTEMS.SEARCH_ALL_NODES, + TID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE ); + TEXT_IO.PUT( " - deleting " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE ); + + RTEMS.TASKS.DELETE( TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" ); + + end if; + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 1 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp01/mptest.ads b/testsuites/ada/mptests/mp01/mptest.ads new file mode 100644 index 0000000000..81f004a8e3 --- /dev/null +++ b/testsuites/ada/mptests/mp01/mptest.ads @@ -0,0 +1,60 @@ +-- +-- 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); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp01/node1/Makefile.am b/testsuites/ada/mptests/mp01/node1/Makefile.am new file mode 100644 index 0000000000..154504ae33 --- /dev/null +++ b/testsuites/ada/mptests/mp01/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp01_ada_mp01_node1 +mp01_ada_mp01_node1_SOURCES = mp01_node1.adb ../mptest.adb config.h +mp01_ada_mp01_node1_SOURCES += ../mptest.ads +mp01_ada_mp01_node1_SOURCES += ../../../support/init.c + +mp01_ada_mp01_node1$(EXEEXT): mp01_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp01-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp01/node1/ada_mp01-node1.scn b/testsuites/ada/mptests/mp01/node1/ada_mp01-node1.scn new file mode 100644 index 0000000000..d7495bfa0d --- /dev/null +++ b/testsuites/ada/mptests/mp01/node1/ada_mp01-node1.scn @@ -0,0 +1,15 @@ +*** TEST 1 -- NODE 1 *** +Creating task 1 (Global) +Creating task 2 (Global) +Creating task 3 (Local) +MA1 - clock_get - 9: 0: 0 12/31/1988 +MA2 - clock_get - 9: 0: 0 12/31/1988 +MA3 - clock_get - 9: 0: 0 12/31/1988 +MA1 - clock_get - 9: 0: 5 12/31/1988 +MA1 - deleting self +MA2 - clock_get - 9: 0:10 12/31/1988 +MA2 - waiting to be deleted by MA3 +MA3 - clock_get - 9: 0:15 12/31/1988 +MA3 - getting TID of MA2 +MA3 - deleting MA2 +*** END OF TEST 1 *** diff --git a/testsuites/ada/mptests/mp01/node1/config.h b/testsuites/ada/mptests/mp01/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp01/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp01/node1/mp01_node1.adb b/testsuites/ada/mptests/mp01/node1/mp01_node1.adb new file mode 100644 index 0000000000..c1f54ccd32 --- /dev/null +++ b/testsuites/ada/mptests/mp01/node1/mp01_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP01_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP01_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP01_NODE1; + diff --git a/testsuites/ada/mptests/mp01/node2/Makefile.am b/testsuites/ada/mptests/mp01/node2/Makefile.am new file mode 100644 index 0000000000..a58a210b0c --- /dev/null +++ b/testsuites/ada/mptests/mp01/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp01_ada_mp01_node2 +mp01_ada_mp01_node2_SOURCES = mp01_node2.adb ../mptest.adb config.h +mp01_ada_mp01_node2_SOURCES += ../mptest.ads +mp01_ada_mp01_node2_SOURCES += ../../../support/init.c + +mp01_ada_mp01_node2$(EXEEXT): mp01_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp01-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp01/node2/ada_mp01-node2.scn b/testsuites/ada/mptests/mp01/node2/ada_mp01-node2.scn new file mode 100644 index 0000000000..98047240f3 --- /dev/null +++ b/testsuites/ada/mptests/mp01/node2/ada_mp01-node2.scn @@ -0,0 +1,15 @@ +*** TEST 1 -- NODE 2 *** +Creating task 1 (Global) +Creating task 2 (Global) +Creating task 3 (Local) +SA1 - clock_get - 9: 0: 0 12/31/1988 +SA2 - clock_get - 9: 0: 0 12/31/1988 +SA3 - clock_get - 9: 0: 0 12/31/1988 +SA1 - clock_get - 9: 0: 5 12/31/1988 +SA1 - deleting self +SA2 - clock_get - 9: 0:10 12/31/1988 +SA2 - waiting to be deleted by SA3 +SA3 - clock_get - 9: 0:15 12/31/1988 +SA3 - getting TID of SA2 +SA3 - deleting SA2 +*** END OF TEST 1 *** diff --git a/testsuites/ada/mptests/mp01/node2/config.h b/testsuites/ada/mptests/mp01/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp01/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp01/node2/mp01_node2.adb b/testsuites/ada/mptests/mp01/node2/mp01_node2.adb new file mode 100644 index 0000000000..380df6c5fd --- /dev/null +++ b/testsuites/ada/mptests/mp01/node2/mp01_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP01_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP01_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP01_NODE2; + diff --git a/testsuites/ada/mptests/mp03/Makefile.am b/testsuites/ada/mptests/mp03/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp03/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp03/config_base.h b/testsuites/ada/mptests/mp03/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp03/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp03/mptest.adb b/testsuites/ada/mptests/mp03/mptest.adb new file mode 100644 index 0000000000..170b62fd5d --- /dev/null +++ b/testsuites/ada/mptests/mp03/mptest.adb @@ -0,0 +1,267 @@ +-- +-- This package is the implementation for Test 3 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.EVENT; +with RTEMS.TASKS; +with RTEMS.TIMER; +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( "*** TEST 3 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + 1, + 2048, + RTEMS.NO_PREEMPT, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + + RTEMS.TIMER.CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- DELAYED_SEND_EVENT +-- + + procedure DELAYED_SEND_EVENT ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.EVENT.SEND( MPTEST.TASK_ID( 1 ), RTEMS.EVENT_16, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end DELAYED_SEND_EVENT; + +-- +-- TEST_TASK +-- + + procedure TEST_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_LINE( "Getting TID of remote task" ); + if TEST_SUPPORT.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + loop + + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 10 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + MPTEST.TEST_TASK_SUPPORT( 1 ); + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 11 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + if TEST_SUPPORT.NODE = 2 then + + RTEMS.TASKS.WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end if; + + MPTEST.TEST_TASK_SUPPORT( 2 ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 3 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +-- +-- TEST_TASK_SUPPORT +-- + + + procedure TEST_TASK_SUPPORT ( + NODE : in RTEMS.UNSIGNED32 + ) is + EVENTS : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + if TEST_SUPPORT.NODE = NODE then + + loop + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + EVENTS, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( RTEMS.SUCCESSFUL, STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.UNSATISFIED, + "EVENT_RECEIVE" + ); + + RTEMS.TASKS.WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - Suspending remote task" ); + RTEMS.TASKS.SUSPEND( MPTEST.REMOTE_TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" ); + + RTEMS.TASKS.WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - Resuming remote task" ); + + RTEMS.TASKS.RESUME( MPTEST.REMOTE_TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" ); + + end loop; + + else + + loop + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + EVENTS, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( RTEMS.SUCCESSFUL, STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.UNSATISFIED, + "EVENT_RECEIVE" + ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( REMOTE_NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - have I been suspended???" ); + RTEMS.TASKS.WAKE_AFTER( + TEST_SUPPORT.TICKS_PER_SECOND / 2, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end loop; + + end if; + + end TEST_TASK_SUPPORT; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp03/mptest.ads b/testsuites/ada/mptests/mp03/mptest.ads new file mode 100644 index 0000000000..6e7f59947e --- /dev/null +++ b/testsuites/ada/mptests/mp03/mptest.ads @@ -0,0 +1,111 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 3 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + pragma Convention (C, DELAYED_SEND_EVENT); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +-- +-- TEST_TASK_SUPPORT +-- +-- DESCRIPTION: +-- +-- This subprogram performs the bulk of the test. Based on the NODE +-- specified, this subprogram loops suspending/resuming a remote task +-- or waiting for itself to be suspended/resumed. +-- + + procedure TEST_TASK_SUPPORT ( + NODE : in RTEMS.UNSIGNED32 + ); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp03/node1/Makefile.am b/testsuites/ada/mptests/mp03/node1/Makefile.am new file mode 100644 index 0000000000..5c9b6f67ac --- /dev/null +++ b/testsuites/ada/mptests/mp03/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp03_ada_mp03_node1 +mp03_ada_mp03_node1_SOURCES = mp03_node1.adb ../mptest.adb config.h +mp03_ada_mp03_node1_SOURCES += ../mptest.ads +mp03_ada_mp03_node1_SOURCES += ../../../support/init.c + +mp03_ada_mp03_node1$(EXEEXT): mp03_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp03-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp03/node1/ada_mp03-node1.scn b/testsuites/ada/mptests/mp03/node1/ada_mp03-node1.scn new file mode 100644 index 0000000000..d749db49e2 --- /dev/null +++ b/testsuites/ada/mptests/mp03/node1/ada_mp03-node1.scn @@ -0,0 +1,28 @@ +*** TEST 3 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 222 +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +222 - have I been suspended??? +*** END OF TEST 3 *** + diff --git a/testsuites/ada/mptests/mp03/node1/config.h b/testsuites/ada/mptests/mp03/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp03/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp03/node1/mp03_node1.adb b/testsuites/ada/mptests/mp03/node1/mp03_node1.adb new file mode 100644 index 0000000000..80a67ffc94 --- /dev/null +++ b/testsuites/ada/mptests/mp03/node1/mp03_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP03_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP03_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP03_NODE1; + diff --git a/testsuites/ada/mptests/mp03/node2/Makefile.am b/testsuites/ada/mptests/mp03/node2/Makefile.am new file mode 100644 index 0000000000..bf8b5446d6 --- /dev/null +++ b/testsuites/ada/mptests/mp03/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp03_ada_mp03_node2 +mp03_ada_mp03_node2_SOURCES = mp03_node2.adb ../mptest.adb config.h +mp03_ada_mp03_node2_SOURCES += ../mptest.ads +mp03_ada_mp03_node2_SOURCES += ../../../support/init.c + +mp03_ada_mp03_node2$(EXEEXT): mp03_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp03-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp03/node2/ada_mp03-node2.scn b/testsuites/ada/mptests/mp03/node2/ada_mp03-node2.scn new file mode 100644 index 0000000000..56298f5b8d --- /dev/null +++ b/testsuites/ada/mptests/mp03/node2/ada_mp03-node2.scn @@ -0,0 +1,28 @@ +*** TEST 3 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 111 +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +111 - have I been suspended??? +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +*** END OF TEST 3 *** + diff --git a/testsuites/ada/mptests/mp03/node2/config.h b/testsuites/ada/mptests/mp03/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp03/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp03/node2/mp03_node2.adb b/testsuites/ada/mptests/mp03/node2/mp03_node2.adb new file mode 100644 index 0000000000..aec5b91edd --- /dev/null +++ b/testsuites/ada/mptests/mp03/node2/mp03_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP03_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP03_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP03_NODE2; + diff --git a/testsuites/ada/mptests/mp04/Makefile.am b/testsuites/ada/mptests/mp04/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp04/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp04/config_base.h b/testsuites/ada/mptests/mp04/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp04/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp04/mptest.adb b/testsuites/ada/mptests/mp04/mptest.adb new file mode 100644 index 0000000000..a7a2bdd3ea --- /dev/null +++ b/testsuites/ada/mptests/mp04/mptest.adb @@ -0,0 +1,163 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 4 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.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( "*** TEST 4 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + TEST_SUPPORT.NODE, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TID : RTEMS.ID; + PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY; + PREVIOUS_PRIORITY_1 : RTEMS.TASKS.PRIORITY; + 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_LINE( "Getting TID of remote task" ); + if TEST_SUPPORT.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + loop + + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TASKS.SET_PRIORITY( + MPTEST.REMOTE_TID, + TEST_SUPPORT.NODE, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + if PREVIOUS_PRIORITY /= MPTEST.REMOTE_NODE then + + TEXT_IO.PUT( "Remote priority (0x" ); + UNSIGNED32_IO.PUT( PREVIOUS_PRIORITY, BASE => 16 ); + TEXT_IO.PUT( "does not match remote node (0x" ); + UNSIGNED32_IO.PUT( MPTEST.REMOTE_NODE, BASE => 16 ); + TEXT_IO.PUT_LINE( ")!!!" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 16#F00000# ); + + end if; + + loop + + RTEMS.TASKS.SET_PRIORITY( + RTEMS.SELF, + RTEMS.TASKS.CURRENT_PRIORITY, + PREVIOUS_PRIORITY_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + exit when PREVIOUS_PRIORITY_1 = MPTEST.REMOTE_NODE; + + end loop; + + + TEXT_IO.PUT_LINE( "Local task priority has been set" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 4 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp04/mptest.ads b/testsuites/ada/mptests/mp04/mptest.ads new file mode 100644 index 0000000000..ddf2c82878 --- /dev/null +++ b/testsuites/ada/mptests/mp04/mptest.ads @@ -0,0 +1,74 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 4 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; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp04/node1/Makefile.am b/testsuites/ada/mptests/mp04/node1/Makefile.am new file mode 100644 index 0000000000..633209a092 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp04_ada_mp04_node1 +mp04_ada_mp04_node1_SOURCES = mp04_node1.adb ../mptest.adb config.h +mp04_ada_mp04_node1_SOURCES += ../mptest.ads +mp04_ada_mp04_node1_SOURCES += ../../../support/init.c + +mp04_ada_mp04_node1$(EXEEXT): mp04_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp04-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp04/node1/ada_mp04-node1.scn b/testsuites/ada/mptests/mp04/node1/ada_mp04-node1.scn new file mode 100644 index 0000000000..e9518f3ac2 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node1/ada_mp04-node1.scn @@ -0,0 +1,8 @@ +*** TEST 4 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 222 +Local task priority has been set +*** END OF TEST 4 *** diff --git a/testsuites/ada/mptests/mp04/node1/config.h b/testsuites/ada/mptests/mp04/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp04/node1/mp04_node1.adb b/testsuites/ada/mptests/mp04/node1/mp04_node1.adb new file mode 100644 index 0000000000..c88c019992 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node1/mp04_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP04_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP04_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP04_NODE1; + diff --git a/testsuites/ada/mptests/mp04/node2/Makefile.am b/testsuites/ada/mptests/mp04/node2/Makefile.am new file mode 100644 index 0000000000..cce97cd2a2 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp04_ada_mp04_node2 +mp04_ada_mp04_node2_SOURCES = mp04_node2.adb ../mptest.adb config.h +mp04_ada_mp04_node2_SOURCES += ../mptest.ads +mp04_ada_mp04_node2_SOURCES += ../../../support/init.c + +mp04_ada_mp04_node2$(EXEEXT): mp04_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp04-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp04/node2/ada_mp04-node2.scn b/testsuites/ada/mptests/mp04/node2/ada_mp04-node2.scn new file mode 100644 index 0000000000..8ccfcfef79 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node2/ada_mp04-node2.scn @@ -0,0 +1,8 @@ +*** TEST 4 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 111 +Local task priority has been set +*** END OF TEST 4 *** diff --git a/testsuites/ada/mptests/mp04/node2/config.h b/testsuites/ada/mptests/mp04/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp04/node2/mp04_node2.adb b/testsuites/ada/mptests/mp04/node2/mp04_node2.adb new file mode 100644 index 0000000000..4cd9f0e3b3 --- /dev/null +++ b/testsuites/ada/mptests/mp04/node2/mp04_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP04_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP04_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP04_NODE2; + diff --git a/testsuites/ada/mptests/mp05/Makefile.am b/testsuites/ada/mptests/mp05/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp05/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp05/config_base.h b/testsuites/ada/mptests/mp05/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp05/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp05/mptest.adb b/testsuites/ada/mptests/mp05/mptest.adb new file mode 100644 index 0000000000..a206b80b85 --- /dev/null +++ b/testsuites/ada/mptests/mp05/mptest.adb @@ -0,0 +1,247 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 5 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.FATAL; +with RTEMS.SIGNAL; +with RTEMS.TASKS; +with RTEMS.TIMER; +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( "*** TEST 5 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + MPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' ); + + RTEMS.TIMER.CREATE( + MPTEST.TIMER_NAME( TEST_SUPPORT.NODE ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- PROCESS_ASR +-- + + procedure PROCESS_ASR ( + SIGNAL : in RTEMS.SIGNAL_SET + ) + is + begin + + if SIGNAL /= MPTEST.EXPECTED_SIGNAL then + + TEXT_IO.PUT( "ERROR: I was expecting signal 0x" ); + UNSIGNED32_IO.PUT( EXPECTED_SIGNAL, BASE => 16 ); + TEXT_IO.PUT( " got 0x" ); + UNSIGNED32_IO.PUT( SIGNAL, BASE => 16 ); + TEXT_IO.NEW_LINE; + + RTEMS.FATAL.ERROR_OCCURRED( 16#000F_0000# ); + + end if; + + MPTEST.SIGNAL_CAUGHT := TRUE; + + end PROCESS_ASR; + +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + MPTEST.SIGNAL_CAUGHT := FALSE; + MPTEST.SIGNAL_COUNT := 0; + + TEXT_IO.PUT_LINE( "signal_catch: initializing signal catcher" ); + RTEMS.SIGNAL.CATCH( + MPTEST.PROCESS_ASR'ACCESS, + RTEMS.NO_ASR + RTEMS.NO_PREEMPT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" ); + + if TEST_SUPPORT.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + MPTEST.REMOTE_SIGNAL := RTEMS.SIGNAL_18; + MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_17; + else + MPTEST.REMOTE_NODE := 1; + MPTEST.REMOTE_SIGNAL := RTEMS.SIGNAL_17; + MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_18; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + loop + + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 3 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Sending signal to remote task" ); + loop + RTEMS.SIGNAL.SEND( + MPTEST.REMOTE_TID, + MPTEST.REMOTE_SIGNAL, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + exit when not RTEMS.ARE_STATUSES_EQUAL(STATUS, RTEMS.NOT_DEFINED); + + end loop; + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" ); + + end if; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + if MPTEST.SIGNAL_CAUGHT = TRUE then + + MPTEST.SIGNAL_CAUGHT := FALSE; + MPTEST.SIGNAL_COUNT := MPTEST.SIGNAL_COUNT + 1; + + if MPTEST.SIGNAL_COUNT >= MPTEST.SIGNALS_PER_DOT then + + MPTEST.SIGNAL_COUNT := 0; + + TEST_SUPPORT.PUT_DOT( "." ); + + end if; + + RTEMS.SIGNAL.SEND( + MPTEST.REMOTE_TID, + MPTEST.REMOTE_SIGNAL, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" ); + + end if; + + end loop; + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( "*** END OF TEST 5 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp05/mptest.ads b/testsuites/ada/mptests/mp05/mptest.ads new file mode 100644 index 0000000000..13d5ced1d6 --- /dev/null +++ b/testsuites/ada/mptests/mp05/mptest.ads @@ -0,0 +1,142 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 5 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.SIGNAL; +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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- This is the signal set which is sent to the task on the other node. +-- + + REMOTE_SIGNAL : RTEMS.SIGNAL_SET; + +-- +-- This is the signal set the task on this node expects to receive +-- from the other node. +-- + + EXPECTED_SIGNAL : RTEMS.SIGNAL_SET; + +-- +-- These keep track of if a signal set has been caught and how many +-- signal sets have been caught cumulative. +-- + + SIGNAL_CAUGHT : BOOLEAN; + SIGNAL_COUNT : RTEMS.UNSIGNED32; + +-- +-- The number of signals to process per dot printed out. +-- + + SIGNALS_PER_DOT : constant RTEMS.UNSIGNED32 := 15; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- PROCESS_ASR +-- +-- DESCRIPTION: +-- +-- This subprogram is an ASR for TEST_TASK. +-- + + procedure PROCESS_ASR ( + SIGNAL : in RTEMS.SIGNAL_SET + ); + pragma Convention (C, PROCESS_ASR); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + pragma Convention (C, STOP_TEST_TSR); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp05/node1/Makefile.am b/testsuites/ada/mptests/mp05/node1/Makefile.am new file mode 100644 index 0000000000..669235ea2d --- /dev/null +++ b/testsuites/ada/mptests/mp05/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp05_ada_mp05_node1 +mp05_ada_mp05_node1_SOURCES = mp05_node1.adb ../mptest.adb config.h +mp05_ada_mp05_node1_SOURCES += ../mptest.ads +mp05_ada_mp05_node1_SOURCES += ../../../support/init.c + +mp05_ada_mp05_node1$(EXEEXT): mp05_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp05-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp05/node1/ada_mp05-node1.scn b/testsuites/ada/mptests/mp05/node1/ada_mp05-node1.scn new file mode 100644 index 0000000000..6f0ea4b639 --- /dev/null +++ b/testsuites/ada/mptests/mp05/node1/ada_mp05-node1.scn @@ -0,0 +1,11 @@ +*** TEST 5 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +signal_catch: initializing signal catcher +Remote task's name is : 222 +Getting TID of remote task +Sending signal to remote task +.................................................... +.................................................... +*** END OF TEST 5 *** diff --git a/testsuites/ada/mptests/mp05/node1/config.h b/testsuites/ada/mptests/mp05/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp05/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp05/node1/mp05_node1.adb b/testsuites/ada/mptests/mp05/node1/mp05_node1.adb new file mode 100644 index 0000000000..529406450b --- /dev/null +++ b/testsuites/ada/mptests/mp05/node1/mp05_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP05_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP05_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP05_NODE1; + diff --git a/testsuites/ada/mptests/mp05/node2/Makefile.am b/testsuites/ada/mptests/mp05/node2/Makefile.am new file mode 100644 index 0000000000..15de8d5810 --- /dev/null +++ b/testsuites/ada/mptests/mp05/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp05_ada_mp05_node2 +mp05_ada_mp05_node2_SOURCES = mp05_node2.adb ../mptest.adb config.h +mp05_ada_mp05_node2_SOURCES += ../mptest.ads +mp05_ada_mp05_node2_SOURCES += ../../../support/init.c + +mp05_ada_mp05_node2$(EXEEXT): mp05_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp05-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp05/node2/ada_mp05-node2.scn b/testsuites/ada/mptests/mp05/node2/ada_mp05-node2.scn new file mode 100644 index 0000000000..1fb18c132b --- /dev/null +++ b/testsuites/ada/mptests/mp05/node2/ada_mp05-node2.scn @@ -0,0 +1,10 @@ +*** TEST 5 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +signal_catch: initializing signal catcher +Remote task's name is : 111 +Getting TID of remote task +.................................................... +.................................................... +*** END OF TEST 5 *** diff --git a/testsuites/ada/mptests/mp05/node2/config.h b/testsuites/ada/mptests/mp05/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp05/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp05/node2/mp05_node2.adb b/testsuites/ada/mptests/mp05/node2/mp05_node2.adb new file mode 100644 index 0000000000..faa4aa2266 --- /dev/null +++ b/testsuites/ada/mptests/mp05/node2/mp05_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP05_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP05_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP05_NODE2; + diff --git a/testsuites/ada/mptests/mp06/Makefile.am b/testsuites/ada/mptests/mp06/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp06/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp06/config_base.h b/testsuites/ada/mptests/mp06/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp06/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp06/mptest.adb b/testsuites/ada/mptests/mp06/mptest.adb new file mode 100644 index 0000000000..d4522e653b --- /dev/null +++ b/testsuites/ada/mptests/mp06/mptest.adb @@ -0,0 +1,252 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 6 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.EVENT; +with RTEMS.TASKS; +with RTEMS.TIMER; +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( "*** TEST 6 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + TEST_SUPPORT.NODE, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + MPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' ); + + RTEMS.TIMER.CREATE( + MPTEST.TIMER_NAME( TEST_SUPPORT.NODE ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + EVENT_OUT : RTEMS.EVENT_SET; + EVENT_FOR_THIS_ITERATION : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + if TEST_SUPPORT.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + + loop + + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + TEXT_IO.PUT_LINE( "Sending events to remote task" ); + else + TEXT_IO.PUT_LINE( "Receiving events from remote task" ); + end if; + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + COUNT := 0; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + EVENT_FOR_THIS_ITERATION := + MPTEST.EVENT_SET_TABLE( + INTEGER( COUNT ) mod MPTEST.EVENT_SET_TABLE'LAST + 1 + ); + + if TEST_SUPPORT.NODE = 1 then + + RTEMS.EVENT.SEND( + MPTEST.REMOTE_TID, + EVENT_FOR_THIS_ITERATION, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + else + + RTEMS.EVENT.RECEIVE( + EVENT_FOR_THIS_ITERATION, + RTEMS.DEFAULT_OPTIONS, + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + + if RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TIMEOUT ) then + TEXT_IO.NEW_LINE( 1 ); + + if TEST_SUPPORT.NODE = 2 then + TEXT_IO.PUT_LINE( + "Correct behavior if the other node exitted." + ); + else + TEXT_IO.PUT_LINE( + "ERROR... node 1 died" + ); + end if; + + exit; + + else + + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end if; + + end if; + + if (COUNT mod MPTEST.MAXIMUM_DOTS) = 0 then + + TEST_SUPPORT.PUT_DOT( "." ); + + end if; + + COUNT := COUNT + 1; + + end loop; + + TEXT_IO.NEW_LINE; + + if TEST_SUPPORT.NODE = 2 then + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + RTEMS.TIMEOUT, + STATUS, + "EVENT_RECEIVE" + ); + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( "event_receive - correctly returned TIMEOUT" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 6 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp06/mptest.ads b/testsuites/ada/mptests/mp06/mptest.ads new file mode 100644 index 0000000000..5c3668d3ac --- /dev/null +++ b/testsuites/ada/mptests/mp06/mptest.ads @@ -0,0 +1,148 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 6 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.EVENT; +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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of signals to process per dot printed out. +-- + + MAXIMUM_DOTS : constant RTEMS.UNSIGNED32 := 25; + +-- +-- The following is a table of the event sets which consist of +-- a single event. This test cycles through all of these +-- events. +-- + + EVENT_SET_TABLE : constant array ( 0 .. 30 ) of RTEMS.EVENT_SET := ( + RTEMS.EVENT_0, + RTEMS.EVENT_1, + RTEMS.EVENT_2, + RTEMS.EVENT_3, + RTEMS.EVENT_4, + RTEMS.EVENT_5, + RTEMS.EVENT_6, + RTEMS.EVENT_7, + RTEMS.EVENT_8, + RTEMS.EVENT_9, + RTEMS.EVENT_10, + RTEMS.EVENT_11, + RTEMS.EVENT_12, + RTEMS.EVENT_13, + RTEMS.EVENT_14, + RTEMS.EVENT_15, + RTEMS.EVENT_16, + RTEMS.EVENT_17, + RTEMS.EVENT_18, + RTEMS.EVENT_19, + RTEMS.EVENT_20, + RTEMS.EVENT_21, + RTEMS.EVENT_22, + RTEMS.EVENT_23, + RTEMS.EVENT_24, + RTEMS.EVENT_25, + RTEMS.EVENT_26, + RTEMS.EVENT_27, + RTEMS.EVENT_28, + RTEMS.EVENT_29, + RTEMS.EVENT_30 + ); + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ); + pragma Convention (C, STOP_TEST_TSR); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp06/node1/Makefile.am b/testsuites/ada/mptests/mp06/node1/Makefile.am new file mode 100644 index 0000000000..45bde9a044 --- /dev/null +++ b/testsuites/ada/mptests/mp06/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp06_ada_mp06_node1 +mp06_ada_mp06_node1_SOURCES = mp06_node1.adb ../mptest.adb config.h +mp06_ada_mp06_node1_SOURCES += ../mptest.ads +mp06_ada_mp06_node1_SOURCES += ../../../support/init.c + +mp06_ada_mp06_node1$(EXEEXT): mp06_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp06-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp06/node1/ada_mp06-node1.scn b/testsuites/ada/mptests/mp06/node1/ada_mp06-node1.scn new file mode 100644 index 0000000000..71da651eca --- /dev/null +++ b/testsuites/ada/mptests/mp06/node1/ada_mp06-node1.scn @@ -0,0 +1,10 @@ +*** TEST 6 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 222 +Getting TID of remote task +Sending events to remote task +.................................................... +.................................................... +*** END OF TEST 6 *** diff --git a/testsuites/ada/mptests/mp06/node1/config.h b/testsuites/ada/mptests/mp06/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp06/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp06/node1/mp06_node1.adb b/testsuites/ada/mptests/mp06/node1/mp06_node1.adb new file mode 100644 index 0000000000..ebde32ca1c --- /dev/null +++ b/testsuites/ada/mptests/mp06/node1/mp06_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP06_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP06_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP06_NODE1; + diff --git a/testsuites/ada/mptests/mp06/node2/Makefile.am b/testsuites/ada/mptests/mp06/node2/Makefile.am new file mode 100644 index 0000000000..e16512e279 --- /dev/null +++ b/testsuites/ada/mptests/mp06/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp06_ada_mp06_node2 +mp06_ada_mp06_node2_SOURCES = mp06_node2.adb ../mptest.adb config.h +mp06_ada_mp06_node2_SOURCES += ../mptest.ads +mp06_ada_mp06_node2_SOURCES += ../../../support/init.c + +mp06_ada_mp06_node2$(EXEEXT): mp06_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp06-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp06/node2/ada_mp06-node2.scn b/testsuites/ada/mptests/mp06/node2/ada_mp06-node2.scn new file mode 100644 index 0000000000..da449041b4 --- /dev/null +++ b/testsuites/ada/mptests/mp06/node2/ada_mp06-node2.scn @@ -0,0 +1,11 @@ +*** TEST 6 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 111 +Getting TID of remote task +Receiving events from remote task +.................................................... +.................................................... +event_receive - correctly returned TIMEOUT +*** END OF TEST 6 *** diff --git a/testsuites/ada/mptests/mp06/node2/config.h b/testsuites/ada/mptests/mp06/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp06/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp06/node2/mp06_node2.adb b/testsuites/ada/mptests/mp06/node2/mp06_node2.adb new file mode 100644 index 0000000000..3637d8827e --- /dev/null +++ b/testsuites/ada/mptests/mp06/node2/mp06_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP06_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP06_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP06_NODE2; + diff --git a/testsuites/ada/mptests/mp07/Makefile.am b/testsuites/ada/mptests/mp07/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp07/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp07/config_base.h b/testsuites/ada/mptests/mp07/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp07/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp07/mptest.adb b/testsuites/ada/mptests/mp07/mptest.adb new file mode 100644 index 0000000000..20dbc9cd84 --- /dev/null +++ b/testsuites/ada/mptests/mp07/mptest.adb @@ -0,0 +1,204 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 7 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.EVENT; +with RTEMS.TASKS; +with RTEMS.TIMER; +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( "*** TEST 7 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + TEST_SUPPORT.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + + RTEMS.TIMER.CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + EVENT_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + if TEST_SUPPORT.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + loop + RTEMS.TASKS.IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.SUCCESSFUL ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Sending first event to remote task" ); + RTEMS.EVENT.SEND( + MPTEST.REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end if; + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.PER_DOT + loop + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + if RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TIMEOUT ) then + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( + "TA1 - TIMEOUT .. probably OK if the other node exits" + ); + exit; + else + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + end if; + + RTEMS.EVENT.SEND( + MPTEST.REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "." ); + + end loop; + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "*** END OF TEST 7 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp07/mptest.ads b/testsuites/ada/mptests/mp07/mptest.ads new file mode 100644 index 0000000000..499628b5d0 --- /dev/null +++ b/testsuites/ada/mptests/mp07/mptest.ads @@ -0,0 +1,107 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 7 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ); + pragma Convention (C, STOP_TEST_TSR); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp07/node1/Makefile.am b/testsuites/ada/mptests/mp07/node1/Makefile.am new file mode 100644 index 0000000000..c6b77cd1e3 --- /dev/null +++ b/testsuites/ada/mptests/mp07/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp07_ada_mp07_node1 +mp07_ada_mp07_node1_SOURCES = mp07_node1.adb ../mptest.adb config.h +mp07_ada_mp07_node1_SOURCES += ../mptest.ads +mp07_ada_mp07_node1_SOURCES += ../../../support/init.c + +mp07_ada_mp07_node1$(EXEEXT): mp07_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp07-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp07/node1/ada_mp07-node1.scn b/testsuites/ada/mptests/mp07/node1/ada_mp07-node1.scn new file mode 100644 index 0000000000..71e0956329 --- /dev/null +++ b/testsuites/ada/mptests/mp07/node1/ada_mp07-node1.scn @@ -0,0 +1,10 @@ +*** TEST 7 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 222 +Getting TID of remote task +Sending first event to remote task +.................................................... +.................................................... +*** END OF TEST 7 *** diff --git a/testsuites/ada/mptests/mp07/node1/config.h b/testsuites/ada/mptests/mp07/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp07/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp07/node1/mp07_node1.adb b/testsuites/ada/mptests/mp07/node1/mp07_node1.adb new file mode 100644 index 0000000000..a6d9ef4db0 --- /dev/null +++ b/testsuites/ada/mptests/mp07/node1/mp07_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP07_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP07_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP07_NODE1; + diff --git a/testsuites/ada/mptests/mp07/node2/Makefile.am b/testsuites/ada/mptests/mp07/node2/Makefile.am new file mode 100644 index 0000000000..95e310850d --- /dev/null +++ b/testsuites/ada/mptests/mp07/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp07_ada_mp07_node2 +mp07_ada_mp07_node2_SOURCES = mp07_node2.adb ../mptest.adb config.h +mp07_ada_mp07_node2_SOURCES += ../mptest.ads +mp07_ada_mp07_node2_SOURCES += ../../../support/init.c + +mp07_ada_mp07_node2$(EXEEXT): mp07_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp07-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp07/node2/ada_mp07-node2.scn b/testsuites/ada/mptests/mp07/node2/ada_mp07-node2.scn new file mode 100644 index 0000000000..c31011e85c --- /dev/null +++ b/testsuites/ada/mptests/mp07/node2/ada_mp07-node2.scn @@ -0,0 +1,9 @@ +*** TEST 7 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 111 +Getting TID of remote task +.................................................... +.................................................... +*** END OF TEST 7 *** diff --git a/testsuites/ada/mptests/mp07/node2/config.h b/testsuites/ada/mptests/mp07/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp07/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp07/node2/mp07_node2.adb b/testsuites/ada/mptests/mp07/node2/mp07_node2.adb new file mode 100644 index 0000000000..0e0db0bbdd --- /dev/null +++ b/testsuites/ada/mptests/mp07/node2/mp07_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP07_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP07_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP07_NODE2; + diff --git a/testsuites/ada/mptests/mp08/Makefile.am b/testsuites/ada/mptests/mp08/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp08/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp08/config_base.h b/testsuites/ada/mptests/mp08/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp08/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp08/mptest.adb b/testsuites/ada/mptests/mp08/mptest.adb new file mode 100644 index 0000000000..2910ec83e7 --- /dev/null +++ b/testsuites/ada/mptests/mp08/mptest.adb @@ -0,0 +1,203 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 8 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.OBJECT; +with RTEMS.SEMAPHORE; +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( "*** TEST 8 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Semaphore(Global)" ); + + RTEMS.SEMAPHORE.CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + TEST_SUPPORT.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + DOTS : RTEMS.UNSIGNED32; + COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + loop + + RTEMS.SEMAPHORE.IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if TEST_SUPPORT.NODE = 2 then + + RTEMS.SEMAPHORE.DELETE( + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "SEMAPHORE_DELETE" + ); + + TEXT_IO.PUT_LINE( + "semaphore_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT" + ); + + end if; + + COUNT := 0; + + loop + + TEST_SUPPORT.PUT_DOT( "p" ); + + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + + if not RTEMS.IS_STATUS_SUCCESSFUL( STATUS ) then + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.OBJECT_WAS_DELETED, + "SEMAPHORE_OBTAIN" + ); + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "Global semaphore deleted" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 8 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + COUNT := COUNT + 1; + + if TEST_SUPPORT.NODE = 1 and then + COUNT >= 1000 then + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "Deleting global semaphore" ); + + RTEMS.SEMAPHORE.DELETE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 8 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + TEST_SUPPORT.PUT_DOT( "v" ); + + RTEMS.SEMAPHORE.RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + end loop; + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp08/mptest.ads b/testsuites/ada/mptests/mp08/mptest.ads new file mode 100644 index 0000000000..07df76322e --- /dev/null +++ b/testsuites/ada/mptests/mp08/mptest.ads @@ -0,0 +1,88 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 8 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphores created +-- by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp08/node1/Makefile.am b/testsuites/ada/mptests/mp08/node1/Makefile.am new file mode 100644 index 0000000000..be1b6ce643 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp08_ada_mp08_node1 +mp08_ada_mp08_node1_SOURCES = mp08_node1.adb ../mptest.adb config.h +mp08_ada_mp08_node1_SOURCES += ../mptest.ads +mp08_ada_mp08_node1_SOURCES += ../../../support/init.c + +mp08_ada_mp08_node1$(EXEEXT): mp08_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp08-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp08/node1/ada_mp08-node1.scn b/testsuites/ada/mptests/mp08/node1/ada_mp08-node1.scn new file mode 100644 index 0000000000..ba9f089e96 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node1/ada_mp08-node1.scn @@ -0,0 +1,9 @@ +*** TEST 8 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting SMID of semaphore +pvpvpvpvpvp....... +(continued) pvp +Deleting global semaphore +*** END OF TEST 8 *** diff --git a/testsuites/ada/mptests/mp08/node1/config.h b/testsuites/ada/mptests/mp08/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp08/node1/mp08_node1.adb b/testsuites/ada/mptests/mp08/node1/mp08_node1.adb new file mode 100644 index 0000000000..75a1a985be --- /dev/null +++ b/testsuites/ada/mptests/mp08/node1/mp08_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP08_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP08_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP08_NODE1; + diff --git a/testsuites/ada/mptests/mp08/node2/Makefile.am b/testsuites/ada/mptests/mp08/node2/Makefile.am new file mode 100644 index 0000000000..1a3271d713 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp08_ada_mp08_node2 +mp08_ada_mp08_node2_SOURCES = mp08_node2.adb ../mptest.adb config.h +mp08_ada_mp08_node2_SOURCES += ../mptest.ads +mp08_ada_mp08_node2_SOURCES += ../../../support/init.c + +mp08_ada_mp08_node2$(EXEEXT): mp08_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp08-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp08/node2/ada_mp08-node2.scn b/testsuites/ada/mptests/mp08/node2/ada_mp08-node2.scn new file mode 100644 index 0000000000..8ac712ae93 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node2/ada_mp08-node2.scn @@ -0,0 +1,10 @@ +*** TEST 8 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting SMID of semaphore +semaphore_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT +pvpvpvpvpvp....... +(continued) pvp +Global semaphore deleted +*** END OF TEST 8 *** diff --git a/testsuites/ada/mptests/mp08/node2/config.h b/testsuites/ada/mptests/mp08/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp08/node2/mp08_node2.adb b/testsuites/ada/mptests/mp08/node2/mp08_node2.adb new file mode 100644 index 0000000000..84dd6b5371 --- /dev/null +++ b/testsuites/ada/mptests/mp08/node2/mp08_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP08_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP08_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP08_NODE2; + diff --git a/testsuites/ada/mptests/mp09/Makefile.am b/testsuites/ada/mptests/mp09/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp09/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp09/config_base.h b/testsuites/ada/mptests/mp09/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp09/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp09/mptest.adb b/testsuites/ada/mptests/mp09/mptest.adb new file mode 100644 index 0000000000..f68268788d --- /dev/null +++ b/testsuites/ada/mptests/mp09/mptest.adb @@ -0,0 +1,373 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 9 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.MESSAGE_QUEUE; +with RTEMS.OBJECT; +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( "*** TEST 9 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( MPTEST.RECEIVE_BUFFER_AREA'ADDRESS ); + + MPTEST.BUFFER_1 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_1'ADDRESS ); + + MPTEST.BUFFER_2 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_2'ADDRESS ); + + MPTEST.BUFFER_3 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_3'ADDRESS ); + + MPTEST.BUFFER_4 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_4'ADDRESS ); + + MPTEST.FILL_BUFFER( "123456789012345 ", MPTEST.BUFFER_AREA_1 ); + MPTEST.FILL_BUFFER( "abcdefghijklmno ", MPTEST.BUFFER_AREA_2 ); + MPTEST.FILL_BUFFER( "ABCDEFGHIJKLMNO ", MPTEST.BUFFER_AREA_3 ); + MPTEST.FILL_BUFFER( "PQRSTUVWXYZ(){} ", MPTEST.BUFFER_AREA_4 ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE.CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( TEST_SUPPORT.NODE ), + TEST_SUPPORT.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- SEND_MESSAGES +-- + + procedure SEND_MESSAGES is + BROADCAST_COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT( "message_queue_send : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_1 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE.SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASKS.WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT( "message_queue_urgent : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_2 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE.URGENT( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_2, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_URGENT" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASKS.WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT( "message_queue_broadcast : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_3 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE.BROADCAST( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_3, + BROADCAST_COUNT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_BROADCAST" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASKS.WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end SEND_MESSAGES; + +-- +-- RECEIVE_MESSAGES +-- + + procedure RECEIVE_MESSAGES is + INDEX : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + for INDEX in 1 .. 3 + loop + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + TEXT_IO.PUT( "Received : " ); + MPTEST.PUT_BUFFER( MPTEST.RECEIVE_BUFFER_AREA ); + TEXT_IO.NEW_LINE; + + end loop; + + TEXT_IO.PUT_LINE( "Receiver delaying for a second" ); + + RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end RECEIVE_MESSAGES; + +-- +-- FILL_BUFFER +-- + +-- +-- Depends on tricks to make the copy work. +-- + + procedure FILL_BUFFER ( + SOURCE : in STRING; + BUFFER : out RTEMS.BUFFER + ) is + SOURCE_BUFFER : RTEMS.BUFFER_POINTER; + begin + + SOURCE_BUFFER := RTEMS.TO_BUFFER_POINTER( + SOURCE( SOURCE'FIRST )'ADDRESS + ); + + BUFFER.FIELD1 := SOURCE_BUFFER.FIELD1; + BUFFER.FIELD2 := SOURCE_BUFFER.FIELD2; + BUFFER.FIELD3 := SOURCE_BUFFER.FIELD3; + BUFFER.FIELD4 := SOURCE_BUFFER.FIELD4; + + end FILL_BUFFER; + +-- +-- PUT_BUFFER +-- + +-- +-- Depends on tricks to make the output work. +-- + + procedure PUT_BUFFER ( + BUFFER : in RTEMS.BUFFER + ) is + begin + + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD1, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD2, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD3, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD4, FALSE ); + + end PUT_BUFFER; + +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE.IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if TEST_SUPPORT.NODE = 2 then + + RTEMS.MESSAGE_QUEUE.DELETE( MPTEST.QUEUE_ID( 1 ), STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "MESSAGE_QUEUE_DELETE" + ); + + TEXT_IO.PUT_LINE( + "message_queue_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT" + ); + + MPTEST.SEND_MESSAGES; + + MPTEST.RECEIVE_MESSAGES; + + TEXT_IO.PUT_LINE( "Flushing remote empty queue" ); + RTEMS.MESSAGE_QUEUE.FLUSH( MPTEST.QUEUE_ID( 1 ), COUNT, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 1 ); + TEXT_IO.PUT_LINE( + " messages were flushed from remote empty queue" + ); + + TEXT_IO.PUT_LINE( + "Send messages to be flushed from remote queue" + ); + RTEMS.MESSAGE_QUEUE.SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + TEXT_IO.PUT_LINE( "Flushing remote queue" ); + RTEMS.MESSAGE_QUEUE.FLUSH( MPTEST.QUEUE_ID( 1 ), COUNT, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 1 ); + TEXT_IO.PUT_LINE( + " messages were flushed from the remote queue" + ); + + TEXT_IO.PUT_LINE( "Waiting for message queue to be deleted" ); + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.OBJECT_WAS_DELETED, + "MESSAGE_QUEUE_FLUSH" + ); + + else + + MPTEST.RECEIVE_MESSAGES; + + MPTEST.SEND_MESSAGES; + + RTEMS.TASKS.WAKE_AFTER( + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + RTEMS.MESSAGE_QUEUE.DELETE( MPTEST.QUEUE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 9 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp09/mptest.ads b/testsuites/ada/mptests/mp09/mptest.ads new file mode 100644 index 0000000000..360aebb491 --- /dev/null +++ b/testsuites/ada/mptests/mp09/mptest.ads @@ -0,0 +1,150 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 9 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- The following are message buffers used to contain the test messages +-- and pointers to those buffers. +-- + + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + BUFFER_AREA_1 : RTEMS.BUFFER; + BUFFER_AREA_2 : RTEMS.BUFFER; + BUFFER_AREA_3 : RTEMS.BUFFER; + BUFFER_AREA_4 : RTEMS.BUFFER; + + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + BUFFER_1 : RTEMS.BUFFER_POINTER; + BUFFER_2 : RTEMS.BUFFER_POINTER; + BUFFER_3 : RTEMS.BUFFER_POINTER; + BUFFER_4 : RTEMS.BUFFER_POINTER; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- SEND_MESSAGES +-- +-- This subprogram prints and sends a sequence of three test messages. +-- One of the messages is sent, one is urgent, and one is broadcast. +-- A one second pause is between each the sending of each message. +-- + + procedure SEND_MESSAGES; + +-- +-- RECEIVE_MESSAGES +-- +-- This subprogram receives and prints a sequence of three test messages. +-- + + procedure RECEIVE_MESSAGES; + +-- +-- FILL_BUFFER +-- +-- DESCRIPTION: +-- +-- This subprogram takes the SOURCE input string and places +-- up to the first sixteen characters of that string into +-- the message BUFFER. +-- + + procedure FILL_BUFFER ( + SOURCE : in STRING; + BUFFER : out RTEMS.BUFFER + ); + +-- +-- PUT_BUFFER +-- +-- DESCRIPTION: +-- +-- This subprogram prints the specified message BUFFER. +-- + + procedure PUT_BUFFER ( + BUFFER : in RTEMS.BUFFER + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp09/node1/Makefile.am b/testsuites/ada/mptests/mp09/node1/Makefile.am new file mode 100644 index 0000000000..54e44188f9 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp09_ada_mp09_node1 +mp09_ada_mp09_node1_SOURCES = mp09_node1.adb ../mptest.adb config.h +mp09_ada_mp09_node1_SOURCES += ../mptest.ads +mp09_ada_mp09_node1_SOURCES += ../../../support/init.c + +mp09_ada_mp09_node1$(EXEEXT): mp09_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp09-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp09/node1/ada_mp09-node1.scn b/testsuites/ada/mptests/mp09/node1/ada_mp09-node1.scn new file mode 100644 index 0000000000..167d6e18a5 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node1/ada_mp09-node1.scn @@ -0,0 +1,20 @@ +*** TEST 9 -- NODE 1 *** +Creating Message Queue (Global) +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +Receiver delaying for a second +message_queue_send : 123456789012345 +Delaying for a second +message_queue_urgent : abcdefghijklmno +Delaying for a second +message_queue_broadcast : ABCDEFGHIJKLMNO +Delaying for a second +*** END OF TEST 9 *** diff --git a/testsuites/ada/mptests/mp09/node1/config.h b/testsuites/ada/mptests/mp09/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp09/node1/mp09_node1.adb b/testsuites/ada/mptests/mp09/node1/mp09_node1.adb new file mode 100644 index 0000000000..df2a6ab344 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node1/mp09_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP09_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP09_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP09_NODE1; + diff --git a/testsuites/ada/mptests/mp09/node2/Makefile.am b/testsuites/ada/mptests/mp09/node2/Makefile.am new file mode 100644 index 0000000000..e2ec626ab1 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp09_ada_mp09_node2 +mp09_ada_mp09_node2_SOURCES = mp09_node2.adb ../mptest.adb config.h +mp09_ada_mp09_node2_SOURCES += ../mptest.ads +mp09_ada_mp09_node2_SOURCES += ../../../support/init.c + +mp09_ada_mp09_node2$(EXEEXT): mp09_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp09-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp09/node2/ada_mp09-node2.scn b/testsuites/ada/mptests/mp09/node2/ada_mp09-node2.scn new file mode 100644 index 0000000000..4cd8a7bff7 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node2/ada_mp09-node2.scn @@ -0,0 +1,26 @@ +*** TEST 9 -- NODE 2 *** +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +message_queue_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT +message_queue_send : 123456789012345 +Delaying for a second +message_queue_urgent : abcdefghijklmno +Delaying for a second +message_queue_broadcast : ABCDEFGHIJKLMNO +Delaying for a second +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +Receiver delaying for a second +Flushing remote empty queue +0 messages were flushed from remote empty queue +Send messages to be flushed from remote queue +Flushing remote queue +1 messages were flushed from the remote queue +Waiting for message queue to be deleted +*** END OF TEST 9 *** diff --git a/testsuites/ada/mptests/mp09/node2/config.h b/testsuites/ada/mptests/mp09/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp09/node2/mp09_node2.adb b/testsuites/ada/mptests/mp09/node2/mp09_node2.adb new file mode 100644 index 0000000000..adedcd20c6 --- /dev/null +++ b/testsuites/ada/mptests/mp09/node2/mp09_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP09_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP09_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP09_NODE2; + diff --git a/testsuites/ada/mptests/mp10/Makefile.am b/testsuites/ada/mptests/mp10/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp10/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp10/config_base.h b/testsuites/ada/mptests/mp10/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp10/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp10/mptest.adb b/testsuites/ada/mptests/mp10/mptest.adb new file mode 100644 index 0000000000..d773976a3e --- /dev/null +++ b/testsuites/ada/mptests/mp10/mptest.adb @@ -0,0 +1,295 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 10 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.MESSAGE_QUEUE; +with RTEMS.SEMAPHORE; +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( "*** TEST 10 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' ); + MPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'S', 'A', '3', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE.CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE.CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 0, + RTEMS.GLOBAL + RTEMS.PRIORITY, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + RTEMS.TASKS.WAKE_AFTER( 10 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + else + + TEXT_IO.PUT_LINE( "Creating Test_task 1 (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 1 (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 2 (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 2 (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK_2'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 3 (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 3 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 3 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 3 (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 3 ), + MPTEST.TEST_TASK_3'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Sleeping for 1 second ..." ); + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Deleting Test_task 2" ); + RTEMS.TASKS.DELETE( MPTEST.TASK_ID( 2 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF 2" ); + + TEXT_IO.PUT_LINE( "Deleting Test_task 1" ); + RTEMS.TASKS.DELETE( MPTEST.TASK_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF 1" ); + + TEXT_IO.PUT_LINE( "Restarting Test_task 3" ); + RTEMS.TASKS.RESTART( MPTEST.TASK_ID( 3 ), 1, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF 3" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 10 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +-- +-- TEST_TASK_1 +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( RECEIVE_BUFFER_AREA'ADDRESS ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE.IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to receive message ..." ); + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + end TEST_TASK_1; + +-- +-- TEST_TASK_2 +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE.IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to acquire semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end TEST_TASK_2; + +-- +-- TEST_TASK_3 +-- + + procedure TEST_TASK_3 ( + RESTART : in RTEMS.TASKS.ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + if RESTART = 1 then + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE.IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to acquire semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end TEST_TASK_3; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp10/mptest.ads b/testsuites/ada/mptests/mp10/mptest.ads new file mode 100644 index 0000000000..05764ebf0b --- /dev/null +++ b/testsuites/ada/mptests/mp10/mptest.ads @@ -0,0 +1,122 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 10 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_TASK_1 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK_1); + +-- +-- TEST_TASK_2 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK_2); + +-- +-- TEST_TASK_3 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_3 ( + RESTART : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK_3); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp10/node1/Makefile.am b/testsuites/ada/mptests/mp10/node1/Makefile.am new file mode 100644 index 0000000000..f682f3275e --- /dev/null +++ b/testsuites/ada/mptests/mp10/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp10_ada_mp10_node1 +mp10_ada_mp10_node1_SOURCES = mp10_node1.adb ../mptest.adb config.h +mp10_ada_mp10_node1_SOURCES += ../mptest.ads +mp10_ada_mp10_node1_SOURCES += ../../../support/init.c + +mp10_ada_mp10_node1$(EXEEXT): mp10_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp10-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp10/node1/ada_mp10-node1.scn b/testsuites/ada/mptests/mp10/node1/ada_mp10-node1.scn new file mode 100644 index 0000000000..deeafc0a9a --- /dev/null +++ b/testsuites/ada/mptests/mp10/node1/ada_mp10-node1.scn @@ -0,0 +1,4 @@ +*** TEST 10 -- NODE 1 *** +Creating Message Queue (Global) +Creating Semaphore (Global) +*** END OF TEST 10 *** diff --git a/testsuites/ada/mptests/mp10/node1/config.h b/testsuites/ada/mptests/mp10/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp10/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp10/node1/mp10_node1.adb b/testsuites/ada/mptests/mp10/node1/mp10_node1.adb new file mode 100644 index 0000000000..9174d74a7d --- /dev/null +++ b/testsuites/ada/mptests/mp10/node1/mp10_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP10_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP10_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP10_NODE1; + diff --git a/testsuites/ada/mptests/mp10/node2/Makefile.am b/testsuites/ada/mptests/mp10/node2/Makefile.am new file mode 100644 index 0000000000..cc6335b4e7 --- /dev/null +++ b/testsuites/ada/mptests/mp10/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp10_ada_mp10_node2 +mp10_ada_mp10_node2_SOURCES = mp10_node2.adb ../mptest.adb config.h +mp10_ada_mp10_node2_SOURCES += ../mptest.ads +mp10_ada_mp10_node2_SOURCES += ../../../support/init.c + +mp10_ada_mp10_node2$(EXEEXT): mp10_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp10-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp10/node2/ada_mp10-node2.scn b/testsuites/ada/mptests/mp10/node2/ada_mp10-node2.scn new file mode 100644 index 0000000000..c0337fdacf --- /dev/null +++ b/testsuites/ada/mptests/mp10/node2/ada_mp10-node2.scn @@ -0,0 +1,18 @@ +*** TEST 10 -- NODE 2 *** +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Creating Test_task 3 (local) +Starting Test_task 3 (local) +Sleeping for 1 second ... +Getting QID of message queue +Attempting to receive message ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Deleting Test_task 2 +Deleting Test_task 1 +Restarting Test_task 3 +*** END OF TEST 10 *** diff --git a/testsuites/ada/mptests/mp10/node2/config.h b/testsuites/ada/mptests/mp10/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp10/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp10/node2/mp10_node2.adb b/testsuites/ada/mptests/mp10/node2/mp10_node2.adb new file mode 100644 index 0000000000..ee7bb6bcc8 --- /dev/null +++ b/testsuites/ada/mptests/mp10/node2/mp10_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP10_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP10_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP10_NODE2; + diff --git a/testsuites/ada/mptests/mp11/Makefile.am b/testsuites/ada/mptests/mp11/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp11/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp11/config_base.h b/testsuites/ada/mptests/mp11/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp11/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp11/mptest.adb b/testsuites/ada/mptests/mp11/mptest.adb new file mode 100644 index 0000000000..9ad9f52fca --- /dev/null +++ b/testsuites/ada/mptests/mp11/mptest.adb @@ -0,0 +1,136 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 11 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.MESSAGE_QUEUE; +with RTEMS.PARTITION; +with RTEMS.SEMAPHORE; +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( "*** TEST 11 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Attempting to create Test_task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "TASK_CREATE" + ); + TEXT_IO.PUT_LINE( "task_create correctly returned TOO_MANY" ); + + TEXT_IO.PUT_LINE( "Attempting to create Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE.CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "MESSAGE_QUEUE_CREATE" + ); + TEXT_IO.PUT_LINE( + "message_queue_create correctly returned TOO_MANY" + ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE.CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "SEMAPHORE_CREATE" + ); + TEXT_IO.PUT_LINE( "semaphore_create correctly returned TOO_MANY" ); + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION.CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 128, + 64, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "PARTITION_CREATE" + ); + TEXT_IO.PUT_LINE( "partition_create correctly returned TOO_MANY" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 11 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp11/mptest.ads b/testsuites/ada/mptests/mp11/mptest.ads new file mode 100644 index 0000000000..2899df8e34 --- /dev/null +++ b/testsuites/ada/mptests/mp11/mptest.ads @@ -0,0 +1,79 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 11 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS partition +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 1023 ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp11/node1/Makefile.am b/testsuites/ada/mptests/mp11/node1/Makefile.am new file mode 100644 index 0000000000..0511699d9f --- /dev/null +++ b/testsuites/ada/mptests/mp11/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp11_ada_mp11_node1 +mp11_ada_mp11_node1_SOURCES = mp11_node1.adb ../mptest.adb config.h +mp11_ada_mp11_node1_SOURCES += ../mptest.ads +mp11_ada_mp11_node1_SOURCES += ../../../support/init.c + +mp11_ada_mp11_node1$(EXEEXT): mp11_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp11-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp11/node1/ada_mp11-node1.scn b/testsuites/ada/mptests/mp11/node1/ada_mp11-node1.scn new file mode 100644 index 0000000000..013426bf91 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node1/ada_mp11-node1.scn @@ -0,0 +1,10 @@ +*** TEST 11 -- NODE 1 *** +Attempting to create Test_task (Global) +task_create correctly returned TOO_MANY +Attempting to create Message Queue (Global) +message_queue_create correctly returned TOO_MANY +Creating Semaphore (Global) +semaphore_create correctly returned TOO_MANY +Creating Partition (Global) +partition_create correctly returned TOO_MANY +*** END OF TEST 11 *** diff --git a/testsuites/ada/mptests/mp11/node1/config.h b/testsuites/ada/mptests/mp11/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp11/node1/mp11_node1.adb b/testsuites/ada/mptests/mp11/node1/mp11_node1.adb new file mode 100644 index 0000000000..859cbc4ac8 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node1/mp11_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP11_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP11_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP11_NODE1; + diff --git a/testsuites/ada/mptests/mp11/node2/Makefile.am b/testsuites/ada/mptests/mp11/node2/Makefile.am new file mode 100644 index 0000000000..7055fcc093 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp11_ada_mp11_node2 +mp11_ada_mp11_node2_SOURCES = mp11_node2.adb ../mptest.adb config.h +mp11_ada_mp11_node2_SOURCES += ../mptest.ads +mp11_ada_mp11_node2_SOURCES += ../../../support/init.c + +mp11_ada_mp11_node2$(EXEEXT): mp11_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp11-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp11/node2/ada_mp11-node2.scn b/testsuites/ada/mptests/mp11/node2/ada_mp11-node2.scn new file mode 100644 index 0000000000..49bd8a3219 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node2/ada_mp11-node2.scn @@ -0,0 +1,2 @@ +*** TEST 11 -- NODE 2 *** +*** END OF TEST 11 *** diff --git a/testsuites/ada/mptests/mp11/node2/config.h b/testsuites/ada/mptests/mp11/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp11/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp11/node2/mp11_node2.adb b/testsuites/ada/mptests/mp11/node2/mp11_node2.adb new file mode 100644 index 0000000000..601b21574b --- /dev/null +++ b/testsuites/ada/mptests/mp11/node2/mp11_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP11_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP11_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP11_NODE2; + diff --git a/testsuites/ada/mptests/mp12/Makefile.am b/testsuites/ada/mptests/mp12/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp12/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp12/config_base.h b/testsuites/ada/mptests/mp12/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp12/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp12/mptest.adb b/testsuites/ada/mptests/mp12/mptest.adb new file mode 100644 index 0000000000..74dd2e86bd --- /dev/null +++ b/testsuites/ada/mptests/mp12/mptest.adb @@ -0,0 +1,148 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 12 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.PARTITION; +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 + BUFFER_ADDRESS : RTEMS.ADDRESS; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 12 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + TEXT_IO.PUT_LINE( "Got to the initialization task" ); + + if TEST_SUPPORT.NODE = 2 then + + RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting ID of remote Partition (Global)" ); + + loop + + RTEMS.PARTITION.IDENT( + MPTEST.PARTITION_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( + "Attempting to delete remote Partition (Global)" + ); + + RTEMS.PARTITION.DELETE( MPTEST.PARTITION_ID( 1 ), STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "PARTITION_DELETE" + ); + + TEXT_IO.PUT_LINE( + "partition_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT!!" + ); + + TEXT_IO.PUT_LINE( "Obtaining a buffer from the global partition" ); + + RTEMS.PARTITION.GET_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" ); + TEXT_IO.PUT( "Address returned was : " ); + UNSIGNED32_IO.PUT( + RTEMS.SUBTRACT( BUFFER_ADDRESS, RTEMS.NULL_ADDRESS ), + WIDTH => 8, + BASE => 16 + ); + TEXT_IO.NEW_LINE; + + RTEMS.PARTITION.RETURN_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" ); + + RTEMS.TASKS.WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + else + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION.CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 128, + 64, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" ); + + TEXT_IO.PUT_LINE( "Sleeping for three seconds" ); + RTEMS.TASKS.WAKE_AFTER( 3 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Deleting Partition (Global)" ); + RTEMS.PARTITION.DELETE( MPTEST.PARTITION_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 12 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp12/mptest.ads b/testsuites/ada/mptests/mp12/mptest.ads new file mode 100644 index 0000000000..dd33b558bb --- /dev/null +++ b/testsuites/ada/mptests/mp12/mptest.ads @@ -0,0 +1,77 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 12 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 1023 ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp12/node1/Makefile.am b/testsuites/ada/mptests/mp12/node1/Makefile.am new file mode 100644 index 0000000000..9daa6a0c71 --- /dev/null +++ b/testsuites/ada/mptests/mp12/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp12_ada_mp12_node1 +mp12_ada_mp12_node1_SOURCES = mp12_node1.adb ../mptest.adb config.h +mp12_ada_mp12_node1_SOURCES += ../mptest.ads +mp12_ada_mp12_node1_SOURCES += ../../../support/init.c + +mp12_ada_mp12_node1$(EXEEXT): mp12_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp12-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp12/node1/ada_mp12-node1.scn b/testsuites/ada/mptests/mp12/node1/ada_mp12-node1.scn new file mode 100644 index 0000000000..40646722eb --- /dev/null +++ b/testsuites/ada/mptests/mp12/node1/ada_mp12-node1.scn @@ -0,0 +1,6 @@ +*** TEST 12 -- NODE 1 *** +Got to the initialization task +Creating Partition (Global) +Sleeping for three seconds +Deleting Partition (Global) +*** END OF TEST 12 *** diff --git a/testsuites/ada/mptests/mp12/node1/config.h b/testsuites/ada/mptests/mp12/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp12/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp12/node1/mp12_node1.adb b/testsuites/ada/mptests/mp12/node1/mp12_node1.adb new file mode 100644 index 0000000000..04c049cb5d --- /dev/null +++ b/testsuites/ada/mptests/mp12/node1/mp12_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP12_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP12_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP12_NODE1; + diff --git a/testsuites/ada/mptests/mp12/node2/Makefile.am b/testsuites/ada/mptests/mp12/node2/Makefile.am new file mode 100644 index 0000000000..b3e8df357c --- /dev/null +++ b/testsuites/ada/mptests/mp12/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp12_ada_mp12_node2 +mp12_ada_mp12_node2_SOURCES = mp12_node2.adb ../mptest.adb config.h +mp12_ada_mp12_node2_SOURCES += ../mptest.ads +mp12_ada_mp12_node2_SOURCES += ../../../support/init.c + +mp12_ada_mp12_node2$(EXEEXT): mp12_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp12-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp12/node2/ada_mp12-node2.scn b/testsuites/ada/mptests/mp12/node2/ada_mp12-node2.scn new file mode 100644 index 0000000000..2189ae9959 --- /dev/null +++ b/testsuites/ada/mptests/mp12/node2/ada_mp12-node2.scn @@ -0,0 +1,9 @@ +*** TEST 12 -- NODE 2 *** +Got to the initialization task +Getting ID of remote Partition (Global) +Attempting to delete remote Partition (Global) +partition_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT!! +Obtaining a buffer from the global partition +Address returned was : 0x200f0000 +NOTE: Address printed will probably differ!!! +*** END OF TEST 12 *** diff --git a/testsuites/ada/mptests/mp12/node2/config.h b/testsuites/ada/mptests/mp12/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp12/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp12/node2/mp12_node2.adb b/testsuites/ada/mptests/mp12/node2/mp12_node2.adb new file mode 100644 index 0000000000..0f046593d6 --- /dev/null +++ b/testsuites/ada/mptests/mp12/node2/mp12_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP12_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP12_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP12_NODE2; + diff --git a/testsuites/ada/mptests/mp13/Makefile.am b/testsuites/ada/mptests/mp13/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp13/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp13/config_base.h b/testsuites/ada/mptests/mp13/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp13/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp13/mptest.adb b/testsuites/ada/mptests/mp13/mptest.adb new file mode 100644 index 0000000000..6dc79ab486 --- /dev/null +++ b/testsuites/ada/mptests/mp13/mptest.adb @@ -0,0 +1,323 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 13 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.MESSAGE_QUEUE; +with RTEMS.SEMAPHORE; +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( "*** TEST 13 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE.CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE.CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL + RTEMS.PRIORITY, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task 1 (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 1 (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 2 (local)" ); + RTEMS.TASKS.CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 2 (local)" ); + RTEMS.TASKS.START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK_2'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + if TEST_SUPPORT.NODE = 1 then + + RTEMS.TASKS.WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TEST_TASK_1 +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( RECEIVE_BUFFER_AREA'ADDRESS ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE.IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEXT_IO.PUT_LINE( "How did I get back from here???" ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + end if; + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "MESSAGE_QUEUE_RECEIVE" + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "MESSAGE_QUEUE_OBTAIN" + ); + + TEXT_IO.PUT_LINE( + "message_queue_receive correctly returned TIMEOUT" + ); + + TEXT_IO.PUT_LINE( "Deleting self" ); + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end TEST_TASK_1; + +-- +-- TEST_TASK_2 +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE.IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Releasing semaphore ..." ); + RTEMS.SEMAPHORE.RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND / 2, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEXT_IO.PUT_LINE( "How did I get back from here???" ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end if; + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND / 2, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + TEXT_IO.PUT_LINE( "Releasing semaphore ..." ); + RTEMS.SEMAPHORE.RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + RTEMS.TASKS.WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "SEMAPHORE_OBTAIN" + ); + TEXT_IO.PUT_LINE( "semaphore_obtain correctly returned TIMEOUT" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK_2; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp13/mptest.ads b/testsuites/ada/mptests/mp13/mptest.ads new file mode 100644 index 0000000000..8caa2347c9 --- /dev/null +++ b/testsuites/ada/mptests/mp13/mptest.ads @@ -0,0 +1,103 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 13 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; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_TASK_1 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK_1); + +-- +-- TEST_TASK_2 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK_2); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp13/node1/Makefile.am b/testsuites/ada/mptests/mp13/node1/Makefile.am new file mode 100644 index 0000000000..bf641cec25 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp13_ada_mp13_node1 +mp13_ada_mp13_node1_SOURCES = mp13_node1.adb ../mptest.adb config.h +mp13_ada_mp13_node1_SOURCES += ../mptest.ads +mp13_ada_mp13_node1_SOURCES += ../../../support/init.c + +mp13_ada_mp13_node1$(EXEEXT): mp13_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp13-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp13/node1/ada_mp13-node1.scn b/testsuites/ada/mptests/mp13/node1/ada_mp13-node1.scn new file mode 100644 index 0000000000..d3bd11f65e --- /dev/null +++ b/testsuites/ada/mptests/mp13/node1/ada_mp13-node1.scn @@ -0,0 +1,14 @@ +*** TEST 13 -- NODE 1 *** +Creating Message Queue (Global) +Creating Semaphore (Global) +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Getting QID of message queue +Receiving message ... +Getting SMID of semaphore +Releasing semaphore ... +Getting semaphore ... +Getting semaphore ... +*** END OF TEST 13 *** diff --git a/testsuites/ada/mptests/mp13/node1/config.h b/testsuites/ada/mptests/mp13/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp13/node1/mp13_node1.adb b/testsuites/ada/mptests/mp13/node1/mp13_node1.adb new file mode 100644 index 0000000000..561bc67ba5 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node1/mp13_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP13_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP13_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP13_NODE1; + diff --git a/testsuites/ada/mptests/mp13/node2/Makefile.am b/testsuites/ada/mptests/mp13/node2/Makefile.am new file mode 100644 index 0000000000..95e9798ad7 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp13_ada_mp13_node2 +mp13_ada_mp13_node2_SOURCES = mp13_node2.adb ../mptest.adb config.h +mp13_ada_mp13_node2_SOURCES += ../mptest.ads +mp13_ada_mp13_node2_SOURCES += ../../../support/init.c + +mp13_ada_mp13_node2$(EXEEXT): mp13_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp13-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp13/node2/ada_mp13-node2.scn b/testsuites/ada/mptests/mp13/node2/ada_mp13-node2.scn new file mode 100644 index 0000000000..3254046292 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node2/ada_mp13-node2.scn @@ -0,0 +1,16 @@ +*** TEST 13 -- NODE 2 *** +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Deleting initialization task +Getting QID of message queue +Getting SMID of semaphore +Getting semaphore ... +Releasing semaphore ... +Receiving message ... +Getting semaphore ... +message_queue_receive correctly returned TIMEOUT +Deleting self +semaphore_obtain correctly returned TIMEOUT +*** END OF TEST 13 *** diff --git a/testsuites/ada/mptests/mp13/node2/config.h b/testsuites/ada/mptests/mp13/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp13/node2/mp13_node2.adb b/testsuites/ada/mptests/mp13/node2/mp13_node2.adb new file mode 100644 index 0000000000..e197f5aa12 --- /dev/null +++ b/testsuites/ada/mptests/mp13/node2/mp13_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP13_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP13_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP13_NODE2; + diff --git a/testsuites/ada/mptests/mp14/Makefile.am b/testsuites/ada/mptests/mp14/Makefile.am new file mode 100644 index 0000000000..d1dad5313a --- /dev/null +++ b/testsuites/ada/mptests/mp14/Makefile.am @@ -0,0 +1,4 @@ +_SUBDIRS = node1 node2 + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp14/config_base.h b/testsuites/ada/mptests/mp14/config_base.h new file mode 100644 index 0000000000..c1b8f24e86 --- /dev/null +++ b/testsuites/ada/mptests/mp14/config_base.h @@ -0,0 +1,28 @@ +/* config_base.h + * + * This include file defines all of the Configuration Table for this test + * EXCEPT the NODE NUMBER. + * + * 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. + */ + + + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#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/mptests/mp14/mptest.adb b/testsuites/ada/mptests/mp14/mptest.adb new file mode 100644 index 0000000000..c795dc28bd --- /dev/null +++ b/testsuites/ada/mptests/mp14/mptest.adb @@ -0,0 +1,766 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 14 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 INTERFACES.C; +with RTEMS; +with RTEMS.EVENT; +with RTEMS.MESSAGE_QUEUE; +with RTEMS.PARTITION; +with RTEMS.SEMAPHORE; +with RTEMS.TASKS; +with RTEMS.TIMER; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +with System.Storage_Elements; use System.Storage_Elements; + +package body MPTEST is + +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +-- +-- EXIT_TEST +-- + + procedure EXIT_TEST is + OLD_MODE : RTEMS.MODE; + STATUS : RTEMS.STATUS_CODES; + procedure BSP_MPCI_PRINT_STATISTICS; + pragma Import (C, BSP_MPCI_PRINT_STATISTICS, "MPCI_Print_statistics" ); + begin + + RTEMS.TASKS.MODE(RTEMS.NO_PREEMPT, RTEMS.PREEMPT_MASK, OLD_MODE, STATUS); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" ); + + BSP_MPCI_PRINT_STATISTICS; + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end EXIT_TEST; + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + INDEX : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 14 -- NODE " ); + UNSIGNED32_IO.PUT( + TEST_SUPPORT.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.STOP_TIMER_NAME := RTEMS.BUILD_NAME( 'S', 'T', 'O', 'P' ); + + MPTEST.STOP_TEST := FALSE; + + RTEMS.TIMER.CREATE( + MPTEST.STOP_TIMER_NAME, + MPTEST.STOP_TIMER_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + RTEMS.TIMER.FIRE_AFTER( + MPTEST.STOP_TIMER_ID, + TEST_SUPPORT.MAXIMUM_LONG_TEST_DURATION * + TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + MPTEST.EVENT_TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.EVENT_TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'T', '1', ' ' ); + MPTEST.QUEUE_TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'M', 'T', '2', ' ' ); + + MPTEST.PARTITION_TASK_NAME( 1 ) := + RTEMS.BUILD_NAME( 'P', 'T', '1', ' ' ); + MPTEST.PARTITION_TASK_NAME( 2 ) := + RTEMS.BUILD_NAME( 'P', 'T', '2', ' ' ); + + MPTEST.SEMAPHORE_TASK_NAME( 1 ) := + RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' ); + MPTEST.SEMAPHORE_TASK_NAME( 2 ) := + RTEMS.BUILD_NAME( 'S', 'M', '2', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', 'R', ' ' ); + + for INDEX in MPTEST.BUFFERS'FIRST .. MPTEST.BUFFERS'LAST + loop + + MPTEST.BUFFERS( INDEX ) := + MPTEST.BUFFER_AREAS( INDEX )'ADDRESS; + + end loop; + + if TEST_SUPPORT.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE.CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE.CREATE( + MPTEST.QUEUE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION.CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 16#8000#, + 16#3000#, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Event task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.EVENT_TASK_NAME( + TEST_SUPPORT.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.EVENT_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Event task (Global)" ); + RTEMS.TASKS.START( + MPTEST.EVENT_TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.SEMAPHORE_TASK_NAME( + TEST_SUPPORT.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Semaphore task (Global)" ); + RTEMS.TASKS.START( + MPTEST.SEMAPHORE_TASK_ID( 1 ), + MPTEST.SEMAPHORE_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Message Queue task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.QUEUE_TASK_NAME( + TEST_SUPPORT.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.QUEUE_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Message Queue task (Global)" ); + RTEMS.TASKS.START( + MPTEST.QUEUE_TASK_ID( 1 ), + MPTEST.MESSAGE_QUEUE_TASK'ACCESS, + 1, -- index of buffer + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Partition task (Global)" ); + RTEMS.TASKS.CREATE( + MPTEST.PARTITION_TASK_NAME( + TEST_SUPPORT.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.PARTITION_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Partition task (Global)" ); + RTEMS.TASKS.START( + MPTEST.PARTITION_TASK_ID( 1 ), + MPTEST.PARTITION_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + RTEMS.TASKS.SET_PRIORITY( RTEMS.SELF, 2, PREVIOUS_PRIORITY, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + MPTEST.DELAYED_EVENTS_TASK( 1 ); + + end INIT; + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.EVENT.SEND( + MPTEST.TASK_ID( RTEMS.GET_INDEX( TIMER_ID ) ), + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end DELAYED_SEND_EVENT; + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + REMOTE_NODE : RTEMS.UNSIGNED32; + REMOTE_TID : RTEMS.ID; + COUNT : RTEMS.UNSIGNED32; + EVENT_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + if TEST_SUPPORT.NODE = 1 then + REMOTE_NODE := 2; + else + REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT_LINE( "About to go to sleep!" ); + RTEMS.TASKS.WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + TEXT_IO.PUT_LINE( "Waking up!" ); + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.EVENT_TASK_NAME( REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + + loop + + RTEMS.TASKS.IDENT( + MPTEST.EVENT_TASK_NAME( REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "task_ident" ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + TEXT_IO.PUT_LINE( "Sending events to remote task" ); + + loop + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT + loop + RTEMS.EVENT.SEND( + REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + exit when MPTEST.STOP_TEST = TRUE; + + end loop; + + TEST_SUPPORT.PUT_DOT( "e" ); + + end loop; + + end if; + + TEXT_IO.PUT_LINE( "Receiving events from remote task" ); + + loop + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT + loop + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + EVENT_OUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "e" ); + + end loop; + + MPTEST.EXIT_TEST; + + end TEST_TASK; + +-- +-- DELAYED_EVENTS_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure DELAYED_EVENTS_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + PREVIOUS_MODE : RTEMS.MODE; + EVENTS_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASKS.MODE( + RTEMS.PREEMPT + RTEMS.TIMESLICE, + RTEMS.PREEMPT_MASK + RTEMS.TIMESLICE_MASK, + PREVIOUS_MODE, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" ); + + RTEMS.TIMER.CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + RTEMS.TASKS.IDENT( + RTEMS.SELF, + RTEMS.SEARCH_ALL_NODES, + MPTEST.TASK_ID( RTEMS.GET_INDEX( MPTEST.TIMER_ID( 1 ) ) ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENTS" ); + + loop + + for COUNT in 1 .. MPTEST.DELAYED_EVENT_DOT_COUNT + loop + RTEMS.TIMER.FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 1, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + RTEMS.EVENT.RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + EVENTS_OUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "." ); + + end loop; + + MPTEST.EXIT_TEST; + + end DELAYED_EVENTS_TASK; + +-- +-- MESSAGE_QUEUE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure MESSAGE_QUEUE_TASK ( + INDEX : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + YIELD_COUNT : RTEMS.UNSIGNED32; + OVERFLOW_COUNT : RTEMS.UNSIGNED32_POINTER; + BUFFER_COUNT : RTEMS.UNSIGNED32_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.BUFFERS( INDEX ).FIELD1 := 0; + MPTEST.BUFFERS( INDEX ).FIELD2 := 0; + MPTEST.BUFFERS( INDEX ).FIELD3 := 0; + MPTEST.BUFFERS( INDEX ).FIELD4 := 0; + + TEXT_IO.PUT_LINE( "Getting ID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE.IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "message_queue_ident FAILED!!" ); + + end loop; + + if TEST_SUPPORT.NODE = 1 then + + RTEMS.MESSAGE_QUEUE.SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD1'ADDRESS + ); + + BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD2'ADDRESS + ); + + else + + OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD3'ADDRESS + ); + + BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD4'ADDRESS + ); + + end if; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + YIELD_COUNT := 100; + + for COUNT in 1 .. MPTEST.MESSAGE_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.MESSAGE_QUEUE.RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, + "MESSAGE_QUEUE_RECEIVE" + ); + + if BUFFER_COUNT.ALL = RTEMS.UNSIGNED32'LAST then + BUFFER_COUNT.ALL := 0; + OVERFLOW_COUNT.ALL := OVERFLOW_COUNT.ALL + 1; + else + BUFFER_COUNT.ALL := BUFFER_COUNT.ALL + 1; + end if; + + RTEMS.MESSAGE_QUEUE.SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + if MPTEST.STOP_TEST = FALSE then + if TEST_SUPPORT.NODE = 1 then + + YIELD_COUNT := YIELD_COUNT - 1; + + if YIELD_COUNT = 0 then + + RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + YIELD_COUNT := 100; + + end if; + + end if; + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "m" ); + + end loop; + + MPTEST.EXIT_TEST; + + end MESSAGE_QUEUE_TASK; + +-- +-- PARTITION_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure PARTITION_TASK ( + IGNORED : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + BUFFER : RTEMS.ADDRESS; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting ID of partition" ); + + loop + + RTEMS.PARTITION.IDENT( + MPTEST.PARTITION_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "partition_ident FAILED!!" ); + + end loop; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.PARTITION_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.PARTITION.GET_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" ); + + RTEMS.PARTITION.RETURN_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, + "PARTITION_RETURN_BUFFER" + ); + + if TEST_SUPPORT.NODE = 1 then + + RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "p" ); + + end loop; + + MPTEST.EXIT_TEST; + + end PARTITION_TASK; + +-- +-- SEMAPHORE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure SEMAPHORE_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + YIELD_COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting ID of semaphore" ); + + loop + + RTEMS.SEMAPHORE.IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "semaphore_ident FAILED!!" ); + + end loop; + + loop + + YIELD_COUNT := 100; + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.SEMAPHORE_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.SEMAPHORE.OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + RTEMS.SEMAPHORE.RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + if TEST_SUPPORT.NODE = 1 then + + YIELD_COUNT := YIELD_COUNT - 1; + + if YIELD_COUNT = 0 then + + RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + YIELD_COUNT := 100; + + end if; + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "s" ); + + end loop; + + MPTEST.EXIT_TEST; + + end SEMAPHORE_TASK; + +end MPTEST; diff --git a/testsuites/ada/mptests/mp14/mptest.ads b/testsuites/ada/mptests/mp14/mptest.ads new file mode 100644 index 0000000000..1cf0b80942 --- /dev/null +++ b/testsuites/ada/mptests/mp14/mptest.ads @@ -0,0 +1,246 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 14 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 for passing event sets. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for passing event sets. +-- + + EVENT_TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + EVENT_TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for manipulating semaphores. +-- + + SEMAPHORE_TASK_ID : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + SEMAPHORE_TASK_NAME : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for passing messages. +-- + + QUEUE_TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + QUEUE_TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for manipulating the global partitions. +-- + + PARTITION_TASK_ID : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + PARTITION_TASK_NAME : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS partitions +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphores +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message_queues +-- created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers +-- created by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- The following are message buffers used to contain the test messages +-- and pointers to those buffers. +-- + + BUFFER_AREAS : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.BUFFER; + BUFFERS : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ADDRESS; + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 16#7FFF# ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +-- +-- The following constants control the flow of "dot" indicators +-- from the various test componenents. +-- + + EVENT_TASK_DOT_COUNT : constant RTEMS.UNSIGNED32 := 100; + EVENT_SEND_DOT_COUNT : constant RTEMS.UNSIGNED32 := 100; + DELAYED_EVENT_DOT_COUNT : constant RTEMS.UNSIGNED32 := 1000; + MESSAGE_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + PARTITION_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + SEMAPHORE_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + +-- +-- These contain the IDs and NAMEs of the RTEMS timers used +-- by this test to stop. +-- + + STOP_TIMER_ID : RTEMS.ID; + STOP_TIMER_NAME : RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + + STOP_TEST : BOOLEAN; + +-- +-- EXIT_TEST +-- +-- DESCRIPTION: +-- +-- This subprogram is invoked to stop this test. +-- + + procedure EXIT_TEST; + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TEST_TASK); + +-- +-- DELAYED_EVENTS_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure DELAYED_EVENTS_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, DELAYED_EVENTS_TASK); + +-- +-- MESSAGE_QUEUE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure MESSAGE_QUEUE_TASK ( + INDEX : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, MESSAGE_QUEUE_TASK); + +-- +-- PARTITION_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure PARTITION_TASK ( + IGNORED : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, PARTITION_TASK); + +-- +-- SEMAPHORE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure SEMAPHORE_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, SEMAPHORE_TASK); + +end MPTEST; diff --git a/testsuites/ada/mptests/mp14/node1/Makefile.am b/testsuites/ada/mptests/mp14/node1/Makefile.am new file mode 100644 index 0000000000..6e2a21263f --- /dev/null +++ b/testsuites/ada/mptests/mp14/node1/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp14_ada_mp14_node1 +mp14_ada_mp14_node1_SOURCES = mp14_node1.adb ../mptest.adb config.h +mp14_ada_mp14_node1_SOURCES += ../mptest.ads +mp14_ada_mp14_node1_SOURCES += ../../../support/init.c + +mp14_ada_mp14_node1$(EXEEXT): mp14_node1.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp14-node1.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp14/node1/ada_mp14-node1.scn b/testsuites/ada/mptests/mp14/node1/ada_mp14-node1.scn new file mode 100644 index 0000000000..d1b6feefe9 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node1/ada_mp14-node1.scn @@ -0,0 +1,33 @@ +*** TEST 14 -- NODE 1 *** +Creating Semaphore (Global) +Creating Message Queue (Global) +Creating Partition (Global) +Creating Event task (Global) +Starting Event task (Global) +Creating Semaphore task (Global) +About to go to sleep! +Starting Semaphore task (Global) +Creating Message Queue task (Global) +Getting SMID of semaphore +Starting Message Queue task (Global) +Creating Partition task (Global) +Getting ID of msg queue +Starting Partition task (Global) +Getting ID of partition +Waking up! +Remote task's name is : 222 +Getting TID of remote task +Sending events to remote task +<stream of following characters> +. - indicates 100 iterations of +tm_evafter of 1 tick and event_receive. +e - indicates that 100 +events have been sent to the remote task. +m - indicates 100 iterations of +message_queue_send and message_queue_receive. +p - indicates 100 iterations of +partition_get_buffer and partition_return_buffer. +s - indicates 100 iterations of +semaphore_obtain and semaphore_release. +NOTE: The characters in the stream could begin to appear whenever any +task is started. diff --git a/testsuites/ada/mptests/mp14/node1/config.h b/testsuites/ada/mptests/mp14/node1/config.h new file mode 100644 index 0000000000..36c9d133e8 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node1/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 1 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp14/node1/mp14_node1.adb b/testsuites/ada/mptests/mp14/node1/mp14_node1.adb new file mode 100644 index 0000000000..766fc5d816 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node1/mp14_node1.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP14_NODE1 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP14_NODE1 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP14_NODE1; + diff --git a/testsuites/ada/mptests/mp14/node2/Makefile.am b/testsuites/ada/mptests/mp14/node2/Makefile.am new file mode 100644 index 0000000000..b694774c46 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node2/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 + +AM_ADAFLAGS += -I$(srcdir)/.. + +noinst_PROGRAMS = mp14_ada_mp14_node2 +mp14_ada_mp14_node2_SOURCES = mp14_node2.adb ../mptest.adb config.h +mp14_ada_mp14_node2_SOURCES += ../mptest.ads +mp14_ada_mp14_node2_SOURCES += ../../../support/init.c + +mp14_ada_mp14_node2$(EXEEXT): mp14_node2.adb ../mptest.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_mp14-node2.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/mptests/mp14/node2/ada_mp14-node2.scn b/testsuites/ada/mptests/mp14/node2/ada_mp14-node2.scn new file mode 100644 index 0000000000..a245b11faa --- /dev/null +++ b/testsuites/ada/mptests/mp14/node2/ada_mp14-node2.scn @@ -0,0 +1,28 @@ +*** TEST 14 -- NODE 2 *** +Creating Event task (Global) +Starting Event task (Global) +Creating Semaphore task (Global) +About to go to sleep! +Starting Semaphore task (Global) +Creating Message Queue task (Global) +Getting SMID of semaphore +Starting Message Queue task (Global) +Creating Partition task (Global) +Getting ID of msg queue +Starting Partition task (Global) +Getting ID of partition +Waking up! +Remote task's name is : 111 +Getting TID of remote task +Receiving events from remote task +<stream of following characters> +. - indicates 100 iterations of +tm_evafter of 1 tick and event_receive. +e - indicates that 100 +events have been sent to the remote task. +m - indicates 100 iterations of +message_queue_send and message_queue_receive. +p - indicates 100 iterations of +partition_get_buffer and partition_return_buffer. +s - indicates 100 iterations of +semaphore_obtain and semaphore_release. diff --git a/testsuites/ada/mptests/mp14/node2/config.h b/testsuites/ada/mptests/mp14/node2/config.h new file mode 100644 index 0000000000..47edf66149 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node2/config.h @@ -0,0 +1,21 @@ +/* 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_MP_APPLICATION +#define CONFIGURE_MP_NODE_NUMBER 2 + +#include "../config_base.h" + +/* end of include file */ diff --git a/testsuites/ada/mptests/mp14/node2/mp14_node2.adb b/testsuites/ada/mptests/mp14/node2/mp14_node2.adb new file mode 100644 index 0000000000..fb92b69554 --- /dev/null +++ b/testsuites/ada/mptests/mp14/node2/mp14_node2.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test MP14_NODE2 of the 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; +with MPTEST; +with TEST_SUPPORT; + +procedure MP14_NODE2 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, + MPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end MP14_NODE2; + |