This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix PR48675: 20_util/hash/chi2_quality.cc timeout for simulator targets


See PR48675 for details.  It also mentions a secondary issue, a
performance regression introduced in 172607:172613 after an
improvement introduced in 172417:172431.

If you look at the test, it has this nice line,
// { dg-options "-std=gnu++0x -DSAMPLES=10000" { target simulator } }
(the default SAMPLES being 300000), which makes you think that
it's all parametrized to not time-out for runs on a simulator.
That SAMPLES value is actually the lowest limit; if you lower
that number, the test will actually fail with an assert at line 101!

Anyway, the remaining dominating part of the test isn't
parametrized at all (neither rightly or wrongly), as seen in the
patch.  With the patch applied, the test runs in about 30
seconds.  Without the patch, the test runs for 620..630 seconds,
and so times out with the testsuite harness timeout of 600
seconds.

Considering that this test is just a part of a generic test, I
don't see much point in trying to parametrize it; better to just
skip it for low SAMPLES values.  With the default SAMPLES being
300000 and the file being 187587 lines (words), it seems
appropriate to put the limit at SAMPLES < 100000.

I have not looked further for similar test issues.

Ok to commit, trunk as well as older branches?

libstdc++-v3:
	* testsuite/20_util/hash/chi2_quality.cc (test_document_words): Stub
	this part if SAMPLES < 100000.

Index: testsuite/20_util/hash/chi2_quality.cc
===================================================================
--- testsuite/20_util/hash/chi2_quality.cc	(revision 172667)
+++ testsuite/20_util/hash/chi2_quality.cc	(working copy)
@@ -183,6 +183,10 @@ test_bit_string_set()
 void
 test_document_words()
 {
+  // That file is 187587 single-word lines.  To avoid a timeout, just skip
+  // this part, which would take up to 95% of the program runtime (with
+  // SAMPLES == 10000), if we're not supposed to run anywhere that long.
+#if SAMPLES >= 100000
   bool test __attribute__((unused)) = true;
   const std::string f_name = "thirty_years_among_the_dead_preproc.txt";
   std::ifstream in(f_name);
@@ -199,6 +203,7 @@ test_document_words()
   const unsigned long k = words.size() / 20;
   double chi2 = chi2_hash(words, k);
   VERIFY( chi2 < k*1.1 );
+#endif
 }
 
 int

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]