This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, libstdc++ testsuite] Shrink tests for simulator
- From: "Steve Ellcey " <sellcey at mips dot com>
- To: <libstdc++ at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Dec 2012 10:42:45 -0800
- Subject: [patch, libstdc++ testsuite] Shrink tests for simulator
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.
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());