diff mbox

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

Message ID 5486DA30.5070600@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Dec. 9, 2014, 11:17 a.m. UTC
Hi all,

There are a few libstdc++ that don't fit into memory when the 
-mcmodel=tiny option is used.
For example 25_algorithms/random_shuffle/1.cc on aarch64 is a 5.5M 
binary on aarch64 with -mcmodel=small.

In the gcc and g++ testsuite we already catch such cases and mark them 
as UNSUPPORTED. In libstdc++.exp there is no such functionality.
This patch adds that check. I've implemented the v3_check_unsupported_p 
predicate the same way as it's implemented in the gcc testsuite.
I'm not very happy that it had to be copied, but I couldn't find a way 
to include the gcc definition sanely.

With this patch 8 tests that were previously FAILing on 
aarch64-none-elf/-mcmodel=tiny due to relocation truncation errors are 
now marked as UNSUPPORTED.

A test run on x86 didn't show any bad behaviour appearing.

Is this a sane approach to what I'm trying to solve?

Thanks,
Kyrill

2014-12-03  Kyrylo Tkachov  kyrylo.tkachov@arm.com\

      * testsuite/lib/libstdc++.exp (${tool}_check_unsupported_p):
      New procedure.
      (v3_target_compile): Check if test is unsupported.
      (v3_target_compile_as_c): Likewise.

Comments

Mike Stump Dec. 9, 2014, 8:14 p.m. UTC | #1
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.
diff mbox

Patch

diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 3d9913b..385ae07 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -343,6 +343,22 @@  proc libstdc++_exit { } {
     }
 }
 
+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 ""
+}
+
 # Callback from system dg-test.
 proc libstdc++-dg-test { prog do_what extra_tool_flags } {
     # Set up the compiler flags, based on what we're going to do.
@@ -455,6 +471,7 @@  proc v3_target_compile { source dest type options } {
     global cxxldflags
     global includes
     global STATIC_LIBCXXFLAGS
+    global tool
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -483,7 +500,14 @@  proc v3_target_compile { source dest type options } {
     lappend options "compiler=$cxx_final"
     lappend options "timeout=[timeout_value]"
 
-    return [target_compile $source $dest $type $options]
+    set comp_output [target_compile $source $dest $type $options]
+    set unsupported_message [${tool}_check_unsupported_p $comp_output]
+
+    if { $unsupported_message != "" } {
+      unsupported "$dest: $unsupported_message"
+      return ""
+    }
+    return $comp_output
 }
 
 
@@ -498,6 +522,7 @@  proc v3_target_compile_as_c { source dest type options } {
     global cc
     global cxxflags
     global STATIC_LIBCXXFLAGS
+    global tool
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -551,7 +576,14 @@  proc v3_target_compile_as_c { source dest type options } {
     lappend options "compiler=$cc_final"
     lappend options "timeout=[timeout_value]"
 
-    return [target_compile $source $dest $type $options]
+    set comp_output [target_compile $source $dest $type $options]
+    set unsupported_message [${tool}_check_unsupported_p $comp_output]
+
+    if { $unsupported_message != "" } {
+      unsupported "$dest: $unsupported_message"
+      return ""
+    }
+    return $comp_output
 }
 
 # Build the support objects linked in with the libstdc++ tests.  In