@@ -6,7 +6,7 @@
# The resulting file can be used with test result comparison scripts for
# results from tests that were run in parallel. See usage() below.
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation
+# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
# Contributed by Janis Johnson <janis187@us.ibm.com>
#
# This file is part of GCC.
@@ -142,65 +142,6 @@
fi
fi
-if [ "$TOOL" = acats ]; then
- # Acats *.sum or *.log files aren't dejagnu generated, and they have
- # somewhat different format.
- ACATS_AWK=${TMP}/acats.awk
- cat <<EOF > $ACATS_AWK
-BEGIN {
- print_prologue=1; curfile=""; insummary=0
- passcnt=0; failcnt=0; unsupcnt=0; failures=""
-}
-/^[ \t]*=== acats configuration ===/ {
- insummary=0
- if (print_prologue) print
- next
-}
-/^[ \t]*=== acats tests ===/ {
- if (print_prologue) print
- print_prologue=0
- next
-}
-/^Running chapter / {
- if (curfile) close (curfile)
- curfile="${TMP}/chapter-"\$3
- print >> curfile
- next
-}
-/^[ \t]*=== acats Summary ===/ {
- if (curfile) close (curfile)
- curfile=""
- insummary=1
- next
-}
-/^# of expected passes/ { if (insummary == 1) passcnt += \$5; next; }
-/^# of unexpected failures/ { if (insummary == 1) failcnt += \$5; next; }
-/^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; }
-/^\*\*\* FAILURES: / {
- if (insummary == 1) {
- if (failures) sub(/^\*\*\* FAILURES:/,"")
- failures=failures""\$0
- }
-}
-{
- if (print_prologue) { print; next }
- if (curfile) print >> curfile
-}
-END {
- system ("cat ${TMP}/chapter-*")
- print " === acats Summary ==="
- print "# of expected passes " passcnt
- print "# of unexpected failures " failcnt
- if (unsupcnt) print "# of unsupported tests " unsupcnt
- if (failures) print failures
-}
-EOF
-
- rm -f ${TMP}/chapter-*
- $AWK -f $ACATS_AWK $SUM_FILES
- exit 0
-fi
-
# If no variants were specified, find all variants in the remaining
# summary files. Otherwise, ignore specified variants that aren't in
# any of those summary files.
@@ -1,6 +1,6 @@
# Top level -*- makefile -*- fragment for GNU Ada (GNAT).
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Free Software Foundation, Inc.
#This file is part of GCC.
@@ -992,53 +992,28 @@
-$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stagefeedback/ada
-$(MV) ada/stamp-* stagefeedback/ada
+check-ada: check-gnat
+check-ada-subtargets: check-gnat-subtargets
+
lang_checks += check-gnat
-
-check-ada: check-acats check-gnat
-check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
-
-ACATSDIR = $(TESTSUITEDIR)/ada/acats
-
-check_acats_targets = $(patsubst %,check-acats%, 0 1 2)
-
-check-acats:
- @test -d $(ACATSDIR) || mkdir -p $(ACATSDIR); \
- rootme=`${PWD_COMMAND}`; export rootme; \
- EXPECT=$(EXPECT); export EXPECT; \
- if [ -z "$(CHAPTERS)" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; \
- then \
- $(MAKE) $(check_acats_targets); \
- for idx in 0 1 2; do \
- mv -f $(ACATSDIR)$$idx/acats.sum $(ACATSDIR)$$idx/acats.sum.sep; \
- mv -f $(ACATSDIR)$$idx/acats.log $(ACATSDIR)$$idx/acats.log.sep; \
- done; \
- $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh \
- $(ACATSDIR)0/acats.sum.sep $(ACATSDIR)1/acats.sum.sep \
- $(ACATSDIR)2/acats.sum.sep > $(ACATSDIR)/acats.sum; \
- $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L \
- $(ACATSDIR)0/acats.log.sep $(ACATSDIR)1/acats.log.sep \
- $(ACATSDIR)2/acats.log.sep > $(ACATSDIR)/acats.log; \
- exit 0; \
- fi; \
- testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
- export testdir; cd $(ACATSDIR) && $(SHELL) $${testdir}/run_acats $(CHAPTERS)
-
-check-acats-subtargets:
- @echo $(check_acats_targets)
-
-# Parallelized check-acats
-$(check_acats_targets): check-acats%:
- test -d $(ACATSDIR)$* || mkdir -p $(ACATSDIR)$*; \
- testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
- case "$*" in \
- 0) chapters="`cd $$testdir/tests; echo [a-b]* c[0-4]*`";; \
- 1) chapters="`cd $$testdir/tests; echo c[5-9ab]*`";; \
- 2) chapters="`cd $$testdir/tests; echo c[c-z]* [d-z]*`";; \
- esac; \
- export testdir; cd $(ACATSDIR)$* && $(SHELL) $${testdir}/run_acats $$chapters
-
-.PHONY: check-acats $(check_acats_targets)
-
+lang_checks_parallelized += check-gnat
+# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+# FIXME: Adapt when ada/acats/tests gets moved to gnat.acats or simply omit
+# the directory.
+check_gnat_parallelize = acats.exp=tests/\[ab\]* \
+ acats.exp=tests/c\[1-2\]* \
+ acats.exp=tests/c3* \
+ acats.exp=tests/c4* \
+ acats.exp=tests/c\[567\]* \
+ acats.exp=tests/c8* \
+ acats.exp=tests/c9* \
+ acats.exp=tests/c\[ab\]* \
+ acats.exp=tests/cc* \
+ acats.exp=tests/cd* \
+ acats.exp=tests/ce* \
+ acats.exp=tests/c\[f-w\]* \
+ acats.exp=tests/c\[x-z\]* \
+ acats.exp=tests/\[d-z\]*
# Bootstrapping targets for just GNAT - use the same stage directories
gnatboot: force
@@ -202,7 +202,10 @@
function Cd30005_Proc (X : Integer) return Integer;
pragma Import (C, Cd30005_Proc, "_cd30005_1");
- pragma Linker_Options ("ACATS4GNATDIR/support/cd300051.o");
+ -- _cd30005_1 is references by every user of Impdef, so add the file
+ -- here implicitly instead of explicitly.
+ -- FIXME: Maybe do this in gnat-dg.exp (gnat-dg-acats-runtest) instead?
+ pragma Linker_Options ("support/cd300051.o");
CD30005_1_Foreign_Address : constant System.Address:= Cd30005_Proc'Address;
@@ -315,7 +318,7 @@
-- will expect to find the files to process at this location.
Test_Path_Root : constant String :=
- "ACATS4GNATDIR/tests/c2/";
+ "tests/";
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- MODIFY HERE AS NEEDED
-- The following two strings must not be modified unless the .AW file
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- AC3106A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34005P.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34005R.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34005S.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34005U.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34005V.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34006G.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34006J.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34006L.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C34008A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C3A0014.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C41103B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C41203B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C41306A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45304A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45304B.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45304C.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45504A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45504B.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45504C.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45613A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45613B.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45613C.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45632A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45632B.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C45632C.DEP
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C460008.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C460011.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C46014A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C460A01.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
-- C4A012B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- C52103X.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- C52104X.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- C52104Y.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C650001.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
-- C731001.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C74302B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C74306A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C85014A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C85014B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C85014C.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
-- C854002.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C87B26B.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C87B41A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- C99004A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
-- CA11018.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
-- CA11019.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
-- CA5006A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- CB1010A.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- CB1010C.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
-- CB1010D.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CB40005.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CC3019C0.ADA
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CC51B03.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CC51D02.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CD10002.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,6 @@
+-- Don't, already added implicitly.
+-- { dg- additional-sources "cd300051.c" } */
+
-- CD30005.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CDD2A03.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
-- CXAC005.A
--
-- Grant of Unlimited Rights
@@ -1,3 +1,5 @@
+/* { dg-additional-sources "cxb30040.c" } */
+
/*
-- CXB30040.C
--
@@ -1,3 +1,5 @@
+/* { dg-additional-sources "cxb30130.c cxb30131.c" } */
+
/*
-- CXB30130.C
--
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -a -f" }
+--
-- CXH1001.A
--
-- Grant of Unlimited Rights
@@ -0,0 +1,55 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib gnat-dg.exp
+
+# If a testcase doesn't have special options, use these.
+# FIXME: CFLAGS seems wrong for Ada, cf. gcc/ada/Make*.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS "-O2"
+}
+
+# The ACATS tests are all run tests.
+set saved-dg-do-what ${dg-do-what-default}
+set dg-do-what-default run
+
+# FIXME: Look in old ACATS directory for the moment.
+set saved-srcdir $srcdir
+set srcdir "$srcdir/ada/acats/tests"
+
+# Initialize `dg'
+dg-init
+gnat-acats-init
+
+# Main loop.
+# Some source files are preprocessed, so search testdir, too.
+# Only use first one of multifile testcases.
+gnat-dg-acats-runtest [lsort \
+ [glob -nocomplain $srcdir/*/???????{,0}.{a,ada,adt,am,c,dep} \
+ tests/???????{,0}.{a,ada,adt,am,c,dep}]] \
+ "" "$DEFAULT_CFLAGS"
+
+set srcdir ${saved-srcdir}
+set dg-do-what-default ${saved-dg-do-what}
+
+# All done.
+dg-finish
+gnat-acats-finish
+
+# Unset again so gnat.dg isn't affected.
+unset DEFAULT_CFLAGS
@@ -39,10 +39,11 @@
if { [lindex $clean_result 0] != -1 } {
set clean_files [lindex $clean_result 1]
# Purge NL from clean_files.
- regsub -all "\[\r\n\]+" $clean_files " " clean_files
+ regsub -all "\[\n\r\]+" $clean_files " " clean_files
# Remove ./ so lremove works.
regsub -all "\./" $clean_files "" clean_files
lremove clean_files $output_file
+ verbose -log "clean_files = $clean_files"
eval remote_file host delete $clean_files
}
@@ -60,6 +61,144 @@
return [gcc-dg-prune $system $text]
}
+# Process dg-* keywords from SRC, which is the gnatchop input, but only the
+# output gets passed to dg-test.
+proc acats-get-options { src } {
+ # dg-options sets a variable called dg-extra-tool-flags.
+ set dg-extra-tool-flags ""
+
+ # current_compiler_flags reads tool_flags from the same stack frame
+ # as dg-extra-tool-flags
+ set tool_flags ""
+
+ set tmp [dg-get-options $src]
+ foreach op $tmp {
+ set cmd [lindex $op 0]
+ if { ![string compare "dg-additional-sources" $cmd] \
+ || ![string compare "dg-options" $cmd] } {
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ perror "$src: $errmsg for \"$op\"\n"
+ unresolved "$src: $errmsg for \"$op\""
+ return
+ }
+ } else {
+ # Ignore unrecognized dg- commands, but warn about them.
+ warning "gnat-dg.exp does not support $cmd"
+ }
+ }
+
+ # Return flags to use for compiling the primary source file and for
+ # linking.
+ return ${dg-extra-tool-flags}
+}
+
+# FIXME: Describe.
+proc gnat-dg-acats-runtest { testcases flags default-extra-flags } {
+ global runtests
+ global board_info
+
+ # FIXME: Better use set_board_info, unset_board_info from targetdb.exp?
+ # Or global var or uplevel N info proc ... to say `we are in ACATS'?
+ # Only used for in gnat.exp (gnat_target_compile) for
+ # additional_flags=-Isupport -gnatws.
+ # Pass as FLAGS to gnat-dg-acats-runtest? Works, but they show up in
+ # gnat.sum.
+ set board_info(gnat,acats) 1
+
+ foreach testcase $testcases {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $testcase] {
+ continue
+ }
+ verbose "Testing [file tail [file dirname $testcase]]/[file tail $testcase]"
+
+ global srcdir subdir
+ set subdir [file dirname [dg-trim-dirname $srcdir $testcase]]
+
+ # FIXME: Which ACATS files need to be chopped at all? Cf. ACATS-UG.
+ if [string match "*/???????0.*" $testcase] {
+ # FIXME: Explain.
+ regsub "0\\..*" $testcase "?.{a,ada,adt,am,dep}" testpattern
+ set testfiles [lsort [glob -nocomplain $testpattern]]
+ } else {
+ set testfiles $testcase
+ }
+ verbose -log "testfiles = $testfiles"
+
+ # Skip bogus tests (no Ada components).
+ if { "$testfiles" == "" } {
+ # FIXME: Warn?
+ continue
+ }
+
+ # FIXME: Perhaps move to gnat_init?
+ gnat_set_ada_env_vars
+
+ # Determine options from testcase source, not gnatchop output.
+ set extra_flags [acats-get-options $testcase]
+ if { $extra_flags != "" } {
+ set save_flags $flags
+ eval lappend flags $extra_flags
+ }
+
+ # Chop input files.
+ set chop_result [remote_exec host [find_gnatchop] "-c -w $testfiles"]
+ if { [lindex $chop_result 0] != -1 } {
+ set clean_files [lindex $chop_result 1]
+ # Filter out warnings.
+ regsub -all "warning: \[^\n\r\]+\[\n\r]\+" $clean_files "" clean_files
+ # Filter out gnat.adc message, but keep gnat.adc.
+ regsub -all "\[^\n\r\]+ configuration pragmas from \[^\n\r\]+ to " $clean_files "" clean_files
+ # Filter out comments so sources are not removed.
+ regsub -all "splitting \[^\n\r\]+ into:\[\n\r\]+" $clean_files "" clean_files
+ # Purge NL from clean_files.
+ regsub -all "\[\n\r\]+" $clean_files " " clean_files
+ verbose -log "clean_files = $clean_files"
+ }
+
+ set basename [file rootname [file tail $testcase]]
+ # FIXME: Handle via dg-* keywords rather than here?
+ switch -glob $basename {
+ "ca1020e*" {
+ remote_file host delete ca1020e_func1.adb ca1020e_func2.adb \
+ ca1020e_proc1.adb ca1020e_proc2.adb
+ }
+ "ca14028*" {
+ remote_file host delete ca14028_func2.ads ca14028_func3.ads \
+ ca14028_proc1.ads ca14028_proc3.ads
+ }
+ "cxh1001*" {
+ set out [open gnat.adc w]
+ puts $out "pragma Normalize_Scalars;"
+ close $out
+ lappend clean_files gnat.adc
+ }
+ }
+
+ # Change testcase to reflect this. FIXME: What is this?
+ set basename [file rootname [file tail $testcase]]
+ # Take only 7 characters.
+ set basename [string range $basename 0 6]
+ set mainfiles [lsort [glob -nocomplain $basename?.adb]]
+ eval lappend mainfiles [lsort [glob -nocomplain $basename*m.adb]]
+ eval lappend mainfiles [lsort [glob -nocomplain $basename.adb]]
+ set testcase [lindex $mainfiles [expr [llength $mainfiles]-1]]
+
+ dg-test $testcase $flags ${default-extra-flags}
+
+ eval remote_file host delete $clean_files
+
+ # Restore flags for next testcase.
+ if { $extra_flags != "" } {
+ set flags $save_flags
+ }
+ }
+
+ unset board_info(gnat,acats)
+}
+
# Utility routines.
#
@@ -79,7 +218,23 @@
if { [regexp "tasking not implemented" $output] } {
return [list "unsupported" $output]
}
- return $result
+
+ #
+ # For ACATS tests, PASS or FAIL doesn't depend on exit status, but
+ # on test output. Cf. report.adb:
+ #
+ # status pattern
+ #
+ # PASS ====
+ # DOES_NOT_APPLY ++++
+ # ACTION_REQUIRED !!!!
+ # OTHERS ****
+ #
+ if { [regexp {==== |\+\+\+\+ |!!!! } $output] } {
+ return [list "pass" $output]
+ } else {
+ return $result
+ }
}
}
@@ -25,6 +25,7 @@
load_lib gcc-defs.exp
load_lib gcc.exp
load_lib timeout.exp
+load_lib copy-file.exp
#
# GNAT_UNDER_TEST is the compiler under test.
@@ -107,16 +108,215 @@
}
}
+# Build ACATS support files first, but not in gnat_init which is generic.
+proc gnat-acats-init { } {
+ global srcdir
+ global target_triplet
+ global env
+
+ # FIXME: Explain. Adapt later.
+ set support $srcdir/../support
+
+ # FIXME: Only put *.tst files from tests into ., place support file in
+ # support subdir, thus avoiding tests just as in future gnat.acats,
+ # and simply prune support?
+ file mkdir tests
+ file mkdir support
+
+ gnat_target_compile $support/impbit.adb impbit executable ""
+ set result [remote_exec target impbit "" ""]
+ if { [lindex $result 0] != -1 } {
+ set target_bit [lindex $result 1]
+ # Purge NL from target_bit.
+ regsub -all "\[\r\n\]+" $target_bit "" target_bit
+ verbose -log "target_bit = $target_bit"
+ }
+ # FIXME: Cleanup.
+ # Currently handled in gnat-dg-test, move elsewhere, perhaps
+ # gnat_target_compile?
+ eval remote_exec host [find_gnatclean] impbit
+
+ switch $target_triplet {
+ "ia64*-*-*" -
+ "s390*-*-*" {
+ set target_insn "nop 0"
+ }
+ "mmix-*-*" {
+ set target_insn "swym 0"
+ }
+ default {
+ set target_insn "nop"
+ }
+ }
+ verbose -log "target_insn = $target_insn"
+
+ # Unset environment variables that interfere with host compiler.
+ if { [info exists env(ADA_INCLUDE_PATH)] } {
+ verbose -log "unsetting ADA_INCLUDE_PATH"
+ set orig_ada_include_path $env(ADA_INCLUDE_PATH)
+ unsetenv ADA_INCLUDE_PATH
+ }
+ if { [info exists env(ADA_OBJECTS_PATH)] } {
+ verbose -log "unsetting ADA_OBJECTS_PATH"
+ set orig_ada_objects_path $env(ADA_OBJECTS_PATH)
+ unsetenv ADA_OBJECTS_PATH
+ }
+ if { [info exists env(GCC_EXEC_PREFIX)] } {
+ verbose -log "unsetting GCC_EXEC_PREFIX"
+ set orig_gcc_exec_prefix $env(GCC_EXEC_PREFIX)
+ unsetenv GCC_EXEC_PREFIX
+ }
+
+ remote_exec host [which gnatchop] \
+ "-c -w [glob -nocomplain $support/*.{a,ada}] support"
+
+ set inp [open $support/macro.dfs r]
+ set out [open MACRO.DFS w]
+ while { [gets $inp line] >= 0 } {
+ # FIXME: Rather substitute ^(ACC|TASK)_SIZE instead.
+ regsub -all "ACATS4GNATBIT" $line $target_bit line
+ # FIXME: Rather substitute ^MACHINE_CODE_STATEMENT with
+ # MACHINE_CODE_STATEMENT Asm_Insn'(Asm ("$target_insn"));
+ regsub -all "ACATS4GNATINSN" $line $target_insn line
+ puts $out $line
+ }
+ close $inp
+ close $out
+
+ gcc_copy_files [glob -nocomplain $srcdir/*/*.tst] tests
+ gcc_copy_files [glob -nocomplain $support/*.tst] support
+ set out [open TSTTESTS.DAT w]
+ foreach tst [glob -nocomplain */*.tst] {
+ puts $out $tst
+ }
+ close $out
+
+ remote_exec host [which gnatmake] "-q -gnatws support/macrosub.adb"
+ remote_load host ./macrosub
+ eval remote_exec host [which gnatclean] macrosub
+ file_on_host delete MACRO.DFS
+ file_on_host delete TSTTESTS.DAT
+
+ # FIXME: How to properly locate host CC? $env(CC)?
+ # Cf. below why file is needed.
+ remote_exec host [which gcc] "-c $srcdir/cd/cd300051.c -o support/cd300051.o"
+
+ # Copy c2/c25000[12].aw into build dir, postprocessed by widechr.
+ gcc_copy_files [glob -nocomplain $srcdir/c2/*.aw] tests
+
+ remote_exec host [which gnatmake] "-q -gnatws support/widechr.adb"
+ remote_load host ./widechr
+ eval remote_exec host [which gnatclean] widechr
+
+ # Restore environment variables.
+ if { $orig_ada_include_path != "" } {
+ setenv ADA_INCLUDE_PATH $orig_ada_include_path
+ }
+ if { $orig_ada_objects_path != "" } {
+ setenv ADA_OBJECTS_PATH $orig_ada_objects_path
+ }
+ if { $orig_gcc_exec_prefix != "" } {
+ setenv GCC_EXEC_PREFIX $orig_gcc_exec_prefix
+ }
+
+ # Used implicitly by every testcase via pragma Linker_Options in
+ # support/impdef.a.
+ # FIXME: Somehow avoid this?
+ gnat_target_compile $srcdir/cd/cd300051.c support/cd300051.o object ""
+
+ remote_exec host [find_gnatchop] \
+ "-c -w [glob -nocomplain tests/*.adt tests]"
+ remote_exec host [find_gnatchop] \
+ "-c -w [glob -nocomplain support/*.adt support]"
+
+ # FIXME: Explain -gnato -gnatE?
+ lappend opts "additional_flags=-gnatws -O2 -gnato -gnatE -D support"
+ foreach src [glob -nocomplain support/*.ad\[sb\]] {
+ set obj [file rootname [file tail $src]].o
+ gnat_target_compile $src $obj object $opts
+ }
+}
+
+# Cleanup ACATS support files.
+proc gnat-acats-finish { } {
+ # FIXME: Maybe remember file lists in gnat-acats-init?
+ # Simply remove support and tests subdirs.
+}
+
+proc gnat_set_ada_env_vars { } {
+ global rtsdir
+
+ if [info exists TOOL_OPTIONS] {
+ set rtsdir "[get_multilibs ${TOOL_OPTIONS}]/libada"
+ } else {
+ set rtsdir "[get_multilibs]/libada"
+ }
+
+ # gnatlink looks for system.ads itself and has no --RTS option, so
+ # specify via environment
+ setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
+ setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
+ # Always log so compilations can be repeated manually.
+ verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
+ verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
+}
+
+# FIXME: Modified version of dg-additional-files-options.
+# Perhaps avoid this by playing games with SOURCE?
+#
+# Return an updated version of OPTIONS that mentions any additional
+# source files registered with dg-additional-sources. SOURCE is the
+# name of the test case.
+
+proc gnat-dg-additional-sources-options { options source } {
+ global additional_sources
+ global srcdir subdir
+
+ set to_download [list]
+ if { $additional_sources != "" } then {
+ foreach src $additional_sources {
+ lappend srcs $src
+
+ set obj [file rootname [file tail $src]].o
+ lappend objs $obj
+ }
+
+ # FIXME: Explain -largs/-margs.
+ lappend options "additional_flags=-largs $objs -margs"
+
+ set to_download [concat $to_download $objs]
+ set additional_sources ""
+
+ # Only compile after additional_sources has been been cleared,
+ # otherwise the sources are added twice.
+ # Need to compile here since gnatmake cannot handle non-Ada sources.
+ foreach src $srcs {
+ set obj [file rootname [file tail $src]].o
+ # FIXME: Error handling.
+ gnat_target_compile $srcdir/$subdir/$src $obj object ""
+ }
+ }
+ if [is_remote host] {
+ foreach file $to_download {
+ remote_download host $file
+ }
+ }
+
+ return $options
+}
+
proc gnat_target_compile { source dest type options } {
global rootme
global tmpdir
global gluefile wrap_flags
global srcdir
+ global rtsdir
global GNAT_UNDER_TEST
global TOOL_OPTIONS
global gnat_target_current
+ global board_info
- # dg-require-effective-target tests must be compiled as C.
+ # gnatmake cannot compile C files, so do this explicitly.
if [ string match "*.c" $source ] then {
return [gcc_target_compile $source $dest $type $options]
}
@@ -125,30 +325,30 @@
# GNAT_UNDER_TEST and the appropriate RTS.
if { $gnat_target_current!="[current_target_name]" } {
set gnat_target_current "[current_target_name]"
- if [info exists TOOL_OPTIONS] {
- set rtsdir "[get_multilibs ${TOOL_OPTIONS}]/libada"
- } else {
- set rtsdir "[get_multilibs]/libada"
- }
+
+ gnat_set_ada_env_vars
+
if [info exists TOOL_EXECUTABLE] {
set GNAT_UNDER_TEST "$TOOL_EXECUTABLE"
} else {
set GNAT_UNDER_TEST "[local_find_gnatmake]"
}
set GNAT_UNDER_TEST "$GNAT_UNDER_TEST --RTS=$rtsdir"
-
- # gnatlink looks for system.ads itself and has no --RTS option, so
- # specify via environment
- setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
- setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
- # Always log so compilations can be repeated manually.
- verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
- verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
}
- lappend options "compiler=$GNAT_UNDER_TEST -q -f"
+ # FIXME: Is -f necessary/desirable for gnat.dg? It hurts for gnat.acats.
+ # Why?
+ #lappend options "compiler=$GNAT_UNDER_TEST -q -f"
+ lappend options "compiler=$GNAT_UNDER_TEST -q"
lappend options "timeout=[timeout_value]"
+ # FIXME: What's right here, target_info or board_info?
+ if [info exists board_info(gnat,acats)] {
+ # Pass -Isupport to locate support files.
+ # FIXME: Why -gnatws?
+ lappend options "additional_flags=-Isupport -gnatws"
+ }
+
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
lappend options "libs=${gluefile}"
lappend options "ldflags=$wrap_flags"
@@ -160,6 +360,7 @@
set options [concat "additional_flags=$TOOL_OPTIONS" $options]
}
+ set options [gnat-dg-additional-sources-options $options $source]
return [target_compile $source $dest $type $options]
}
@@ -234,6 +435,26 @@
return $gnatclean
}
+proc find_gnatchop {} {
+ global tool_root_dir
+
+ if ![is_remote host] {
+ set file [lookfor_file $tool_root_dir gnatchop]
+ if { $file == "" } {
+ set file [lookfor_file $tool_root_dir gcc/gnatchop]
+ }
+ if { $file != "" } {
+ set root [file dirname $file]
+ set CC "$file --GCC=$root/xgcc";
+ } else {
+ set CC [transform gnatchop]
+ }
+ } else {
+ set CC [transform gnatchop]
+ }
+ return $CC
+}
+
# Local Variables:
# tcl-indent-level:4
# End: