diff mbox

[testsuite] Skip long-running tests by default

Message ID yddtym05d9e.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Sept. 8, 2010, 5:57 p.m. UTC
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> This is a follow-up to the discussion in
>
> 	[testsuite] Increase gcc.dg/pr43058.c timeout
> 	http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01162.html
>
> Instead of moving long-running tests to a separate testsuite (which
> would have to deal with at least C, C++, and Fortran tests), I've
> decided to make use of the effective-target mechanism to tag a testcase
> as CPU hog and avoid running it by default.
>
> I'm tagging hogs with dg-require-effective-target run_cpuhogs; tests so
> tagged are only run if the RUN_CPUHOGS environment variable is
> non-empty, so if testers decide they want to spend the CPU cycles, they
> are free to do so :-)
>
> For the moment, I'm only tagging limits-fnargs.c, the worst offender by
> far, but others could be added if desired.
>
> Tested with the appropriate runtest invocation both with and without
> RUN_CPUHOGS set on i386-pc-solaris2.11.
>
> Ok for mainline, 4.4 and 4.5 branches?

Mark approved the patch in private mail, requesting two changes:

* Avoid the cpuhogs colloquialism and call the effective-target keyword
  run_expensive_tests instead.

* Use an environment variable that is in some sort of GCC namespace:
  GCC_TEST_RUN_EXPENSIVE.  It proved to not be easily possible to check
  if the env variable was set at all because the the getenv proc from
  dejagnu (in share/utils.exp) uses the empty string to signal an unset
  variable, so I'm require it to be set to any non-empty string instead.

Here's what I've checked into mainline after checking the modifications
with the appropriate runtest invocation.  Will backport to the 4.4 and
4.5 branches after some soaktime on mainline.

	Rainer


2010-08-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* doc/sourcebuild.texi (Effective-Target Keywords): Document
	run_expensive_tests.

	gcc/testsuite:
	* lib/target-supports.exp
	(check_effective_target_run_expensive_tests): New proc.
	* gcc.c-torture/compile/limits-fnargs.c: Use
	dg-require-effective-target run_expensive_tests.
diff mbox

Patch

diff -r 2b5869ab2dd5 gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi	Wed Sep 08 11:03:14 2010 +0200
+++ b/gcc/doc/sourcebuild.texi	Wed Sep 08 19:46:19 2010 +0200
@@ -1680,6 +1680,11 @@ 
 @item pthread_h
 Target has @code{pthread.h}.
 
+@item run_expensive_tests
+Expensive testcases (usually those that consume excessive amounts of CPU
+time) should be run on this target.  This can be enabled by setting the
+@env{GCC_TEST_RUN_EXPENSIVE} environment variable to a non-empty string.
+
 @item simulator
 Test system runs executables on a simulator (i.e. slowly) rather than
 hardware (i.e. fast).
diff -r 2b5869ab2dd5 gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c
--- a/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c	Wed Sep 08 11:03:14 2010 +0200
+++ b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c	Wed Sep 08 19:46:19 2010 +0200
@@ -1,4 +1,5 @@ 
 /* { dg-timeout-factor 4.0 } */
+/* { dg-require-effective-target run_expensive_tests } */
 
 #define PAR1 int, int, int, int, int, int, int, int, int, int
 #define PAR2 PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1
diff -r 2b5869ab2dd5 gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp	Wed Sep 08 11:03:14 2010 +0200
+++ b/gcc/testsuite/lib/target-supports.exp	Wed Sep 08 19:46:19 2010 +0200
@@ -3579,3 +3579,12 @@ 
     }
  return 0
 }
+
+# Return 1 if expensive testcases should be run.
+
+proc check_effective_target_run_expensive_tests { } {
+    if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
+        return 1
+    }
+    return 0
+}