>From ff022f46d098098bc17100332e2c96ebef715dff Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Tue, 29 May 2012 11:58:02 +0200 Subject: [PATCH] perf: beginning of a performance testsuite Some tests in the Automake testsuite already aims only at verifying the performance, rather than the correctness, of some operations. Still, they are somewhat shoehorned and forced into the PASS/FAIL framework (say, with the 'ulimit' shell builtin used to verify some operation doesn't take up too much time or memory), but that is conceptually a stretch, and has already caused problems in practice (see automake bug#11512 for an example). So we start moving the "performance tests" out of the testsuite proper, and make them run only "on demand" (when the user exports the variable 'AM_TESTSUITE_PERF' to "yes"). Ideally, we should provide those tests with a custom runner/driver that measures and displays the relevant performance information, but doing that correctly and with the right APIs is definitely more difficult, so we leave it for a later step (an hope we'll take such a step eventually). * t/cond29.sh: Move ... * t/perf/cond.sh: ... here, and adjust. * t/testsuite-recheck-speed.sh: Move ... * t/perf/testsuite-recheck.sh: ... here. * t/testsuite-summary-speed.sh: Move ... * t/perf/testsuite-summary.sh: ... here. * t/list-of-tests.mk (perf_TESTS): New variable, listing the tests in the 't/perf' directory. (handwritten_TESTS): Adjust. * defs: Skip any tests in the 't/perf/' subdirectory unless the 'AM_TESTSUITE_PERF' variable is set to "yes" or "y". * .gitignore: Update. Signed-off-by: Stefano Lattarini --- .gitignore | 2 ++ defs | 10 ++++++++++ t/list-of-tests.mk | 9 ++++++--- t/{cond29.sh => perf/cond.sh} | 7 ------- .../testsuite-recheck.sh} | 0 .../testsuite-summary.sh} | 0 6 files changed, 18 insertions(+), 10 deletions(-) rename t/{cond29.sh => perf/cond.sh} (80%) rename t/{testsuite-recheck-speed.sh => perf/testsuite-recheck.sh} (100%) rename t/{testsuite-summary-speed.sh => perf/testsuite-summary.sh} (100%) diff --git a/.gitignore b/.gitignore index 78b7aff..130b390 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,8 @@ /t/*.trs /t/pm/*.log /t/pm/*.trs +/t/perf/*.log +/t/perf/*.trs cscope.files cscope.in.out cscope.out diff --git a/defs b/defs index 24d3fd2..612855e 100644 --- a/defs +++ b/defs @@ -730,6 +730,16 @@ require_compiler_ () ## required by them. ## ## ----------------------------------------------------------- ## +# Performance tests must be enabled explicitly. +case $argv0 in + */perf/*) + case $AM_TESTSUITE_PERF in + [yY]|[yY]es|1) ;; + *) skip_ "performance tests not explicitly enabled" ;; + esac + ;; +esac + # Look for (and maybe set up) required tools and/or system features; skip # the current test if they are not found. for tool in : $required diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index e9f8d23..52bdaf9 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -61,6 +61,11 @@ t/pm/Version2.pl \ t/pm/Version3.pl \ t/pm/Wrap.pl +perf_TESTS = \ +t/perf/cond.sh \ +t/perf/testsuite-recheck.sh \ +t/perf/testsuite-summary.sh + # The order here is mostly alphabetical, with the deliberate exception # that tests having a high runtime (especially TAP tests that run various # checks sequentially) are listed early; this improves performance on @@ -68,6 +73,7 @@ t/pm/Wrap.pl handwritten_TESTS = \ t/get-sysconf.sh \ $(perl_TESTS) \ +$(perf_TESTS) \ t/instspc.tap \ t/aclocal.sh \ t/aclocal3.sh \ @@ -275,7 +281,6 @@ t/cond25.sh \ t/cond26.sh \ t/cond27.sh \ t/cond28.sh \ -t/cond29.sh \ t/cond30.sh \ t/cond31.sh \ t/cond32.sh \ @@ -785,8 +790,6 @@ t/testsuite-summary-color.sh \ t/testsuite-summary-count.sh \ t/testsuite-summary-count-many.sh \ t/testsuite-summary-reference-log.sh \ -t/testsuite-recheck-speed.sh \ -t/testsuite-summary-speed.sh \ t/test-driver-acsubst.sh \ t/test-driver-cond.sh \ t/test-driver-custom-no-extra-driver.sh \ diff --git a/t/cond29.sh b/t/perf/cond.sh similarity index 80% rename from t/cond29.sh rename to t/perf/cond.sh index ee9bf9b..7c8261e 100755 --- a/t/cond29.sh +++ b/t/perf/cond.sh @@ -32,13 +32,6 @@ EOF # to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS, # a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap, # or cpu time it can found. -# Limit memory available to spawned processes to ~ 150 MB. Considering -# that 70 MB is enough for x86_64 Fedora 16, that gives tools and -# libraries plenty of room to grow. Suggested by Jim Meyering in -# automake bug#10374. -(ulimit -v 1; sh -c ":") && skip_ "no adequate 'ulimit' builtin found" -(ulimit -v 150000; sh -c ":") || skip_ "no adequate 'ulimit' builtin found" -ulimit -v 150000 for i in \ 01 02 03 04 05 06 07 08 09 10 \ diff --git a/t/testsuite-recheck-speed.sh b/t/perf/testsuite-recheck.sh similarity index 100% rename from t/testsuite-recheck-speed.sh rename to t/perf/testsuite-recheck.sh diff --git a/t/testsuite-summary-speed.sh b/t/perf/testsuite-summary.sh similarity index 100% rename from t/testsuite-summary-speed.sh rename to t/perf/testsuite-summary.sh -- 1.7.9.5