diff options
Diffstat (limited to 'testsuites/ada/mptests/mp05')
-rw-r--r-- | testsuites/ada/mptests/mp05/Makefile.am | 4 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/config_base.h | 28 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/mptest.adb | 247 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/mptest.ads | 142 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node1/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node1/ada_mp05-node1.scn | 11 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node1/config.h | 21 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node1/mp05_node1.adb | 56 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node2/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node2/ada_mp05-node2.scn | 10 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node2/config.h | 21 | ||||
-rw-r--r-- | testsuites/ada/mptests/mp05/node2/mp05_node2.adb | 56 |
12 files changed, 634 insertions, 0 deletions
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; + |