summaryrefslogtreecommitdiff
path: root/testcode
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2015-12-12 22:18:57 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2015-12-12 22:18:57 +0000
commita7af7146c91c816cb83e0c5812eca7019531acb5 (patch)
tree6e64b645522115b817ba7eabd4e4ce58f129e8c7 /testcode
parent835a7e7a4dd68819f7610dafdf9277d3852aef6a (diff)
downloadsrc-test2-a7af7146c91c816cb83e0c5812eca7019531acb5.tar.gz
src-test2-a7af7146c91c816cb83e0c5812eca7019531acb5.zip
Notes
Diffstat (limited to 'testcode')
-rw-r--r--testcode/checklocks.c25
-rw-r--r--testcode/fake_event.c2
-rw-r--r--testcode/lock_verify.c3
-rw-r--r--testcode/testbound.c4
-rw-r--r--testcode/testpkts.h2
-rw-r--r--testcode/unitlruhash.c2
-rw-r--r--testcode/unitmain.c2
-rw-r--r--testcode/unitslabhash.c2
-rw-r--r--testcode/unitverify.c4
9 files changed, 30 insertions, 16 deletions
diff --git a/testcode/checklocks.c b/testcode/checklocks.c
index 5815e4fd0887..dab98491e224 100644
--- a/testcode/checklocks.c
+++ b/testcode/checklocks.c
@@ -430,7 +430,7 @@ finish_acquire_lock(struct thr_check* thr, struct checked_lock* lock,
* @param timedfunc: the pthread_mutex_timedlock or similar function.
* Uses absolute timeout value.
* @param arg: what to pass to tryfunc and timedlock.
- * @param exclusive: if lock must be exlusive (only one allowed).
+ * @param exclusive: if lock must be exclusive (only one allowed).
* @param getwr: if attempts to get writelock (or readlock) for rwlocks.
*/
static void
@@ -502,6 +502,8 @@ void
checklock_rdlock(enum check_lock_type type, struct checked_lock* lock,
const char* func, const char* file, int line)
{
+ if(key_deleted)
+ return;
log_assert(type == check_lock_rwlock);
checklock_lockit(type, lock, func, file, line,
@@ -520,6 +522,8 @@ void
checklock_wrlock(enum check_lock_type type, struct checked_lock* lock,
const char* func, const char* file, int line)
{
+ if(key_deleted)
+ return;
log_assert(type == check_lock_rwlock);
checklock_lockit(type, lock, func, file, line,
try_wr, timed_wr, &lock->u.rwlock, 0, 1);
@@ -555,6 +559,8 @@ void
checklock_lock(enum check_lock_type type, struct checked_lock* lock,
const char* func, const char* file, int line)
{
+ if(key_deleted)
+ return;
log_assert(type != check_lock_rwlock);
switch(type) {
case check_lock_mutex:
@@ -577,8 +583,10 @@ void
checklock_unlock(enum check_lock_type type, struct checked_lock* lock,
const char* func, const char* file, int line)
{
- struct thr_check *thr = (struct thr_check*)pthread_getspecific(
- thr_debug_key);
+ struct thr_check *thr;
+ if(key_deleted)
+ return;
+ thr = (struct thr_check*)pthread_getspecific(thr_debug_key);
checktype(type, lock, func, file, line);
if(!thr) lock_error(lock, func, file, line, "no thread info");
@@ -755,7 +763,8 @@ static void
lock_debug_info(struct checked_lock* lock)
{
if(!lock) return;
- log_info("+++ Lock %x, %d %d create %s %s %d", (int)lock,
+ log_info("+++ Lock %llx, %d %d create %s %s %d",
+ (unsigned long long)(size_t)lock,
lock->create_thread, lock->create_instance,
lock->create_func, lock->create_file, lock->create_line);
log_info("lock type: %s",
@@ -790,8 +799,9 @@ thread_debug_info(struct thr_check* thr)
struct checked_lock* l = NULL;
if(!thr) return;
log_info("pthread id is %x", (int)thr->id);
- log_info("thread func is %x", (int)thr->func);
- log_info("thread arg is %x (%d)", (int)thr->arg,
+ log_info("thread func is %llx", (unsigned long long)(size_t)thr->func);
+ log_info("thread arg is %llx (%d)",
+ (unsigned long long)(size_t)thr->arg,
(thr->arg?*(int*)thr->arg:0));
log_info("thread num is %d", thr->num);
log_info("locks created %d", thr->locks_created);
@@ -801,7 +811,8 @@ thread_debug_info(struct thr_check* thr)
w = thr->waiting;
f = thr->holding_first;
l = thr->holding_last;
- log_info("thread waiting for a lock: %s %x", w?"yes":"no", (int)w);
+ log_info("thread waiting for a lock: %s %llx", w?"yes":"no",
+ (unsigned long long)(size_t)w);
lock_debug_info(w);
log_info("thread holding first: %s, last: %s", f?"yes":"no",
l?"yes":"no");
diff --git a/testcode/fake_event.c b/testcode/fake_event.c
index 4335a8f220b7..e371cfdaabcd 100644
--- a/testcode/fake_event.c
+++ b/testcode/fake_event.c
@@ -569,7 +569,7 @@ do_infra_rtt(struct replay_runtime* runtime)
free(dp);
}
-/** perform exponential backoff on the timout */
+/** perform exponential backoff on the timeout */
static void
expon_timeout_backoff(struct replay_runtime* runtime)
{
diff --git a/testcode/lock_verify.c b/testcode/lock_verify.c
index a46d5d99ea93..786d523c3118 100644
--- a/testcode/lock_verify.c
+++ b/testcode/lock_verify.c
@@ -44,6 +44,9 @@
*/
#include "config.h"
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
#include "util/log.h"
#include "util/rbtree.h"
#include "util/locks.h"
diff --git a/testcode/testbound.c b/testcode/testbound.c
index b297f477476e..d908150a017b 100644
--- a/testcode/testbound.c
+++ b/testcode/testbound.c
@@ -35,7 +35,7 @@
*/
/**
* \file
- * Exits with code 1 on a failure. 0 if all unit tests are successfull.
+ * Exits with code 1 on a failure. 0 if all unit tests are successful.
*/
#include "config.h"
@@ -286,7 +286,7 @@ main(int argc, char* argv[])
testbound_selftest();
exit(0);
case '2':
-#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS)) && defined(USE_SHA2)
+#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
printf("SHA256 supported\n");
exit(0);
#else
diff --git a/testcode/testpkts.h b/testcode/testpkts.h
index 864f33fee6dc..5c000546fed6 100644
--- a/testcode/testpkts.h
+++ b/testcode/testpkts.h
@@ -214,7 +214,7 @@ void delete_entry(struct entry* list);
* @param in: file to read from. Filepos must be at the start of a new line.
* @param name: name of the file for prettier errors.
* @param pstate: file parse state with lineno, default_ttl,
- * oirigin and prev_rr name.
+ * origin and prev_rr name.
* @param skip_whitespace: skip leftside whitespace.
* @return: The entry read (malloced) or NULL if no entry could be read.
*/
diff --git a/testcode/unitlruhash.c b/testcode/unitlruhash.c
index 32d29d0af2bf..28fc617f4676 100644
--- a/testcode/unitlruhash.c
+++ b/testcode/unitlruhash.c
@@ -359,7 +359,7 @@ testlookup_unlim(struct lruhash* table, testdata_t** ref)
static void
test_long_table(struct lruhash* table)
{
- /* assuming it all fits in the hastable, this check will work */
+ /* assuming it all fits in the hashtable, this check will work */
testdata_t* ref[HASHTESTMAX * 100];
size_t i;
memset(ref, 0, sizeof(ref));
diff --git a/testcode/unitmain.c b/testcode/unitmain.c
index 09ebba329821..0b32dcd86903 100644
--- a/testcode/unitmain.c
+++ b/testcode/unitmain.c
@@ -36,7 +36,7 @@
/**
* \file
* Unit test main program. Calls all the other unit tests.
- * Exits with code 1 on a failure. 0 if all unit tests are successfull.
+ * Exits with code 1 on a failure. 0 if all unit tests are successful.
*/
#include "config.h"
diff --git a/testcode/unitslabhash.c b/testcode/unitslabhash.c
index b4a5048e654d..783468883572 100644
--- a/testcode/unitslabhash.c
+++ b/testcode/unitslabhash.c
@@ -242,7 +242,7 @@ testlookup_unlim(struct slabhash* table, testdata_t** ref)
static void
test_long_table(struct slabhash* table)
{
- /* assuming it all fits in the hastable, this check will work */
+ /* assuming it all fits in the hashtable, this check will work */
testdata_t* ref[HASHTESTMAX * 100];
size_t i;
memset(ref, 0, sizeof(ref));
diff --git a/testcode/unitverify.c b/testcode/unitverify.c
index 078af0a9c7c5..9cb0eb99e7cc 100644
--- a/testcode/unitverify.c
+++ b/testcode/unitverify.c
@@ -504,12 +504,12 @@ verify_test(void)
verifytest_file("testdata/test_signatures.6", "20080416005004");
verifytest_file("testdata/test_signatures.7", "20070829144150");
verifytest_file("testdata/test_signatures.8", "20070829144150");
-#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS)) && defined(USE_SHA2)
+#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
verifytest_file("testdata/test_sigs.rsasha256", "20070829144150");
verifytest_file("testdata/test_sigs.sha1_and_256", "20070829144150");
verifytest_file("testdata/test_sigs.rsasha256_draft", "20090101000000");
#endif
-#if (defined(HAVE_EVP_SHA512) || defined(HAVE_NSS)) && defined(USE_SHA2)
+#if (defined(HAVE_EVP_SHA512) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
verifytest_file("testdata/test_sigs.rsasha512_draft", "20070829144150");
#endif
verifytest_file("testdata/test_sigs.hinfo", "20090107100022");