Patchwork [libstdc++,testsuite] Shrink tests for simulator

login
register
mail settings
Submitter Steve Ellcey
Date Dec. 13, 2012, 6:42 p.m.
Message ID <38b6f64f-7d11-48d8-90d1-9861917809ff@EXCHHUB01.MIPS.com>
Download mbox | patch
Permalink /patch/206206/
State New
Headers show

Comments

Steve Ellcey - Dec. 13, 2012, 6:42 p.m.
I have been running the libstdc++ testsuite using the gnu simulator for
my mips-mti-elf target.  Some of the tests fail due to the amount of
memory they need and I would like to 'shrink' them when run on a 
simulator using the same technique I see other tests using.  These 
four tests aren't the only ones that fail for me but I wanted to send
this patch first to see if this approach was acceptable before changing
any more tests.

OK to checkin?

Steve Ellcey
sellcey@mips.com


2012-12-13  Steve Ellcey  <sellcey@mips.com>

	* 21_strings/basic_string/capacity/char/18654.cc: Shrink memory
	usage under simulator.
	* 21_strings/basic_string/capacity/wchar_t/18654.cc: Ditto.
	* 22_locale/collate/transform/char/28277.cc: Ditto.
	* 22_locale/collate/transform/wchar_t/28277.cc: Ditto.
Paolo Carlini - Dec. 13, 2012, 7:27 p.m.
Hi,

On 12/13/2012 07:42 PM, Steve Ellcey wrote:
> I have been running the libstdc++ testsuite using the gnu simulator for
> my mips-mti-elf target.  Some of the tests fail due to the amount of
> memory they need and I would like to 'shrink' them when run on a
> simulator using the same technique I see other tests using.  These
> four tests aren't the only ones that fail for me but I wanted to send
> this patch first to see if this approach was acceptable before changing
> any more tests.
It's the same approach that we are following in many other places, right?
> OK to checkin?
Yes, thanks.

Paolo.
Steve Ellcey - Dec. 13, 2012, 7:58 p.m.
On Thu, 2012-12-13 at 20:27 +0100, Paolo Carlini wrote:

> It's the same approach that we are following in many other places, right?

Yes, it is the same approach.

> > OK to checkin?
> Yes, thanks.

Done.

Steve Ellcey
sellcey@mips.com

Patch

diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
index e9fa200..78af79a 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
@@ -19,6 +19,12 @@ 
 
 // 21.3.3 string capacity
 
+// { dg-options "-DMAX_SIZE=16" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 20
+#endif
+
 #include <string>
 #include <testsuite_hooks.h>
 
@@ -34,7 +40,7 @@  void test01()
   // and shrink-to-fit (in the future, maybe this will change
   // for short strings).
   const size_type minsize = 2 << 0;
-  const size_type maxsize = 2 << 20;
+  const size_type maxsize = 2 << MAX_SIZE;
   for (size_type i = minsize; i <= maxsize; i *= 2)
     {
       string str(i, 'x');
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
index fd51175..df75f09 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
@@ -19,6 +19,12 @@ 
 
 // 21.3.3 string capacity
 
+// { dg-options "-DMAX_SIZE=16" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 20
+#endif
+
 #include <string>
 #include <testsuite_hooks.h>
 
@@ -34,7 +40,7 @@  void test01()
   // and shrink-to-fit (in the future, maybe this will change
   // for short strings).
   const size_type minsize = 2 << 0;
-  const size_type maxsize = 2 << 20;
+  const size_type maxsize = 2 << MAX_SIZE;
   for (size_type i = minsize; i <= maxsize; i *= 2)
     {
       wstring str(i, L'x');
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/char/28277.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/char/28277.cc
index bf8c494..7b94c7d 100644
--- a/libstdc++-v3/testsuite/22_locale/collate/transform/char/28277.cc
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/char/28277.cc
@@ -19,6 +19,12 @@ 
 
 // 22.2.4.1.1 collate members
 
+// { dg-options "-DMAX_SIZE=1000000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 10000000
+#endif
+
 #include <locale>
 #include <testsuite_hooks.h>
 
@@ -36,7 +42,7 @@  void test01()
   // cache the collate facets
   const collate<char>& coll_c = use_facet<collate<char> >(loc_c); 
 
-  const string_type sstr(10000000, 'a');
+  const string_type sstr(MAX_SIZE, 'a');
 
   const string_type dstr = coll_c.transform(sstr.data(),
 					    sstr.data() + sstr.size());
diff --git a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/28277.cc b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/28277.cc
index 4f21169..56ad605 100644
--- a/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/28277.cc
+++ b/libstdc++-v3/testsuite/22_locale/collate/transform/wchar_t/28277.cc
@@ -19,6 +19,12 @@ 
 
 // 22.2.4.1.1 collate members
 
+// { dg-options "-DMAX_SIZE=100000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 10000000
+#endif
+
 #include <locale>
 #include <testsuite_hooks.h>
 
@@ -36,7 +42,7 @@  void test01()
   // cache the collate facets
   const collate<wchar_t>& coll_c = use_facet<collate<wchar_t> >(loc_c); 
 
-  const string_type sstr(10000000, L'a');
+  const string_type sstr(MAX_SIZE, L'a');
 
   const string_type dstr = coll_c.transform(sstr.data(),
 					    sstr.data() + sstr.size());