aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg-Johann Lay <gjl@gcc.gnu.org>2016-12-21 09:20:12 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2016-12-21 09:20:12 +0000
commit84ab8b8ad51a339d05a65759a4f603b01f0aa80a (patch)
tree8f8f67c1dc8b06efee089a0503bc36b4f0946560
parent815ee97417d55b5cdf5ee73397a9b9a747bd3a0a (diff)
downloadgcc-84ab8b8ad51a339d05a65759a4f603b01f0aa80a.zip
gcc-84ab8b8ad51a339d05a65759a4f603b01f0aa80a.tar.gz
gcc-84ab8b8ad51a339d05a65759a4f603b01f0aa80a.tar.bz2
mmcu: New folder for compile-tests with -mmcu=.
* gcc.target/avr/mmcu: New folder for compile-tests with -mmcu=. * gcc.target/avr/mmcu/avr-mmcu.exp: New file. * gcc.target/avr/pr58545.c: Move to gcc.target/avr/mmcu. * gcc.target/avr/tiny-caller-save.c: Dito. * gcc.target/avr/tiny-memx.c: Dito. From-SVN: r243840
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.target/avr/mmcu/avr-mmcu.exp101
-rw-r--r--gcc/testsuite/gcc.target/avr/mmcu/pr58545.c (renamed from gcc/testsuite/gcc.target/avr/pr58545.c)0
-rw-r--r--gcc/testsuite/gcc.target/avr/mmcu/tiny-caller-save.c (renamed from gcc/testsuite/gcc.target/avr/tiny-caller-save.c)2
-rw-r--r--gcc/testsuite/gcc.target/avr/mmcu/tiny-memx.c (renamed from gcc/testsuite/gcc.target/avr/tiny-memx.c)2
5 files changed, 112 insertions, 3 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index be5673d..4f5b6ae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,12 @@
-2016-12-22 Naveen H.S <Naveen.Hurugalawadi@cavium.com>
+2016-12-21 Georg-Johann Lay <avr@gjlay.de>
+
+ * gcc.target/avr/mmcu: New folder for compile-tests with -mmcu=.
+ * gcc.target/avr/mmcu/avr-mmcu.exp: New file.
+ * gcc.target/avr/pr58545.c: Move to gcc.target/avr/mmcu.
+ * gcc.target/avr/tiny-caller-save.c: Dito.
+ * gcc.target/avr/tiny-memx.c: Dito.
+
+2016-12-21 Naveen H.S <Naveen.Hurugalawadi@cavium.com>
* gcc.dg/max.c: New Testcase.
* gcc.dg/min.c: New Testcase.
diff --git a/gcc/testsuite/gcc.target/avr/mmcu/avr-mmcu.exp b/gcc/testsuite/gcc.target/avr/mmcu/avr-mmcu.exp
new file mode 100644
index 0000000..b1e3a9c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/mmcu/avr-mmcu.exp
@@ -0,0 +1,101 @@
+# Copyright (C) 2008-2016 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/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# This folder contains compile tests that set dg-options to
+# some -mmcu=<MCU> which might collide with the MCU set by the
+# target board. This in turn will fail the test case due to
+# "error: specified option '-mmcu' more than once".
+#
+# Hence we filter out -mmcu= from cflags and --tool_opts before
+# running the tests in this folder.
+
+# Exit immediately if this isn't an AVR target.
+if ![istarget avr-*-*] then {
+ return
+}
+
+# Return the saved values of the variable_list
+proc save_variables { variable_list } {
+ set saved_variable { }
+
+ foreach variable $variable_list {
+ upvar 1 $variable var
+
+ set save($variable) $var
+ lappend saved_variable $save($variable)
+ }
+ return $saved_variable
+}
+
+# Restore the values of the variable_list
+proc restore_variables { variable_list saved_variable } {
+ foreach variable $variable_list value $saved_variable {
+ upvar 1 $variable var
+ set var $value
+ }
+}
+
+# Filter out -mmcu= options
+proc filter_out_mmcu { options } {
+ set reduced {}
+
+ foreach option [ split $options ] {
+ if { ![ regexp "\-mmcu=.*" $option ] } {
+ lappend reduced $option
+ }
+ }
+
+ return [ join $reduced " " ]
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# If no --tool_opts were specified, use empty ones.
+if ![info exists TOOL_OPTIONS] then {
+ set TOOL_OPTIONS ""
+}
+
+# Initialize `dg'.
+dg-init
+
+# Save
+set variablelist [ list TOOL_OPTIONS board_info([target_info name],cflags) ]
+set saved_value [ save_variables $variablelist ]
+
+# Filter-out -mmcu=
+set TOOL_OPTIONS [ filter_out_mmcu $TOOL_OPTIONS ]
+set board_info([ target_info name ],cflags) [ filter_out_mmcu $board_info([ target_info name ],cflags) ]
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{\[cCS\],cpp}]] \
+ "" $DEFAULT_CFLAGS
+
+# Restore
+restore_variables $variablelist $saved_value
+
+set dg_runtest_extra_prunes ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/avr/pr58545.c b/gcc/testsuite/gcc.target/avr/mmcu/pr58545.c
index d1b8461..d1b8461 100644
--- a/gcc/testsuite/gcc.target/avr/pr58545.c
+++ b/gcc/testsuite/gcc.target/avr/mmcu/pr58545.c
diff --git a/gcc/testsuite/gcc.target/avr/tiny-caller-save.c b/gcc/testsuite/gcc.target/avr/mmcu/tiny-caller-save.c
index ff35161..63fad3a 100644
--- a/gcc/testsuite/gcc.target/avr/tiny-caller-save.c
+++ b/gcc/testsuite/gcc.target/avr/mmcu/tiny-caller-save.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target avr_tiny } } */
+/* { dg-do compile } */
/* { dg-options "-mmcu=avrtiny -gdwarf -Os" } */
/* This is a stripped down piece of libgcc2.c that triggerd an ICE for avr with
diff --git a/gcc/testsuite/gcc.target/avr/tiny-memx.c b/gcc/testsuite/gcc.target/avr/mmcu/tiny-memx.c
index f691dcf..cdda86b 100644
--- a/gcc/testsuite/gcc.target/avr/tiny-memx.c
+++ b/gcc/testsuite/gcc.target/avr/mmcu/tiny-memx.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target avr_tiny } } */
+/* { dg-do compile } */
/* { dg-options "-mmcu=avrtiny" } */
const __memx char ascmonth[] = "Jan"; /* { dg-error "not supported" } */