summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-03 18:37:51 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-03 18:37:51 +0000
commit001b41625e461404288c2e3ec7821992c06233ef (patch)
tree80052d3b071688cb86ce016a217241fea6e5254f /c/src/lib/libbsp
parent2008-09-03 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-001b41625e461404288c2e3ec7821992c06233ef.tar.bz2
2008-09-03 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Rework psim scripts to share code for creating device trees and actually running the tests. Overhaul the device tree generated to always include a block of Flash and a Real-Time Clock. When running MP tests enable the shared memory and semaphore devices. * psim-bottom, psim-gdb-bottom, psim-gdb-top.in, psim-shared, psim-top.in, runtest-bottom, runtest-top.in: New files. * psim, psim-gdb, runtest: Removed.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/powerpc/psim/tools/ChangeLog11
-rw-r--r--c/src/lib/libbsp/powerpc/psim/tools/Makefile.am16
-rw-r--r--c/src/lib/libbsp/powerpc/psim/tools/configure.ac10
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim121
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-bottom35
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-gdb42
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom24
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-gdb-top.in18
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-shared98
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/psim-top.in41
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/runtest289
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/runtest-bottom125
-rwxr-xr-xc/src/lib/libbsp/powerpc/psim/tools/runtest-top.in104
13 files changed, 478 insertions, 456 deletions
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog
index 908aa6d153..3d30b11e0d 100644
--- a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-03 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac: Rework psim scripts to share code for
+ creating device trees and actually running the tests. Overhaul the
+ device tree generated to always include a block of Flash and a
+ Real-Time Clock. When running MP tests enable the shared memory and
+ semaphore devices.
+ * psim-bottom, psim-gdb-bottom, psim-gdb-top.in, psim-shared,
+ psim-top.in, runtest-bottom, runtest-top.in: New files.
+ * psim, psim-gdb, runtest: Removed.
+
2008-08-05 Joel Sherrill <joel.sherrill@OARcorp.com>
* runtest: Strip .exe or .ralf from file names.
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/Makefile.am b/c/src/lib/libbsp/powerpc/psim/tools/Makefile.am
index eb2167ceed..dc08efff1a 100644
--- a/c/src/lib/libbsp/powerpc/psim/tools/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/psim/tools/Makefile.am
@@ -9,7 +9,7 @@ bsptools_bindir = ${exec_prefix}/@RTEMS_BSP@/tests
bsptools_bin_SCRIPTS = psim psim-gdb runtest
## HACK: install to build-tree
-all-local: $(TMPINSTALL_FILES)
+all-local: psim $(TMPINSTALL_FILES)
TMPINSTALL_FILES =
@@ -18,6 +18,18 @@ $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp):
@: > $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
+psim: psim-top psim-shared psim-bottom
+ cat $^ >$@
+ chmod +x $@
+
+psim-gdb: psim-gdb-top psim-shared psim-gdb-bottom
+ cat $^ >$@
+ chmod +x $@
+
+runtest: runtest-top psim-shared runtest-bottom
+ cat $^ >$@
+ chmod +x $@
+
$(PROJECT_ROOT)/@RTEMS_BSP@/tests/psim: psim $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
$(INSTALL_SCRIPT) $< $(PROJECT_ROOT)/@RTEMS_BSP@/tests/psim
TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/psim
@@ -30,6 +42,6 @@ $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest: runtest $(PROJECT_ROOT)/@RTEMS_BSP@/t
$(INSTALL_SCRIPT) $< $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
-CLEANFILES = $(TMPINSTALL_FILES)
+CLEANFILES = $(TMPINSTALL_FILES) psim psim-gdb
include $(top_srcdir)/../../../../../automake/host.am
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/configure.ac b/c/src/lib/libbsp/powerpc/psim/tools/configure.ac
index bb8f84aef4..98827f85dd 100644
--- a/c/src/lib/libbsp/powerpc/psim/tools/configure.ac
+++ b/c/src/lib/libbsp/powerpc/psim/tools/configure.ac
@@ -4,7 +4,7 @@
AC_PREREQ(2.60)
AC_INIT([rtems-c-src-lib-libbsp-powerpc-psim-tools],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
-AC_CONFIG_SRCDIR([psim])
+AC_CONFIG_SRCDIR([psim-top.in])
RTEMS_TOP(../../../../../../..)
RTEMS_CANONICAL_TARGET_CPU
@@ -13,9 +13,15 @@ AM_INIT_AUTOMAKE([no-define foreign 1.10])
AM_MAINTAINER_MODE
RTEMS_ENV_RTEMSBSP
+RTEMS_PATH_KSH
+
RTEMS_PROJECT_ROOT
RTEMS_TOOLPATHS
# Explicitly list all Makefiles here
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile
+psim-top
+psim-gdb-top
+runtest-top
+])
AC_OUTPUT
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim b/c/src/lib/libbsp/powerpc/psim/tools/psim
deleted file mode 100755
index faa8a2e8b9..0000000000
--- a/c/src/lib/libbsp/powerpc/psim/tools/psim
+++ /dev/null
@@ -1,121 +0,0 @@
-#! /bin/sh
-#
-# Shell script to ease invocation of the powerpc simulator
-#
-# COPYRIGHT (c) 1989-2006.
-# On-Line Applications Research Corporation (OAR).
-#
-# The license and distribution terms for this file may be
-# found in found in the file LICENSE in this distribution or at
-# http://www.rtems.com/license/LICENSE.
-#
-# $Id$
-#
-
-TREE_FILE=psim_tree.${LOGNAME}
-RUN=powerpc-rtems4.8-run
-
-
-progname=${0##*/} # fast basename hack for ksh, bash
-
-USAGE=\
-"usage: $progname [ -opts ] test [ test ... ]
- -v -- verbose
- -l limit -- specify time limit (default is 'no limit')
-"
-
-# log an error to stderr
-prerr()
-{
- echo "$*" >&2
-}
-
-fatal() {
- [ "$1" ] && prerr $*
- prerr "$USAGE"
- exit 1
-}
-
-warn() {
- [ "$1" ] && prerr $*
-}
-
-#
-# process the options
-#
-# defaults for getopt vars
-#
-
-verbose=""
-limit="0"
-
-while getopts vl: OPT
-do
- case "$OPT" in
- v)
- verbose="yes";;
- l)
- limit="$OPTARG";;
- *)
- fatal;;
- esac
-done
-shiftcount=`expr $OPTIND - 1`
-shift $shiftcount
-
-args=$*
-
-# RUN_DEBUG="-t sem_device"
-
-# Build this user's device tree file
-echo "/#address-cells 2" > ${TREE_FILE}
-echo "/openprom/init/register/pvr 0xfffe0000" >> ${TREE_FILE}
-echo "/openprom/options/oea-memory-size 8388608" >> ${TREE_FILE}
-
-# These require the semaphore and shared memory device models.
-# echo "/shm@0xc0000000/reg 0xc0000000 0x10000" >> ${TREE_FILE}
-# echo "/shm@0xc0000000/key ${RTEMS_SHM_KEY}" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/reg 0xc0010000 12" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/key ${RTEMS_SHM_SEMAPHORE_KEY}" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/value -1" >> ${TREE_FILE}
-
-runtest()
-{
- testname=${1}
- max_run_time=${2}
- if [ ${max_run_time} -eq 0 ] ; then
- #echo run ${testname} forever
- ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname}
- else
- #echo run ${testname} for maximum ${max_run_time} seconds
- ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname} &
- pid=$!
-
- # Make sure it won't run forever...
- time_run=0
- while [ $time_run -lt $max_run_time ]
- do
- # sleep 5s at a time waiting for job to finish or timer to expire
- # if job has exited, then we exit, too.
- sleep 1
- kill -0 $pid 2> /dev/null
- running=$?
- if [ $running -eq 0 ] ; then
- time_run=$((time_run + 5))
- if [ $time_run -ge $max_run_time ]; then
- kill -9 $pid 2> /dev/null
- ran_too_long="yes"
- echo "${testname} killed after running ${max_run_time} seconds"
- fi
- else
- ran_too_long="no"
- break
- fi
- done
- fi
-}
-
-runtest ${1} ${limit}
-rm -f ${TREE_FILE}
-exit $?
-
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom b/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom
new file mode 100755
index 0000000000..93987cca53
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom
@@ -0,0 +1,35 @@
+#
+# process the options
+#
+# defaults for getopt vars
+#
+
+verbose=""
+limit="0"
+
+## TODO: may want command line ability to turn on some psim tracing
+while getopts vl: OPT
+do
+ case "$OPT" in
+ v)
+ verbose="yes";;
+ l)
+ limit="$OPTARG";;
+ *)
+ fatal;;
+ esac
+done
+shiftcount=`expr $OPTIND - 1`
+shift $shiftcount
+
+args=$*
+
+if [ $# -eq 0 ] ; then
+ fatal
+fi
+
+gen_device_tree ${1} >${TREE_FILE}
+runone ${1} ${limit}
+rm -f ${TREE_FILE}
+exit $?
+
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb
deleted file mode 100755
index e697ad9420..0000000000
--- a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb
+++ /dev/null
@@ -1,42 +0,0 @@
-#! /bin/sh
-#
-# Shell script to ease invocation of the powerpc simulator
-#
-# COPYRIGHT (c) 1989-2006.
-# On-Line Applications Research Corporation (OAR).
-#
-# The license and distribution terms for this file may be
-# found in found in the file LICENSE in this distribution or at
-# http://www.rtems.com/license/LICENSE.
-#
-# $Id$
-#
-
-TREE_FILE=psim_tree.${LOGNAME}
-GDB_FILE=gdb_tree.${LOGNAME}
-
-# Build this user's device tree file
-echo "/#address-cells 2" > ${TREE_FILE}
-echo "/openprom/init/register/pvr 0xfffe0000" >> ${TREE_FILE}
-echo "/openprom/options/oea-memory-size 8388608" >> ${TREE_FILE}
-
-# These require the semaphore and shared memory device models.
-# echo "/shm@0xc0000000/reg 0xc0000000 0x10000" >> ${TREE_FILE}
-# echo "/shm@0xc0000000/key ${RTEMS_SHM_KEY}" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/reg 0xc0010000 12" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/key ${RTEMS_SHM_SEMAPHORE_KEY}" >> ${TREE_FILE}
-# echo "/sem@0xc0010000/value -1" >> ${TREE_FILE}
-#
-# Build this user's gdb script
-echo "tar sim -f ${TREE_FILE} ${GDB_DEBUG}" > ${GDB_FILE}
-echo "load" >> ${GDB_FILE}
-echo "b _Internal_error_Occurred" >> ${GDB_FILE}
-echo "b rtems_fatal_error_occurred" >> ${GDB_FILE}
-echo "b __assert" >> ${GDB_FILE}
-
-GDB=powerpc-rtems4.9-gdb
-
-${GDB} -x ${GDB_FILE} $*
-
-exit $?
-
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom
new file mode 100755
index 0000000000..672c02dc28
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom
@@ -0,0 +1,24 @@
+
+## TODO: may want command line ability to turn on some psim tracing
+
+## Generate the GDB Command Script
+gen_gdb_script()
+{
+ echo "tar sim -f ${TREE_FILE}"
+ echo "load"
+ echo "b _Internal_error_Occurred"
+ echo "b rtems_fatal_error_occurred"
+ echo "b __assert"
+ echo "printf \"Use run to start the RTEMS application\\n\""
+}
+
+GDB=powerpc-rtems4.9-gdb
+
+gen_device_tree ${1} >${TREE_FILE}
+gen_gdb_script >${GDB_FILE}
+
+${GDB} -x ${GDB_FILE} $*
+
+rm -f ${GDB_FILE} ${TREEFILE}
+exit $?
+
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-top.in b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-top.in
new file mode 100755
index 0000000000..55038a1860
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-top.in
@@ -0,0 +1,18 @@
+#! @KSH@ -p
+#
+# Shell script to ease invocation of the powerpc simulator with gdb
+#
+# COPYRIGHT (c) 1989-2008.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+# $Id$
+#
+
+GDB=@target_alias@-gdb
+
+GDB_FILE=gdb_tree.${LOGNAME}
+
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-shared b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared
new file mode 100755
index 0000000000..0232f30f49
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared
@@ -0,0 +1,98 @@
+
+TREE_FILE=psim_tree.${LOGNAME}
+
+### Generate the PSIM device tree based upon the type of application being run
+gen_device_tree()
+{
+ case ${1} in
+ *mp*)
+ if [ X${RTEMS_SHM_SEMAPHORE_KEY} = X -o X${RTEMS_SHM_KEY} = X ] ; then
+ fatal RTEMS_SHM_SEMAPHORE_KEY and/or RTEMS_SHM_KEY not set
+ fi
+
+ use_sysv_devices=yes
+ case ${1} in
+ *node1*) value=1 ;;
+ *) value=-1 ;;
+ esac
+ ;;
+ *)
+ use_sysv_devices=no
+ ;;
+ esac
+
+cat <<EOF
+#
+# Device Tree for PSIM
+#
+# Automatically Generated -- DO NOT EDIT!!
+#
+/#address-cells 1
+/openprom/init/register/pvr 0xfffe0000
+/openprom/options/oea-memory-size 8388608
+##### EEPROM @ 0x0c000000 for 512K
+/eeprom@0x0c000000/reg 0x0c000000 0x80000
+/eeprom@0x0c000000/nr-sectors 8
+/eeprom@0x0c000000/sector-size 0x10000
+/eeprom@0x0c000000/byte-write-delay 1000
+/eeprom@0x0c000000/sector-start-delay 100
+/eeprom@0x0c000000/erase-delay 1000
+/eeprom@0x0c000000/manufacture-code 0x01
+/eeprom@0x0c000000/device-code 0xa4
+
+##### NVRAM/RTC NVRAM Portion is 0x0c080000 for 512K
+##### NVRAM/RTC RTC Portion is 0x0c100000 for 12
+/nvram@0x0c080000/reg 0x0c080000 524300
+/nvram@0x0c080000/timezone -3600
+EOF
+
+ if [ ${use_sysv_devices} = yes ] ; then
+ echo "##### System V IPC (Semaphore) 0x0c100010 for 12"
+ echo "/sem@0x0c100010/reg 0x0c100010 12"
+ echo "/sem@0x0c100010/key ${RTEMS_SHM_SEMAPHORE_KEY}"
+ echo "/sem@0x0c100010/value ${value}"
+ $@
+ echo "##### System V IPC (Shared Memory) 0x0c110000 for 128K"
+ echo "/shm@0x0c110000/reg 0x0c110000 0x20000"
+ echo "/shm@0x0c110000/key ${RTEMS_SHM_KEY}"
+ fi
+
+}
+
+### run the specified test with the time limit
+runone()
+{
+ testname=${1}
+ max_run_time=${2}
+ if [ ${max_run_time} -eq 0 ] ; then
+ #echo run ${testname} forever
+ ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname}
+ else
+ #echo run ${testname} for maximum ${max_run_time} seconds
+ ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname} &
+ pid=$!
+
+ # Make sure it won't run forever...
+ time_run=0
+ while [ $time_run -lt $max_run_time ]
+ do
+ # sleep 5s at a time waiting for job to finish or timer to expire
+ # if job has exited, then we exit, too.
+ sleep 1
+ kill -0 $pid 2> /dev/null
+ running=$?
+ if [ $running -eq 0 ] ; then
+ time_run=$((time_run + 5))
+ if [ $time_run -ge $max_run_time ]; then
+ kill -9 $pid 2> /dev/null
+ ran_too_long="yes"
+ echo "${testname} killed after running ${max_run_time} seconds"
+ fi
+ else
+ ran_too_long="no"
+ break
+ fi
+ done
+ fi
+}
+
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in b/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in
new file mode 100755
index 0000000000..f6d2cced6b
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in
@@ -0,0 +1,41 @@
+#! @KSH@ -p
+#
+# Shell script to ease invocation of the powerpc simulator
+#
+# COPYRIGHT (c) 1989-2008.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+# $Id$
+#
+
+TREE_FILE=psim_tree.${LOGNAME}
+RUN=@target_alias@-run
+
+
+progname=${0##*/} # fast basename hack for ksh, bash
+
+USAGE=\
+"usage: $progname [ -opts ] test [ test ... ]
+ -v -- verbose
+ -l limit -- specify time limit (default is 'no limit')
+"
+
+# log an error to stderr
+prerr()
+{
+ echo "$*" >&2
+}
+
+fatal() {
+ [ "$1" ] && prerr $*
+ prerr "$USAGE"
+ exit 1
+}
+
+warn() {
+ [ "$1" ] && prerr $*
+}
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/runtest b/c/src/lib/libbsp/powerpc/psim/tools/runtest
deleted file mode 100755
index f4a952b86a..0000000000
--- a/c/src/lib/libbsp/powerpc/psim/tools/runtest
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/bin/sh -p
-#
-# Run rtems tests on the powerpc simulator
-# This program generates a simulator script to run each test
-# Typically the test is then run, although it can be generated
-# and left as a file using -s
-#
-# COPYRIGHT (c) 1989-1999.
-# On-Line Applications Research Corporation (OAR).
-#
-# The license and distribution terms for this file may be
-# found in found in the file LICENSE in this distribution or at
-# http://www.rtems.com/license/LICENSE.
-#
-# $Id$
-#
-
-# progname=`basename $0`
-progname=${0##*/} # fast basename hack for ksh, bash
-
-USAGE=\
-"usage: $progname [ -opts ] test [ test ... ]
- -o options -- specify options to be passed to simulator
- -v -- verbose
- -d -- generate device tree file (as 'test'.device) and exit
- -l logdir -- specify log directory (default is 'logdir')
-
- Specify test as 'test' or 'test.exe'.
- All multiprocessing tests *must* be specified simply as 'mp01', etc.
-"
-
-# export everything
-set -a
-
-# log an error to stderr
-prerr()
-{
- echo "$*" >&2
-}
-
-fatal() {
- [ "$1" ] && prerr $*
- prerr "$USAGE"
- exit 1
-}
-
-warn() {
- [ "$1" ] && prerr $*
-}
-
-# print args, 1 per line
-ml_echo()
-{
- for l
- do
- echo "$l"
- done
-}
-
-# run at normal and signalled exit
-test_exit()
-{
- exit_code=$1
-
- rm -f ${logfile}.tmp*
- [ "$sim_pid" ] && kill -9 $sim_pid
-
- exit $exit_code
-}
-
-#
-# process the options
-#
-# defaults for getopt vars
-#
-# max_run_time is defaulted to 5 minutes
-#
-
-verbose=""
-extra_options=""
-device_and_exit=""
-stdio_setup="yes"
-run_to_completion="yes"
-logdir=log
-update_on_tick="no"
-max_run_time=$((5 * 60))
-using_print_buffer="yes"
-#simulator=/usr1/rtems/work/ada/4.00/ppc_src/b-gdb/sim/ppc/run
-simulator=powerpc-rtems4.9-run
-instruction_limit=1000000000
-sizeof_ram=8388608
-
-while getopts vdl:o:s: OPT
-do
- case "$OPT" in
- v)
- verbose="yes";;
- d)
- device_and_exit="yes"
- run_to_completion="no"
- stdio_setup="no";;
- l)
- logdir="$OPTARG";;
- o)
- extra_options="$OPTARG";;
- r)
- sizeof_ram="$OPTARG";;
- s)
- simulator="$OPTARG";;
- *)
- fatal;;
- esac
-done
-
-let $((shiftcount = $OPTIND - 1))
-shift $shiftcount
-
-args=$*
-
-#
-# Check some parameters
-#
-
-# JRS CHANGE
-# if [ ! -x ${simulator} ] ; then
-# fatal "${simulator} is not executable"
-# fi;
-
-#
-# Run the tests
-#
-
-tests="$args"
-if [ ! "$tests" ]
-then
- set -- `echo *.exe`
- tests="$*"
-fi
-
-[ -d $logdir ] ||
- mkdir $logdir || fatal "could not create log directory ($logdir)"
-
-# where the tmp files go
-trap "test_exit" 1 2 3 13 14 15
-
-for tfile in $tests
-do
-
- tname=`basename $tfile .exe`
- tname=`basename $tname .ralf`
- cpus="1"
- TEST_TYPE="single"
-
- case $tname in
- # size is no longer interactive.
- capture* | monitor* | termios* | fileio* | pppd*)
- if [ $run_to_completion = "yes" ]
- then
- warn "Skipping $tname; it is interactive"
- continue
- fi
- ;;
- *-node2*)
- warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
- continue;;
- *-node1*)
- warn "Running both nodes associated with $tname"
- variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'`
- tname=`echo $tname | sed 's/-node.*//'`
- TEST_TYPE="mp"
- ;;
- minimum*|stackchk*|*fatal*|termio*)
- continue ;;
- esac
-
- if [ $TEST_TYPE = "mp" ]
- then
- cpus="1 2"
-
- logfile1=$logdir/${tname}_1${variant}
- logfile2=$logdir/${tname}_2${variant}
- infofile1=$logfile1.info
- infofile2=$logfile2.info
-
- rm -f ${logfile1} ${logfile2}
-
- date=`date`
- echo "Starting $tname at $date"
-
- ${simulator} $extra_options -c ${instruction_limit} \
- -o "/#address-cells 2" \
- -o "/openprom/options/oea-memory-size ${sizeof_ram}" \
- -o "/openprom/init/register/pvr 0xfffe0000" \
- -o "/shm@0xc0000000/reg 0xc0000000 0x10000" \
- -o "/shm@0xc0000000/key 0x1234" \
- -o "/sem@0xc0010000/reg 0xc0010000 12" \
- -o "/sem@0xc0010000/key 0x1234" \
- -o "/sem@0xc0010000/value 1" ${tname}-node1${variant}.exe | \
- sed -e 's/ //' -e '/^$/d' > ${logfile1} &
-
- ${simulator} $extra_options -c ${instruction_limit} \
- -o "/#address-cells 2" \
- -o "/openprom/options/oea-memory-size ${sizeof_ram}" \
- -o "/openprom/init/register/pvr 0xfffe0000" \
- -o "/shm@0xc0000000/reg 0xc0000000 0x10000" \
- -o "/shm@0xc0000000/key 0x1234" \
- -o "/sem@0xc0010000/reg 0xc0010000 12" \
- -o "/sem@0xc0010000/key 0x1234" \
- -o "/sem@0xc0010000/value -1" ${tname}-node2${variant}.exe | \
- sed -e 's/ //' -e '/^$/d' > ${logfile2} &
-
- wait
-
- fi
-
- if [ $TEST_TYPE = "single" ]
- then
- logfile=$logdir/${tname}_1
- infofile=$logfile.info
-
- rm -f ${logfile}.tmp*
-
- date=`date`
- echo "Starting $tname at $date"
-
- # Generate a device file to get the work done.
- # The device file must do the following:
- #
- # arrange for more memory (2 Mb)
-
- if [ "$device_and_exit" = "yes" ]
- then
- fatal "Cannot currently generate device files"
- fi
-
- # Spin off the simulator in the background
- # -c sets an instruction limit
-
- # Don't need to make sure it won't run forever... since there is
- # an instruction count limit
-
- #powerpc-rtems-run $extra_options -c ${instruction_limit} \
- # -f ${devicefile} $tfile | sed -e 's/ //' -e '/^$/d' > ${logfile}
-
- ${simulator} $extra_options -c ${instruction_limit} \
- -o "/#address-cells 2" \
- -o "/openprom/options/oea-memory-size ${sizeof_ram}" \
- -o "/openprom/init/register/pvr 0xfffe0000" \
- $tfile | sed -e 's/ //' -e '/^$/d' > ${logfile}
- fi
-
- # Create the info files
- for cpu in $cpus
- do
- {
- echo "$date"
- echo "Test run on: `uname -n`"
- echo "Host Information:"
- echo `uname -a`
- echo
-
- #sed -e 's/ //' < ${logdir}/${tname}_${cpu}
- cat ${logdir}/${tname}_${cpu}
-
- if [ "$ran_too_long" = "yes" ]
- then
- echo "Test did NOT finish normally; killed after $max_run_time seconds"
- fi
-
- echo
- date;
- } > ${logdir}/${tname}_${cpu}.info
- done
-
- if [ "$cpus" = "1" ]
- then
- mv ${infofile} $logdir/${tname}.info
- mv ${logfile} $logdir/${tname}
- fi
-
-done
-
-echo "Tests completed at " `date`
-test_exit 0
-
-# Local Variables: ***
-# mode:ksh ***
-# End: ***
-
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/runtest-bottom b/c/src/lib/libbsp/powerpc/psim/tools/runtest-bottom
new file mode 100755
index 0000000000..990d879bb3
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/runtest-bottom
@@ -0,0 +1,125 @@
+#
+# Run the tests
+#
+
+tests="$args"
+if [ ! "$tests" ]
+then
+ set -- `echo *.exe`
+ tests="$*"
+fi
+
+[ -d $logdir ] ||
+ mkdir $logdir || fatal "could not create log directory ($logdir)"
+
+# where the tmp files go
+trap "test_exit" 1 2 3 13 14 15
+
+for tfile in $tests
+do
+ echo $tfile | grep "exe$" >/dev/null
+ if [ $? -eq 0 ] ; then
+ ext=.exe
+ else
+ ext=.ralf
+ fi
+ tname=`basename $tfile ${ext}`
+ cpus="1"
+ TEST_TYPE="single"
+
+ case $tname in
+ # size is no longer interactive.
+ capture* | monitor* | termios* | fileio* | pppd*)
+ warn "Skipping $tname; it is interactive"
+ continue
+ ;;
+ *-node2*)
+ warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
+ continue;;
+ *-node1*)
+ warn "Running both nodes associated with $tname"
+ variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'`
+ tname=`echo $tname | sed 's/-node.*//'`
+ TEST_TYPE="mp"
+ ;;
+ minimum*|stackchk*|*fatal*|termio*)
+ continue ;;
+ esac
+
+ if [ $TEST_TYPE = "mp" ]
+ then
+ cpus="1 2"
+
+ logfile1=$logdir/${tname}_1${variant}
+ logfile2=$logdir/${tname}_2${variant}
+ infofile1=$logfile1.info
+ infofile2=$logfile2.info
+
+ rm -f ${logfile1} ${logfile2}
+
+ date=`date`
+ echo "Starting $tname at $date"
+
+ # XXX -c ${instruction_limit}
+
+ runone ${tname}-node1${variant}.${ext} ${max_run_time} | \
+ sed -e 's/^M//' -e '/^$/d' > ${logfile1} &
+ runone ${tname}-node2${variant}.${ext} ${max_run_time} | \
+ sed -e 's/^M//' -e '/^$/d' > ${logfile2} &
+ wait
+
+ fi
+
+ if [ $TEST_TYPE = "single" ]
+ then
+ logfile=$logdir/${tname}_1
+ infofile=$logfile.info
+
+ rm -f ${logfile}.tmp*
+
+ date=`date`
+ echo "Starting $tname at $date"
+
+ # Spin off the simulator in the background
+ # -c could be used to set an instruction limit
+ runone ${tfile} ${max_run_time} | \
+ sed -e 's/^M//' -e '/^$/d' > ${logfile}
+ fi
+
+ # Create the info files
+ for cpu in $cpus
+ do
+ {
+ echo "$date"
+ echo "Test run on: `uname -n`"
+ echo "Host Information:"
+ echo `uname -a`
+ echo
+
+ cat ${logdir}/${tname}_${cpu}
+
+ if [ "$ran_too_long" = "yes" ]
+ then
+ echo "Test did NOT finish normally; killed after $max_run_time seconds"
+ fi
+
+ echo
+ date;
+ } > ${logdir}/${tname}_${cpu}.info
+ done
+
+ if [ "$cpus" = "1" ]
+ then
+ mv ${infofile} $logdir/${tname}.info
+ mv ${logfile} $logdir/${tname}
+ fi
+
+done
+
+echo "Tests completed at " `date`
+test_exit 0
+
+# Local Variables: ***
+# mode:ksh ***
+# End: ***
+
diff --git a/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in b/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in
new file mode 100755
index 0000000000..436fc0a9d3
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in
@@ -0,0 +1,104 @@
+#!@KSH@ -p
+#
+# Run rtems tests on the powerpc simulator
+# This program generates a simulator script to run each test
+# Typically the test is then run, although it can be generated
+# and left as a file using -s
+#
+# COPYRIGHT (c) 1989-2008.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+# $Id$
+#
+
+# progname=`basename $0`
+progname=${0##*/} # fast basename hack for ksh, bash
+RUN=@target_alias@-run
+
+USAGE=\
+"usage: $progname [ -opts ] test [ test ... ]
+ -o options -- specify options to be passed to simulator
+ -v -- verbose
+ -d -- generate device tree file (as 'test'.device) and exit
+ -l logdir -- specify log directory (default is 'logdir')
+
+ Specify test as 'test' or 'test.exe'.
+ All multiprocessing tests *must* be specified simply as 'mp01', etc.
+"
+
+# export everything
+set -a
+
+# log an error to stderr
+prerr()
+{
+ echo "$*" >&2
+}
+
+fatal() {
+ [ "$1" ] && prerr $*
+ prerr "$USAGE"
+ exit 1
+}
+
+warn() {
+ [ "$1" ] && prerr $*
+}
+
+# print args, 1 per line
+ml_echo()
+{
+ for l
+ do
+ echo "$l"
+ done
+}
+
+# run at normal and signalled exit
+test_exit()
+{
+ exit_code=$1
+
+ rm -f ${logfile}.tmp*
+ [ "$sim_pid" ] && kill -9 $sim_pid
+
+ exit $exit_code
+}
+
+#
+# process the options
+#
+# defaults for getopt vars
+#
+# max_run_time is defaulted to 5 minutes
+#
+
+verbose=""
+logdir=log
+update_on_tick="no"
+max_run_time=$((5 * 60))
+instruction_limit=1000000000
+
+while getopts vl: OPT
+do
+ case "$OPT" in
+ v) verbose="yes";;
+ l) logdir="$OPTARG";;
+ *) fatal;;
+ esac
+done
+
+let $((shiftcount = $OPTIND - 1))
+shift $shiftcount
+
+args=$*
+
+#
+# Check some parameters
+#
+
+# XXX nothing to check so far