summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-09 10:08:27 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-09 10:08:27 -0400
commit373bfd963090d412ff0a97cd9804c4e2a507f29e (patch)
tree10d08db3229a77ccdabf36ffb83b86871f54a144
parent7c521096410b23f234d299e344efe879ceae7643 (diff)
downloadtor-373bfd963090d412ff0a97cd9804c4e2a507f29e.tar.gz
tor-373bfd963090d412ff0a97cd9804c4e2a507f29e.zip
Make a couple more tests run faster.
The point of diminishing returns has been reached.
-rw-r--r--src/test/test_crypto.c4
-rw-r--r--src/test/test_threads.c20
2 files changed, 4 insertions, 20 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 3756fd047b..d83b93be58 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -999,11 +999,11 @@ test_crypto_sha3(void *arg)
crypto_digest_free(d1);
/* Attempt to exercise the incremental hashing code by creating a randomized
- * 100 KiB buffer, and hashing rand[1, 5 * Rate] bytes at a time. SHA3-512
+ * 30 KiB buffer, and hashing rand[1, 5 * Rate] bytes at a time. SHA3-512
* is used because it has a lowest rate of the family (the code is common,
* but the slower rate exercises more of it).
*/
- const size_t bufsz = 100 * 1024;
+ const size_t bufsz = 30 * 1024;
size_t j = 0;
large = tor_malloc(bufsz);
crypto_rand(large, bufsz);
diff --git a/src/test/test_threads.c b/src/test/test_threads.c
index 1bbe6f5508..ebbc95c7ca 100644
--- a/src/test/test_threads.c
+++ b/src/test/test_threads.c
@@ -87,11 +87,6 @@ test_threads_basic(void *arg)
char *s1 = NULL, *s2 = NULL;
int done = 0, timedout = 0;
time_t started;
-#ifndef _WIN32
- struct timeval tv;
- tv.tv_sec=0;
- tv.tv_usec=100*1000;
-#endif
(void) arg;
tt_int_op(tor_threadlocal_init(&count), OP_EQ, 0);
@@ -120,10 +115,8 @@ test_threads_basic(void *arg)
timedout = done = 1;
}
tor_mutex_release(thread_test_mutex_);
-#ifndef _WIN32
/* Prevent the main thread from starving the worker threads. */
- select(0, NULL, NULL, NULL, &tv);
-#endif
+ tor_sleep_msec(10);
}
tor_mutex_acquire(thread_test_start1_);
tor_mutex_release(thread_test_start1_);
@@ -286,16 +279,7 @@ test_threads_conditionvar(void *arg)
if (!timeout) {
tt_int_op(ti->n_shutdown, ==, 4);
} else {
-#ifdef _WIN32
- Sleep(500); /* msec */
-#elif defined(HAVE_USLEEP)
- usleep(500*1000); /* usec */
-#else
- {
- struct tv = { 0, 500*1000 };
- select(0, NULL, NULL, NULL, &tv);
- }
-#endif
+ tor_sleep_msec(200);
tor_mutex_acquire(ti->mutex);
tt_int_op(ti->n_shutdown, ==, 2);
tt_int_op(ti->n_timeouts, ==, 2);