summaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/ada')
-rw-r--r--gcc/testsuite/ada/acats/Makefile.rtems83
-rw-r--r--gcc/testsuite/ada/acats/rtems_acats_reasons78
-rwxr-xr-xgcc/testsuite/ada/acats/rtems_acats_status52
-rwxr-xr-xgcc/testsuite/ada/acats/rtems_generate_acats_email121
-rw-r--r--gcc/testsuite/ada/acats/rtems_init.c121
-rwxr-xr-xgcc/testsuite/ada/acats/run_all_rtems.sh405
6 files changed, 860 insertions, 0 deletions
diff --git a/gcc/testsuite/ada/acats/Makefile.rtems b/gcc/testsuite/ada/acats/Makefile.rtems
new file mode 100644
index 0000000..48a2005
--- /dev/null
+++ b/gcc/testsuite/ada/acats/Makefile.rtems
@@ -0,0 +1,83 @@
+#
+# Makefile for ACATS -- Helps pull BSP specific information
+# into a form the script can use
+#
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# Tool helpers
+rtemsdir=${RTEMS_MAKEFILE_PATH}
+GNATMAKE=$(AS:as=gnatmake)
+GNATCHOP=$(AS:as=gnatchop)
+CARGS = -B${rtemsdir}/lib/ -specs bsp_specs -qrtems
+CARGS += $(CPU_CFLAGS) $(LDFLAGS) $(AM_LDFLAGS)
+
+all: RTEMS_SETTINGS rtems_init.o
+
+rtems_init.o: ${ADASCRIPTDIR}/rtems_init.c
+ $(CC) $(CFLAGS) -c ${ADASCRIPTDIR}/rtems_init.c
+
+RTEMS_SETTINGS: stamp-targetrun stamp-targetgcc \
+ stamp-targetchop stamp-targetmake
+ cat $? >RTEMS_SETTINGS
+
+stamp-targetrun:
+ echo "target_run() {" >$@
+ ifeq ($(RTEMS_BSP),pc386)
+ echo " runqemu -l 60 -c $$"'*' >> $@
+ endif # pc386
+ ifeq ($(RTEMS_BSP),jmr3904)
+ echo " jmr3904-4.10 -l 240 $$"'*' >> $@
+ endif # jmr3904
+ ifeq ($(RTEMS_BSP),psim)
+ echo " psim-4.10 -l 180 $$"'*' >> $@
+ endif # psim
+ ifeq ($(RTEMS_BSP),erc32)
+ echo " runerc32 -c $$"'*' >> $@
+ endif # erc32
+ ifeq ($(RTEMS_BSP),sis)
+ echo " sis-4.10 -l 180 $$"'*' >> $@
+ endif # sis
+ ifeq ($(RTEMS_BSP),edb7312)
+ echo " edb7312 -l 180 $$"'*' >> $@
+ endif # edb7312
+ ifeq ($(RTEMS_BSP),simsh1)
+ echo " simsh1-4.10 -l 60 $$"'*' >> $@
+ endif # simsh1
+ ifeq ($(RTEMS_BSP),h8sim)
+ echo " h8sim-4.10 -l 60 $$"'*' >> $@
+ endif # h8sim
+ ifeq ($(RTEMS_BSP),mcf5206elite)
+ echo " nosim $$"'*' >> $@
+ endif # mcf5206elite
+ ifeq ($(RTEMS_BSP),eZKit533)
+ echo " nosim $$"'*' >> $@
+ endif # mcf5206elite
+ echo "}" >>$@
+
+stamp-targetgcc:
+ echo "target_gcc() {" >$@
+ echo " $(CC) $$"'*' >> $@
+ echo "}" >>$@
+
+stamp-targetchop:
+ echo "target_gnatchop() {" >$@
+ echo " $(GNATCHOP) $$"'*' >> $@
+ echo "}" >>$@
+
+stamp-targetmake:
+ echo "target_gnatmake() {" >$@
+ echo "set -x" >>$@
+ echo ' $(GNATMAKE) -fstack-check -v -O $$gnatflags $$gccflags $$* -bargs -Mgnat_main -largs $(CARGS) '$(shell pwd)/rtems_init.o' $$EXTERNAL_OBJECTS' >> $@
+ echo "}" >>$@
+
+# $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
+# -bargs -Mgnat_main \
+# -largs $(CARGS) rtems_init.o
+# $(SIZE) $(MAIN)
+
+clean:
+ rm -f b~$(MAIN).* *.o *.ali $(MAIN) stamp-*
diff --git a/gcc/testsuite/ada/acats/rtems_acats_reasons b/gcc/testsuite/ada/acats/rtems_acats_reasons
new file mode 100644
index 0000000..1e4d369
--- /dev/null
+++ b/gcc/testsuite/ada/acats/rtems_acats_reasons
@@ -0,0 +1,78 @@
+# ACATS Tests which are near constant
+all:ce2108f: simulator does not have persistent files
+all:ce2108h: simulator does not have persistent files
+all:ce3112d: simulator does not have persistent files
+
+# GCC Ada PRs:
+PR:37094: in copyprop_hardreg_forward_1, at regrename.c:1589
+
+# Last updated: 30 July 2008
+sis:cxg2005: FP exception - SIS simulator is not accurate enough
+sis:cxg2012: FP exception - SIS simulator is not accurate enough
+sis:cxg2014: FP exception - SIS simulator is not accurate enough
+sis:cxg2017: FP exception - SIS simulator is not accurate enough
+sis:cxg2020: FP exception - SIS simulator is not accurate enough
+sis:c37213j: address exception
+sis:c37213k: alignment exception
+sis:c47007a: alignment exception
+sis:c47009a: alignment exception
+sis:c953002: ran too long, may eventually finish
+
+# Last updated: 30 July 2008
+pc386:a71004a: ran too long, no output
+pc386:c64005c: WRONG ITERATIVE TRACE LENGTH.
+pc386:c64005d: WRONG I:RATIVE TRACE LENGTH.
+pc386:c95065c: ran too long, no output
+pc386:c95085m: ran too long, no output
+pc386:c953002: ran too long, some output
+pc386:cc3305a: ran too long, no output
+pc386:cxg2002: FPU precision issue on qemu
+pc386:cxg2003: FPU precision issue on qemu
+pc386:cxg2004: FPU precision issue on qemu
+pc386:cxg2006: FPU precision issue on qemu
+pc386:cxg2007: FPU precision issue on qemu
+pc386:cxg2010: FPU precision issue on qemu
+pc386:cxg2011: FPU precision issue on qemu
+pc386:cxg2012: FPU precision issue on qemu
+pc386:cxg2013: FPU precision issue on qemu
+pc386:cxg2014: ran too long, some output
+pc386:cxg2015: FPU precision issue on qemu
+pc386:cxg2016: FPU precision issue on qemu
+pc386:cxg2017: FPU precision issue on qemu
+pc386:cxg2018: FPU precision issue on qemu
+pc386:cxg2019: FPU precision issue on qemu
+pc386:cxg2020: FPU precision issue on qemu
+pc386:cxg2021: FPU precision issue on qemu
+
+# Last updated: 30 July 2008
+jmr3904:c380004: read from bad address
+jmr3904:c64005c: WRONG ITERATIVE TRACE LENGTH.
+jmr3904:c64005d: WRONG ITERATIVE TRACE LENGTH.
+jmr3904:ca11012: Incorrect results from complex operation. Exception not raised in child package.
+jmr3904:cdd2a02: CONSTRAINT_ERROR range check failed
+jmr3904:cxf3a01: read from bad address
+jmr3904:cxf3a02: read from bad address
+
+# Last updated: 30 July 2008
+psim:c41328a: INCORRECT RESULTS FROM DERIVED SUBPROGRAM - 3.
+psim:c64005c: WRONG ITERATIVE TRACE LENGTH.
+psim:c64005d: WRONG ITERATIVE TRACE LENGTH.
+
+# Last updated: 25 September 2008
+simsh1:a22006c: Memory exception at ffc2b4bc (illegal address)
+simsh1:c380004: Memory exception at 44000 (illegal address)
+simsh1:c45532m: raised CONSTRAINT_ERROR : c45532m.adb:143 range check failed
+simsh1:c45532o: raised CONSTRAINT_ERROR : c45532o.adb:147 range check failed
+simsh1:c45532p: raised CONSTRAINT_ERROR : c45532p.adb:141 range check failed
+simsh1:c953002: Memory exception at 44000 (illegal address)
+simsh1:c974013: Memory exception at 44000 (illegal address)
+simsh1:cd1c04e: explicit fail THE VALUES OF DERIVED_TYPE COMPONENTS WERE INCORRECT.
+simsh1:cxa4009: explicit fail Incorrect results
+simsh1:cxa4020: explicit fail Incorrect results
+simsh1:cxg2018: Memory exception at 44000 (illegal address)
+simsh1:cxg2019: Memory exception at 44000 (illegal address)
+simsh1:cxg2021: Memory exception at 44000 (illegal address)
+
+
+
+
diff --git a/gcc/testsuite/ada/acats/rtems_acats_status b/gcc/testsuite/ada/acats/rtems_acats_status
new file mode 100755
index 0000000..0dfb2da
--- /dev/null
+++ b/gcc/testsuite/ada/acats/rtems_acats_status
@@ -0,0 +1,52 @@
+#! /bin/sh
+#
+# Report ACATS status summary
+#
+# $Id$
+#
+
+if [ $# -ne 2 -a $# -ne 3 ] ; then
+ echo Usage $0: CPU BSP [seconds]
+ exit 1
+fi
+
+vfile=`dirname $0`/../../../../VERSIONS
+if [ ! -r ${vfile} ] ; then
+ echo VERSIONS file not found
+ exit 1
+fi
+
+source ${vfile}
+
+CPU=$1
+BSP=$2
+if [ $# -eq 3 ] ; then
+ seconds=$3
+else
+ seconds=0
+fi
+
+DIR=${GCCDIR}/gcc/testsuite/ada/acats
+if [ ! -d ${DIR} ] ; then
+ echo "No Ada build directory for the BSP (${DIR})"
+ exit 1
+fi
+
+cd ${DIR}
+if [ ! -d work-${BSP} ] ; then
+ echo "No ACATS working directory for the BSP (${BSP})"
+ exit 1
+fi
+
+
+while true
+do
+ printf "PASSED: %4d FAILED %4d\n" \
+ `grep ^PASS work-${BSP}/acats.sum | wc -l` \
+ `grep ^FAIL work-${BSP}/acats.sum | wc -l`
+ if [ ${seconds} -eq 0 ] ; then
+ break
+ fi
+ sleep ${seconds}
+done
+exit 0
diff --git a/gcc/testsuite/ada/acats/rtems_generate_acats_email b/gcc/testsuite/ada/acats/rtems_generate_acats_email
new file mode 100755
index 0000000..95cc37d
--- /dev/null
+++ b/gcc/testsuite/ada/acats/rtems_generate_acats_email
@@ -0,0 +1,121 @@
+#! /bin/sh
+#
+# Generate ACATS Email
+#
+# $Id$
+#
+
+if [ $# -ne 3 ] ; then
+ echo Usage $0: CPU BSP domail
+ exit 1
+fi
+
+vfile=`dirname $0`/../../../../VERSIONS
+if [ ! -r ${vfile} ] ; then
+ echo VERSIONS file not found
+ exit 1
+fi
+
+source ${vfile}
+domail=$3
+BSP=$2
+CPU=$1
+rtemsVersion=4.10
+Target=${CPU}-rtems${rtemsVersion}
+
+DIR=${GCCDIR}/gcc/testsuite/ada/acats
+if [ ! -d ${DIR} ] ; then
+ echo "No Ada build directory for the BSP (${DIR})"
+ exit 1
+fi
+
+cd ${DIR}
+if [ ! -d work-${BSP} ] ; then
+ echo "Usage No ACATS working directory for the BSP (${BSP})"
+ exit 1
+fi
+
+f=work-${BSP}/acats.sum
+logfile=work-${BSP}/acats.log
+if [ ! -r ${f} ] ; then
+ echo "Usage No ACATS summary file working directory for the BSP (${BSP})"
+ exit 1
+fi
+
+${CPU}-rtems${rtemsVersion}-gcc --version >/dev/null 2>&1
+if [ ${?} -ne 0 ] ; then
+ echo "${CPU}-rtems${rtemsVersion}-gcc not found"
+ exit 1
+fi
+
+get_count()
+{
+ fileIn=${1}
+ shift
+ grep "${*}" <${fileIn}
+}
+
+
+cp /dev/null LOGS.tmp
+
+get_failed()
+{
+ grep "^${2}" <${1} | while read l
+ do
+ Test=`echo ${l} | cut -d':' -f2 | tr -d '[:blank:]'`
+ LowTest=`echo ${l} | cut -d':' -f2 | tr '[:upper:]' '[:lower:]'`
+ Reason=`grep "[${BSP}|all]:${Test}" ${REASONS}`
+ if [ $? -eq 0 ] ; then
+ Reason=`echo ${Reason} | cut -d':' -f3- | sed -e 's/^ //'`
+ else
+ grep "Error detected.*${Test}" ${logfile} >/dev/null
+ if [ $? -eq 0 ] ; then
+ Reason="GNAT BUG DETECTED -- follow up required"
+ else
+ Reason="unknown reason for failure"
+ fi
+ #( echo "==================== ${LowTest}.log ====================" ; \
+ # cat `find work-${BSP} -name ${LowTest}.log` ; \
+ # echo "========================================================" \
+ #) >> LOGS.tmp
+ fi
+ echo "${Test} - ${Reason}"
+ done
+}
+
+gen_report()
+{
+ echo
+ ${CPU}-rtems${rtemsVersion}-gcc --version | head -1
+ echo
+
+ echo " === acats Summary ==="
+ get_count ${f} '# of expected passes'
+ get_count ${f} '# of unexpected failures'
+ get_count ${f} '# of unsupported tests'
+
+ echo
+ get_failed ${f} 'UNSUPPORTED'
+ get_failed ${f} 'FAIL'
+
+ echo
+ echo "======= Logs for failed tests ======"
+ cat LOGS.tmp
+}
+
+REASONS=${SCRIPTDIR}/gcc/testsuite/ada/acats/rtems_acats_reasons
+
+if [ ! -r ${REASONS} ] ; then
+ echo "Cannot find rtems_acats_reasons (${REASONS})"
+ exit 1
+fi
+
+if [ ${domail} = "yes" ] ; then
+ gccver=`${CPU}-rtems${rtemsVersion}-gcc --version | head -1 | cut -d' ' -f4-`
+ gen_report | joelmail \
+ -s "ACATS results for ${gccver} on ${CPU}-rtems${rtemsVersion}" \
+ gcc-testresults@gcc.gnu.org
+
+else
+ gen_report
+fi
diff --git a/gcc/testsuite/ada/acats/rtems_init.c b/gcc/testsuite/ada/acats/rtems_init.c
new file mode 100644
index 0000000..981899a
--- /dev/null
+++ b/gcc/testsuite/ada/acats/rtems_init.c
@@ -0,0 +1,121 @@
+/*
+ * COPYRIGHT (c) 1989-1997.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be found in
+ * the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#include <assert.h>
+#include <pthread.h>
+#include <stdlib.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+extern rtems_configuration_table BSP_Configuration;
+
+#ifdef GNAT_PID
+#include <unistd.h>
+pid_t getpid()
+{
+ return GNAT_PID;
+}
+#endif
+
+/*
+ * By having the POSIX_Init thread create a second thread just
+ * to invoke gnat_main, we can override all default attributes
+ * of the "Ada environment task". Otherwise, we would be
+ * stuck with the defaults set by RTEMS.
+ */
+
+void *start_gnat_main( void * argument )
+{
+ extern int gnat_main ( int argc, char **argv, char **envp );
+
+ (void) gnat_main ( 0, 0, 0 );
+
+ exit( 0 );
+
+ return 0;
+}
+
+size_t _ada_pthread_minimum_stack_size()
+{
+ return 20 * 1024;
+}
+
+void *POSIX_Init( void *argument )
+{
+ pthread_t thread_id;
+ pthread_attr_t attr;
+ size_t stacksize = _ada_pthread_minimum_stack_size();
+ int status;
+
+ /* ACATS needs /tmp */
+ mkdir( "/tmp", 0777 );
+
+ status = pthread_attr_init( &attr );
+ assert( !status );
+
+#define GNAT_MAIN_STACKSPACE 100
+#ifdef GNAT_MAIN_STACKSPACE
+ stacksize = GNAT_MAIN_STACKSPACE * 1024;
+#else
+#define GNAT_MAIN_STACKSPACE 0
+#endif
+
+ status = pthread_attr_setstacksize( &attr, stacksize );
+ assert( !status );
+
+ status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
+ assert( !status );
+
+ pthread_exit( 0 );
+
+ return 0;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 10
+#define CONFIGURE_GNAT_RTEMS
+#define CONFIGURE_MAXIMUM_ADA_TASKS 40
+#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
+
+/* Some of the ACATS tests assume a real filesystem */
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+
+#define CONFIGURE_MEMORY_OVERHEAD (GNAT_MAIN_STACKSPACE)
+/*
+#define CONFIGURE_MEMORY_OVERHEAD (256 + GNAT_MAIN_STACKSPACE)
+*/
+
+#define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY 1
+/* #define CONFIGURE_MALLOC_DIRTY */
+#define STACK_CHECKER_ON
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+#if defined(__mips__)
+/* GCC sometimes expects this on the mips */
+void _flush_cache()
+{
+}
+#endif
diff --git a/gcc/testsuite/ada/acats/run_all_rtems.sh b/gcc/testsuite/ada/acats/run_all_rtems.sh
new file mode 100755
index 0000000..1381dd7
--- /dev/null
+++ b/gcc/testsuite/ada/acats/run_all_rtems.sh
@@ -0,0 +1,405 @@
+#!/bin/sh
+# Run ACATS with the GNU Ada compiler
+
+# The following functions are to be customized if you run in cross
+# environment or want to change compilation flags. Note that for
+# tests requiring checks not turned on by default, this script
+# automatically adds the needed flags to pass (ie: -gnato or -gnatE).
+
+# gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
+# gnatflags="-gnatN"
+
+gccflags="-O2"
+gnatflags="-gnatws"
+
+if [ $# -lt 3 ] ; then
+ echo Usage ERROR -- tool_prefix rtems_prefix target BSP
+ exit 1
+fi
+
+cross=yes
+prefix=$1
+rtemsdir=$2
+target=$3
+BSP=$4
+toolsuffix=-cross
+case $target in
+ *rtems*) ;;
+ *) echo Unknown Cross Target ; exit 1;;
+esac
+
+shift ; shift ; shift ; shift
+echo $*
+echo $#
+
+# Must be run in gcc/testsuite/ada/acats
+testdir=`pwd`
+
+adascriptdir=`dirname $0`
+vfile=`dirname $0`/../../../../VERSIONS
+if [ ! -r ${vfile} ] ; then
+ echo VERSIONS file not found
+ exit 1
+fi
+
+source ${vfile}
+
+host_gnatchop=gnatchop
+host_gnatmake=gnatmake
+
+workdir=work-${BSP}
+
+if [ $# -eq 0 ]; then
+ rm -rf ${workdir}
+ mkdir ${workdir}
+ chapters=`cd ${testdir}/tests; echo [a-z]*`
+else
+ chapters=$*
+fi
+
+if [ ! -d ${workdir} ] ; then
+ echo "What happened to the working directory ${workdir}"
+ exit 1
+fi
+
+cd ${workdir}
+dir=`pwd`
+
+export RTEMS_MAKEFILE_PATH=${rtemsdir}/${target}/${BSP}
+ADASCRIPTDIR=${adascriptdir} \
+ make -f ${adascriptdir}/Makefile.rtems
+if [ $? -ne 0 ] ; then
+ exit 1
+fi
+
+# cat RTEMS_SETTINGS
+# exit 0
+
+# This should set everything we need to run the tests and build init.o
+. RTEMS_SETTINGS
+# End of customization section.
+
+display_noeol () {
+ printf "$@"
+ printf "$@" >> $dir/acats.sum
+ printf "$@" >> $dir/acats.log
+}
+
+display () {
+ echo "$@"
+ echo "$@" >> $dir/acats.sum
+ echo "$@" >> $dir/acats.log
+}
+
+log () {
+ echo "$@" >> $dir/acats.sum
+ echo "$@" >> $dir/acats.log
+}
+
+if [ "$testdir" = "" ]; then
+ echo You must use make check or make check-ada
+ exit 1
+fi
+
+if [ "$dir" = "$testdir" ]; then
+ echo "error: srcdir must be different than objdir, exiting."
+ exit 1
+fi
+
+#target_gnatmake () {
+# echo gnatmake --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
+# gnatmake --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
+#}
+#
+#target_gcc () {
+# $GCC $gccflags $*
+#}
+
+clean_dir () {
+ rm -f "$binmain" *.o *.ali > /dev/null 2>&1
+}
+
+find_main () {
+ ls ${i}?.adb > ${i}.lst 2> /dev/null
+ ls ${i}*m.adb >> ${i}.lst 2> /dev/null
+ ls ${i}.adb >> ${i}.lst 2> /dev/null
+ main=`tail -1 ${i}.lst`
+}
+
+EXTERNAL_OBJECTS=""
+# Global variable to communicate external objects to link with.
+
+rm -f $dir/acats.sum $dir/acats.log
+
+display " === acats configuration ==="
+
+# Hack XXX
+GCC=${target}-gcc
+
+target=`$GCC -dumpmachine`
+
+display target gcc is $GCC
+display `$GCC -v 2>&1`
+display host=`gcc -dumpmachine`
+display target=$target
+display `type gnatmake`
+gnatls -v >> $dir/acats.log
+display ""
+
+display " === acats support ==="
+display_noeol "Generating support files..."
+
+rm -rf $dir/support
+mkdir -p $dir/support
+cd $dir/support
+
+cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
+
+## ***** RTEMS is ALWAYS cross so this is just not going to work. *****
+## ***** We will get out values from the switch below. *****
+## # Find out the size in bit of an address on the target
+## target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
+## target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
+## # Easiest way to kill stupid CR/LF issues
+## dos2unix -q $dir/support/impbit.out
+## target_bit=`cat $dir/support/impbit.out`
+## echo target_bit="$target_bit" >> $dir/acats.log
+
+# Find out a suitable asm statement
+# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
+case "$target" in
+ ia64*-*-* | s390*-*-*)
+ target_insn="nop 0"
+ ;;
+ mmix-*-*)
+ target_insn="swym 0"
+ ;;
+ *)
+ target_insn="nop"
+ target_bit=32
+ ;;
+esac
+echo target_insn="$target_insn" >> $dir/acats.log
+
+sed -e "s,ACATS4GNATDIR,$dir,g" \
+ < $testdir/support/impdef.a > $dir/support/impdef.a
+sed -e "s,ACATS4GNATDIR,$dir,g" \
+ -e "s,ACATS4GNATBIT,$target_bit,g" \
+ -e "s,ACATS4GNATINSN,$target_insn,g" \
+ < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
+sed -e "s,ACATS4GNATDIR,$dir,g" \
+ < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
+
+cp $testdir/tests/cd/*.c $dir/support
+cp $testdir/tests/cxb/*.c $dir/support
+
+rm -rf $dir/run
+mv $dir/tests $dir/tests.$$ 2> /dev/null
+rm -rf $dir/tests.$$ &
+mkdir -p $dir/run
+
+cp -pr $testdir/tests $dir/
+
+for i in $dir/support/*.ada $dir/support/*.a; do
+ $host_gnatchop $i >> $dir/acats.log 2>&1
+done
+
+# These tools are used to preprocess some ACATS sources
+# they need to be compiled native on the host.
+
+$host_gnatmake -q -gnatws macrosub.adb
+if [ $? -ne 0 ]; then
+ display "**** Failed to compile macrosub"
+ exit 1
+fi
+./macrosub > macrosub.out 2>&1
+
+gcc -c cd300051.c
+$host_gnatmake -q -gnatws widechr.adb
+if [ $? -ne 0 ]; then
+ display "**** Failed to compile widechr"
+ exit 1
+fi
+./widechr > widechr.out 2>&1
+
+rm -f $dir/support/macrosub
+rm -f $dir/support/widechr
+rm -f $dir/support/*.ali
+rm -f $dir/support/*.o
+
+display " done."
+
+# From here, all compilations will be made by the target compiler
+
+display_noeol "Compiling support files..."
+
+target_gcc -c *.c
+if [ $? -ne 0 ]; then
+ display "**** Failed to compile C code"
+ exit 1
+fi
+
+target_gnatchop *.adt >> $dir/acats.log 2>&1
+
+target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
+target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
+
+display " done."
+display ""
+display " === acats tests ==="
+
+glob_countn=0
+glob_countok=0
+glob_countu=0
+
+for chapter in $chapters; do
+ display Running chapter $chapter ...
+
+ if [ ! -d $dir/tests/$chapter ]; then
+ display "*** CHAPTER $chapter does not exist, skipping."
+ display ""
+ continue
+ fi
+
+ cd $dir/tests/$chapter
+ ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
+ cut -c1-7 | sort | uniq | comm -23 - $testdir/norun.lst \
+ > $dir/tests/$chapter/${chapter}.lst
+ countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
+ glob_countn=`expr $glob_countn + $countn`
+ counti=0
+ for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
+ counti=`expr $counti + 1`
+ extraflags=""
+ grep $i $testdir/overflow.lst > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ extraflags="$extraflags -gnato"
+ fi
+ grep $i $testdir/elabd.lst > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ extraflags="$extraflags -gnatE"
+ fi
+ grep $i $testdir/stackcheck.lst > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ extraflags="$extraflags -fstack-check"
+ fi
+ grep $i $testdir/ada95.lst > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ extraflags="$extraflags -gnat95"
+ fi
+ test=$dir/tests/$chapter/$i
+ mkdir $test && cd $test >> $dir/acats.log 2>&1
+
+ if [ $? -ne 0 ]; then
+ display "FAIL: $i"
+ failed="${failed}${i} "
+ clean_dir
+ continue
+ fi
+
+ target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
+ main=""
+ find_main
+ if [ -z "$main" ]; then
+ sync
+ find_main
+ fi
+ binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
+ echo "BUILD $main" >> $dir/acats.log
+ EXTERNAL_OBJECTS=""
+ case $i in
+ cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
+ ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
+ ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
+ cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
+ esac
+ if [ "$main" = "" ]; then
+ display "FAIL: $i"
+ failed="${failed}${i} "
+ clean_dir
+ continue
+ fi
+
+ target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
+ if [ $? -ne 0 ]; then
+ display "FAIL: $i"
+ failed="${failed}${i} "
+ clean_dir
+ continue
+ fi
+
+ echo "RUN $binmain" >> $dir/acats.log
+ cd $dir/run
+ if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
+ sync
+ fi
+ target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
+ cd $dir/tests/$chapter/$i
+ cat ${i}.log >> $dir/acats.log
+ case ${i} in
+ # There are tests RTEMS does not support because we only have
+ # a RAM based file system on simulators and the contents are
+ # fresh each time a program is run.
+ ce2108f|ce2108h|ce3112d)
+ log "UNSUPPORTED: $i"
+ glob_countn=`expr $glob_countn - 1`
+ glob_countu=`expr $glob_countu + 1`
+ ;;
+ *)
+ egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ unsupported=no
+ failed=no
+
+ grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ unsupported=yes
+ else
+ case $BSP in
+ sis)
+ case ${i} in
+ # sis FPU simulation is faulty
+ cxg2005|cxg2012|cxg2014|cxg2017|cxg2018|cxg2020)
+ unsupported=yes
+ ;;
+ *) # other tests on sis
+ failed=yes
+ ;;
+ esac
+ ;;
+ *) # all tests on other BSPs
+ failed=yes
+ ;;
+ esac
+ fi
+ if [ ${failed} = yes ] ; then
+ display "FAIL: $i"
+ failed="${failed}${i} "
+ else
+ log "UNSUPPORTED: $i"
+ glob_countn=`expr $glob_countn - 1`
+ glob_countu=`expr $glob_countu + 1`
+ fi
+ else
+ log "PASS: $i"
+ glob_countok=`expr $glob_countok + 1`
+ fi
+ ;;
+ esac
+ clean_dir
+ done
+done
+
+display " === acats Summary ==="
+display "# of expected passes $glob_countok"
+display "# of unexpected failures `expr $glob_countn - $glob_countok`"
+
+if [ $glob_countu -ne 0 ]; then
+ display "# of unsupported tests $glob_countu"
+fi
+
+if [ $glob_countok -ne $glob_countn ]; then
+ display "*** FAILURES: $failed"
+fi
+
+exit 0