diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-18 06:12:19 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-18 06:12:19 +0000 |
commit | 290b6f54a349d8b7d66b2861faf8de7b4e17ceda (patch) | |
tree | b5f1e52c2c0cb16f7500d4848884becec5bb05d7 /src | |
parent | 8ba2a15a49fced7886dfd4e72420412066c7f4db (diff) | |
download | tor-290b6f54a349d8b7d66b2861faf8de7b4e17ceda.tar.gz tor-290b6f54a349d8b7d66b2861faf8de7b4e17ceda.zip |
Make unit tests slower but more reliable by disabling an old optimization.
To turn it back on, re-define CACHE_GENERATED_KEYS option in test.c.
svn:r17677
Diffstat (limited to 'src')
-rw-r--r-- | src/or/test.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c index 30042621d4..2fa2aac12e 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -106,16 +106,27 @@ remove_directory(void) rmdir(temp_dir); } +/** Define this if unit tests spend too much time generating public keys*/ +#undef CACHE_GENERATED_KEYS + static crypto_pk_env_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL}; static crypto_pk_env_t * pk_generate(int idx) { +#ifdef CACHE_GENERATED_KEYS tor_assert(idx < (int)(sizeof(pregen_keys)/sizeof(pregen_keys[0]))); if (! pregen_keys[idx]) { pregen_keys[idx] = crypto_new_pk_env(); tor_assert(!crypto_pk_generate_key(pregen_keys[idx])); } return crypto_pk_dup_key(pregen_keys[idx]); +#else + crypto_pk_env_t *result; + (void) idx; + result = crypto_new_pk_env(); + tor_assert(!crypto_pk_generate_key(result)); + return result; +#endif } static void |