Patchwork [libstdc++,testsuite] Fix simulator timouts.

login
register
mail settings
Submitter Steve Ellcey
Date Jan. 14, 2013, 6:40 p.m.
Message ID <eac4967e-e465-4208-83dc-68b8b2d8c3d2@EXCHHUB01.MIPS.com>
Download mbox | patch
Permalink /patch/211858/
State New
Headers show

Comments

Steve Ellcey - Jan. 14, 2013, 6:40 p.m.
Here is a patch for the last of the C++ library tests that fail for me when
run under the gnu simulator due to memory usage.

I am using the same define mechanism to shrink them when run on a simulator
as other tests are already using.

Tested on mips-mti-elf target with no regressions.

OK to checkin?

Steve Ellcey
sellcey@mips.com


2013-01-14  Steve Ellcey  <sellcey@mips.com>

	* testsuite/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc:
	Shrink memory usage under simulator.
	* testsuite/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc: Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/2.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/wchar_t/1.cc:
	Ditto.
	* testsuite/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc:
	Ditto.
Jonathan Wakely - Jan. 14, 2013, 8:14 p.m.
On 14 January 2013 18:40, Steve Ellcey wrote:
>
> Here is a patch for the last of the C++ library tests that fail for me when
> run under the gnu simulator due to memory usage.
>
> I am using the same define mechanism to shrink them when run on a simulator
> as other tests are already using.
>
> Tested on mips-mti-elf target with no regressions.
>
> OK to checkin?

The copyright dates in the tests should be 2013 (sorry to be a pain!)
OK with that change.

.

Patch

diff --git a/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc b/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc
index 1e9d01a..7806fb2 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc
@@ -1,6 +1,12 @@ 
 // Test vector: performance difference 25% (0.444s vs 0.539s)
 // Advice: set tmp as 10000
 
+// { dg-options "-DITERATIONS=20" { target simulator } }
+
+#ifndef ITERATIONS
+#define ITERATIONS 2000
+#endif
+
 #include <vector>
 
 using std::vector;
@@ -9,7 +15,7 @@  int main()
 {
   vector <int> tmp;
 
-  for (int j=0; j<2000; j++)
+  for (int j=0; j<ITERATIONS; j++)
     // Insert more than default item
     for (int i=0; i<10000; i++) {
       tmp.push_back(i);
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc
index 7e619c0..d14a6f1 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc
@@ -17,6 +17,12 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-options "-DMAX_SIZE=5000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 5000000
+#endif
+
 #include <valarray>
 #include <testsuite_hooks.h>
 
@@ -25,7 +31,7 @@  void test01()
 {
   bool test __attribute__((unused)) = true;
 
-  const std::valarray<int> v1(1, 5000000);
+  const std::valarray<int> v1(1, MAX_SIZE);
 
   const std::valarray<int> v2 = v1.shift(1);
   VERIFY( v2.size() == v1.size() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc
index 2e27c80..1b94684 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc
@@ -19,6 +19,12 @@ 
 
 // 27.6.1.2.3 basic_istream::operator>>
 
+// { dg-options "-DMAX_SIZE=466" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 666
+#endif
+
 #include <istream>
 #include <string>
 #include <fstream>
@@ -70,7 +76,7 @@  void test01()
   const char filename[] = "inserters_extractors-4.txt";
 
   const unsigned nchunks = 10;
-  const wstring data = prepare(666, nchunks);
+  const wstring data = prepare(MAX_SIZE, nchunks);
 
   wofstream ofstrm;
   ofstrm.open(filename);
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc b/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc
index 39fb595..cd97df5 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc
@@ -17,6 +17,12 @@ 
 
 // 27.6.1.3 unformatted input functions
 
+// { dg-options "-DMAX_LENGTH=7" { target simulator } }
+
+#ifndef MAX_LENGTH
+#define MAX_LENGTH 777
+#endif
+
 #include <istream>
 #include <string>
 #include <fstream>
@@ -68,7 +74,7 @@  void test01()
 
   const wchar_t delim = L'|';
   const unsigned nchunks = 10;
-  const wstring data = prepare(777, nchunks, delim);
+  const wstring data = prepare(MAX_LENGTH, nchunks, delim);
 
   wofstream ofstrm;
   ofstrm.open(filename);
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/2.cc
index 8a24210..519c038 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/2.cc
@@ -17,6 +17,12 @@ 
 
 // 27.6.1.3 unformatted input functions
 
+// { dg-options "-DMAX_SIZE=355" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 555
+#endif
+
 #include <istream>
 #include <string>
 #include <fstream>
@@ -67,7 +73,7 @@  void test01()
 
   const wchar_t delim = L'|';
   const unsigned nchunks = 10;
-  const wstring data = prepare(555, nchunks, delim);
+  const wstring data = prepare(MAX_SIZE, nchunks, delim);
 
   wofstream ofstrm;
   ofstrm.open(filename);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc
index d265864..20b2fe6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-1.cc
@@ -19,6 +19,12 @@ 
 
 // 27.6.2.5.4 basic_ostream character inserters
 
+// { dg-options "-DMAX_SIZE=50000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 5000000
+#endif
+
 #include <ostream>
 #include <sstream>
 #include <testsuite_hooks.h>
@@ -30,7 +36,7 @@  void test01()
   bool test __attribute__((unused)) = true;
 
   wostringstream oss_01;
-  const string str_01(5000000, 'a');
+  const string str_01(MAX_SIZE, 'a');
 
   oss_01 << str_01.c_str();
 
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc
index 6280fa1..cf866fd 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc
@@ -19,6 +19,12 @@ 
 
 // 27.6.2.5.4 basic_ostream character inserters
 
+// { dg-options "-DMAX_SIZE=50000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 5000000
+#endif
+
 #include <ostream>
 #include <sstream>
 #include <testsuite_hooks.h>
@@ -32,7 +38,7 @@  void test01()
   wostringstream oss_01;
   const string str_01(50, 'a');
 
-  oss_01.width(5000000);
+  oss_01.width(MAX_SIZE);
   const streamsize width = oss_01.width();
 
   oss_01 << str_01.c_str();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/wchar_t/1.cc
index 0d3ea89..d8e831b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/overflow/wchar_t/1.cc
@@ -19,6 +19,12 @@ 
 
 // 27.7.1.3 basic_stringbuf overridden virtual functions.
 
+// { dg-options "-DMAX_SIZE=100000" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE 10000000
+#endif
+
 #include <sstream>
 #include <cstdlib>
 #include <testsuite_hooks.h>
@@ -51,6 +57,6 @@  test01(unsigned iter)
 
 int main()
 {
-  test01(10000000);
+  test01(MAX_SIZE);
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc
index c6c966d..ee28071 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc
@@ -19,6 +19,12 @@ 
 
 // 27.8.1.4 Overridden virtual functions
 
+// { dg-options "-DMAX_SIZE=4096" { target simulator } }
+
+#ifndef MAX_SIZE
+#define MAX_SIZE (1 << 18)
+#endif
+
 #include <sstream>
 #include <testsuite_hooks.h>
 
@@ -27,7 +33,7 @@  void test01()
   using namespace std;
   bool test __attribute__((unused)) = true;
 
-  const unsigned max_size = 1 << 18;
+  const unsigned max_size = MAX_SIZE;
 
   static wchar_t ref[max_size];
   wmemset(ref, L'\0', max_size);