diff mbox

[libstdc++,testsuite] Mark as UNSUPPORTED tests that don't fit into tiny memory model

Message ID 54888B5A.8060700@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Dec. 10, 2014, 6:05 p.m. UTC
On 09/12/14 20:14, Mike Stump wrote:
> On Dec 9, 2014, at 3:17 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>> In the gcc and g++ testsuite we already catch such cases and mark them as UNSUPPORTED. In libstdc++.exp there is no such functionality.
>> I'm not very happy that it had to be copied, but I couldn't find a way to include the gcc definition sanely.
>> Is this a sane approach to what I'm trying to solve?
> Ok.
>
> If you would like, you can try and pull the common parts out into a new file, and include (load) that file from the two places that currently do that.  If they are exactly identical, should be trivial enough.  If not exactly the same, I’d do two patches, once to make them the same, then, the second one to split them out.

Thanks for the guidance. I've moved the definitions into a separate file 
and included that in the places that use it (more than 2 places in my 
count). This is the patch attached.

The second patch (will send shortly after this) adds the logic to libstdc++.

Ok?

Kyrilll


2014-12-10  Kyrylo Tkachov  kyrylo.tkachov@arm.com

     * lib/target-utils.exp: New file.
     * lib/gcc-defs.exp (${tool}_check_unsupported_p): Delete.
     Include target-utils.exp.
     * lib/objc.exp: Likewise.
     * lib/mike-gcc.exp: Load target-utils.exp.
     * lib/mike-g++.exp: Likewise.
     * lib/go-torture.exp: Likewise.
     * lib/fortran-torture.exp: Likewise.
     * lib/c-torture.exp: Likewise.

Comments

Mike Stump Dec. 10, 2014, 10:18 p.m. UTC | #1
On Dec 10, 2014, at 10:05 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Thanks for the guidance. I've moved the definitions into a separate file and included that in the places that use it (more than 2 places in my count). This is the patch attached.

> The second patch (will send shortly after this) adds the logic to libstdc++.
> 
> Ok?

Ok.

If anyone else wants to refactor annoying to maintain code into a single place…  certainly the legacy of cut-n-paste programming is alive and well in the *.exp files.  It was never a design goal to replicate annoying to maintain code.  :-)
Kyrylo Tkachov Dec. 11, 2014, 9:32 a.m. UTC | #2
On 10/12/14 22:18, Mike Stump wrote:
> On Dec 10, 2014, at 10:05 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>> Thanks for the guidance. I've moved the definitions into a separate file and included that in the places that use it (more than 2 places in my count). This is the patch attached.
>> The second patch (will send shortly after this) adds the logic to libstdc++.
>>
>> Ok?
> Ok.
>
> If anyone else wants to refactor annoying to maintain code into a single place…  certainly the legacy of cut-n-paste programming is alive and well in the *.exp files.  It was never a design goal to replicate annoying to maintain code.  :-)

Thanks,
and the patch that adds the libstdc++.exp changes at 
https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00952.html using the new 
target-utils.exp file is ok too then?

Cheers,
Kyrill

>
Mike Stump Dec. 11, 2014, 11:19 p.m. UTC | #3
On Dec 11, 2014, at 1:32 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>  the patch that adds the libstdc++.exp changes at https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00952.html using the new target-utils.exp file is ok too then?

Ok.
Andreas Schwab Dec. 12, 2014, 8:34 a.m. UTC | #4
Kyrill Tkachov <kyrylo.tkachov@arm.com> writes:

>     * lib/target-utils.exp: New file.

ERROR: Couldn't find library file target-utils.exp.
make[4]: *** [check-DEJAGNU] Error 1
make[4]: Leaving directory `/usr/local/gcc/gcc-20141212/Build/ia64-suse-linux/libgomp/testsuite'
make[3]: *** [check-am] Error 2

Andreas.
Kyrylo Tkachov Dec. 12, 2014, 10:22 a.m. UTC | #5
On 12/12/14 08:34, Andreas Schwab wrote:
> Kyrill Tkachov <kyrylo.tkachov@arm.com> writes:
>
>>      * lib/target-utils.exp: New file.
> ERROR: Couldn't find library file target-utils.exp.
> make[4]: *** [check-DEJAGNU] Error 1
> make[4]: Leaving directory `/usr/local/gcc/gcc-20141212/Build/ia64-suse-linux/libgomp/testsuite'
> make[3]: *** [check-am] Error 2

Ugh, sorry for that, reproduced.
  DejaGNU (Tcl?) doesn't do recursive loads :(.
The quick solution is to load target-utils.exp explicitly in libgomp.exp

I'll post a patch shortly.

Kyrill

>
> Andreas.
>
diff mbox

Patch

commit e0a9ae608b48901cc97efa21ac330c6b0dcf8110
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Wed Dec 3 10:33:44 2014 +0000

    [libstdc++][testsuite] Check for programs not fitting into tiny memory models

diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp
index fde76fd..3e33962 100644
--- a/gcc/testsuite/lib/c-torture.exp
+++ b/gcc/testsuite/lib/c-torture.exp
@@ -19,6 +19,7 @@ 
 load_lib target-supports.exp
 load_lib file-format.exp
 load_lib target-libpath.exp
+load_lib target-utils.exp
 
 # The default option list can be overridden by
 # TORTURE_OPTIONS="{ { list1 } ... { listN } }"
diff --git a/gcc/testsuite/lib/fortran-torture.exp b/gcc/testsuite/lib/fortran-torture.exp
index e7abac8..cbc3427 100644
--- a/gcc/testsuite/lib/fortran-torture.exp
+++ b/gcc/testsuite/lib/fortran-torture.exp
@@ -22,6 +22,7 @@ 
 
 load_lib target-supports.exp
 load_lib fortran-modules.exp
+load_lib target-utils.exp
 
 # Return the list of options to use for fortran torture tests.
 # The default option list can be overridden by
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index d479667..a9c0d61 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -18,6 +18,8 @@  load_lib target-libpath.exp
 
 load_lib wrapper.exp
 
+load_lib target-utils.exp
+
 #
 # ${tool}_check_compile -- Reports and returns pass/fail for a compilation
 #
@@ -145,34 +147,6 @@  proc ${tool}_exit { } {
 	unset gluefile
     }
 }
-    
-#
-# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output 
-#	for text indicating that the testcase should be marked as "unsupported"
-#
-# Utility used by mike-gcc.exp and c-torture.exp.
-# When dealing with a large number of tests, it's difficult to weed out the
-# ones that are too big for a particular cpu (eg: 16 bit with a small amount
-# of memory).  There are various ways to deal with this.  Here's one.
-# Fortunately, all of the cases where this is likely to happen will be using
-# gld so we can tell what the error text will look like.
-#
-
-proc ${tool}_check_unsupported_p { output } {
-    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
-	return "memory full"
-    }
-    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output]
-          && [check_effective_target_tiny] } {
-        return "memory full"
-     }
-
-    if { [istarget spu-*-*] && \
-	     [string match "*exceeds local store*" $output] } {
-	return "memory full"
-    }
-    return ""
-}
 
 #
 # runtest_file_p -- Provide a definition for older dejagnu releases
diff --git a/gcc/testsuite/lib/go-torture.exp b/gcc/testsuite/lib/go-torture.exp
index d37d475..fc2f559 100644
--- a/gcc/testsuite/lib/go-torture.exp
+++ b/gcc/testsuite/lib/go-torture.exp
@@ -22,6 +22,8 @@ 
 
 load_lib target-supports.exp
 
+load_lib target-utils.exp
+
 # The default option list can be overridden by
 # TORTURE_OPTIONS="{ { list1 } ... { listN } }"
 
diff --git a/gcc/testsuite/lib/mike-g++.exp b/gcc/testsuite/lib/mike-g++.exp
index d5f31a8..e60dff8 100644
--- a/gcc/testsuite/lib/mike-g++.exp
+++ b/gcc/testsuite/lib/mike-g++.exp
@@ -16,6 +16,8 @@ 
 
 # This file was written by Mike Stump <mrs@cygnus.com>
 
+load_lib target-utils.exp
+
 #
 # mike_cleanup -- remove any files that are created by the testcase
 #
diff --git a/gcc/testsuite/lib/mike-gcc.exp b/gcc/testsuite/lib/mike-gcc.exp
index 68cca23..b2705e6 100644
--- a/gcc/testsuite/lib/mike-gcc.exp
+++ b/gcc/testsuite/lib/mike-gcc.exp
@@ -16,6 +16,8 @@ 
 
 # This file was derived from mike-g++.exp written by Mike Stump <mrs@cygnus.com>
 
+load_lib target-utils.exp
+
 #
 # mike_cleanup -- remove any files that are created by the testcase
 #
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index c0b4da7..976ef87 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -29,6 +29,7 @@  load_lib prune.exp
 load_lib gcc-defs.exp
 load_lib timeout.exp
 load_lib target-libpath.exp
+load_lib target-utils.exp
 
 #
 # OBJC_UNDER_TEST is the compiler under test.
@@ -343,27 +344,6 @@  if { [info procs prune_warnings] == "" } then {
     }
 }
 
-# Utility used by mike-gcc.exp and c-torture.exp.
-# Check the compiler(/assembler/linker) output for text indicating that
-# the testcase should be marked as "unsupported".
-#
-# When dealing with a large number of tests, it's difficult to weed out the
-# ones that are too big for a particular cpu (eg: 16 bit with a small amount
-# of memory).  There are various ways to deal with this.  Here's one.
-# Fortunately, all of the cases where this is likely to happen will be using
-# gld so we can tell what the error text will look like.
-
-proc ${tool}_check_unsupported_p { output } {
-    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
-	return "memory full"
-    }
-    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output]
-          && [check_effective_target_tiny] } {
-        return "memory full"
-    }
-    return ""
-}
-
 # Prune messages from objc that aren't useful.
 
 proc prune_objc_output { text } {
diff --git a/gcc/testsuite/lib/target-utils.exp b/gcc/testsuite/lib/target-utils.exp
new file mode 100644
index 0000000..1f52adb
--- /dev/null
+++ b/gcc/testsuite/lib/target-utils.exp
@@ -0,0 +1,44 @@ 
+# Copyright (C) 2014 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/>.
+
+#
+# ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output
+# for text indicating that the testcase should be marked as "unsupported"
+#
+# When dealing with a large number of tests, it's difficult to weed out the
+# ones that are too big for a particular cpu (eg: 16 bit with a small amount
+# of memory).  There are various ways to deal with this.  Here's one.
+# Fortunately, all of the cases where this is likely to happen will be using
+# gld so we can tell what the error text will look like.
+#
+
+load_lib target-supports.exp
+
+proc ${tool}_check_unsupported_p { output } {
+    if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
+	return "memory full"
+    }
+    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output]
+          && [check_effective_target_tiny] } {
+        return "memory full"
+     }
+
+    if { [istarget spu-*-*] && \
+	     [string match "*exceeds local store*" $output] } {
+	return "memory full"
+    }
+    return ""
+}