[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Optimize test suite for all builds

From: Justin Erenkrantz <justin_at_erenkrantz.com>
Date: 2007-12-29 19:04:20 CET

We previously had a discussion about the fact that
SVN_SLEEP_FOR_TIMESTAMPS was made conditional on SVN_DEBUG (activated
by --enable-maintainer-mode). The consensus, from those who spoke up,
was that this admittedly wasn't an ideal solution.

Please see the patch below which always activates this code path and
renames the env-var to something long and obviously nasty. =)

The only thing I'm wondering is that if the result from getenv()
should be cached - it depends on how often svn_sleep_for_timestamps
gets called; but getenv() isn't a cheap function. If we think it's a
worthwhile optimization, I'll add it before committing. (I actually
wrote it up first with that optimization, but then decided that I'd
yank it before posting.)

Thoughts? Comments? If no one has any negative comments, I'll go
commit. -- justin

Make SVN_SLEEP_FOR_TIMESTAMPS always available, but under a 'scary' name:
"SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS".

This permits 'release' builds to run the test suite far faster (48mins down to
~5mins).

* subversion/libsvn_subr/time.c
  (SVN_SLEEP_ENV_VAR): define what our new name is.
  (svn_sleep_for_timestamps): Remove SVN_DEBUG ifdef; also flip meaning
  of env variable.
* subversion/tests/cmdline/svntest/actions.py
  (no_sleep_for_timestamps, do_sleep_for_timestamps): Update to new name and
  flip the meaning of the value per above.

Index: subversion/libsvn_subr/time.c
===================================================================
--- subversion/libsvn_subr/time.c (revision 28699)
+++ subversion/libsvn_subr/time.c (working copy)
@@ -80,6 +80,7 @@ static const char * const human_timestamp_format =
 /* Human explanatory part, generated by apr_strftime as "Sat, 01 Jan 2000" */
 #define human_timestamp_format_suffix _(" (%a, %d %b %Y)")

+#define SVN_SLEEP_ENV_VAR
"SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS"

 const char *
 svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
@@ -289,18 +290,15 @@ void
 svn_sleep_for_timestamps(void)
 {
   apr_time_t now, then;
+ char *sleep_env_var;

-#ifdef SVN_DEBUG
- const char *env_val = getenv("SVN_SLEEP_FOR_TIMESTAMPS");
+ sleep_env_var = getenv(SVN_SLEEP_ENV_VAR);

   /* Sleep until the next second tick, plus a tenth of a second for margin. */
- if (! env_val || apr_strnatcasecmp(env_val, "no") != 0)
+ if (! sleep_env_var || apr_strnatcasecmp(sleep_env_var, "yes") != 0)
     {
-#endif
       now = apr_time_now();
       then = apr_time_make(apr_time_sec(now) + 1, APR_USEC_PER_SEC / 10);
       apr_sleep(then - now);
-#ifdef SVN_DEBUG
     }
-#endif
 }
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py (revision 28699)
+++ subversion/tests/cmdline/svntest/actions.py (working copy)
@@ -24,10 +24,10 @@ import main, verify, tree, wc, parsers
 from svntest import Failure

 def no_sleep_for_timestamps():
- os.environ['SVN_SLEEP_FOR_TIMESTAMPS'] = 'no'
+ os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS']
= 'yes'

 def do_sleep_for_timestamps():
- os.environ['SVN_SLEEP_FOR_TIMESTAMPS'] = 'yes'
+ os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS']
= 'no'

 def setup_pristine_repository():
   """Create the pristine repository and 'svn import' the greek tree"""

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 29 19:04:32 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.