From patchwork Thu Dec 13 18:42:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [libstdc++,testsuite] Shrink tests for simulator Date: Thu, 13 Dec 2012 08:42:45 -0000 From: Steve Ellcey X-Patchwork-Id: 206206 Message-Id: <38b6f64f-7d11-48d8-90d1-9861917809ff@EXCHHUB01.MIPS.com> To: , 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 * 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 #include @@ -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 #include @@ -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 #include @@ -36,7 +42,7 @@ void test01() // cache the collate facets const collate& coll_c = use_facet >(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 #include @@ -36,7 +42,7 @@ void test01() // cache the collate facets const collate& coll_c = use_facet >(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());