aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
commitf95d7c189bb89474c57dc9b60832df70fe57760f (patch)
treed000c451f9ec0ef25217dcd6b75463182087d19d /src/common
parent6c432a5565183b705569310a34b4da54b1bf98d4 (diff)
downloadtor-f95d7c189bb89474c57dc9b60832df70fe57760f.tar
tor-f95d7c189bb89474c57dc9b60832df70fe57760f.tar.gz
Refactor unit test macros and tor_free_all() logic a bit so as to make it easier to free memory on failing tests, in order to suppress scanner warnings and to make dmalloc() usable with tests.
svn:r16816
Diffstat (limited to 'src/common')
-rw-r--r--src/common/test.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/test.h b/src/common/test.h
index 4709595cf..bb6a8ae00 100644
--- a/src/common/test.h
+++ b/src/common/test.h
@@ -31,7 +31,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
msg); \
- return; \
+ goto done; \
STMT_END
#define test_fail() test_fail_msg("Assertion failed.")
@@ -45,7 +45,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr); \
- return; \
+ goto done; \
} STMT_END
#define test_eq_type(tp, fmt, expr1, expr2) \
@@ -61,7 +61,7 @@ extern int have_failed;
PRETTY_FUNCTION, \
#expr1, #expr2, \
_test_v1, _test_v2); \
- return; \
+ goto done; \
} STMT_END
#define test_eq(expr1, expr2) \
@@ -83,7 +83,7 @@ extern int have_failed;
PRETTY_FUNCTION, \
#expr1, #expr2, \
_test_v1, _test_v2); \
- return; \
+ goto done; \
} STMT_END
#define test_neq(expr1, expr2) \
@@ -104,7 +104,7 @@ extern int have_failed;
PRETTY_FUNCTION, \
#expr1, #expr2, \
_test_v1, _test_v2); \
- return; \
+ goto done; \
} STMT_END
#define test_strneq(expr1, expr2) \
@@ -119,7 +119,7 @@ extern int have_failed;
PRETTY_FUNCTION, \
#expr1, #expr2, \
_test_v1, _test_v2); \
- return; \
+ goto done; \
} STMT_END
#define test_memeq(expr1, expr2, len) \
@@ -139,7 +139,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2, mem1, mem2); \
- return; \
+ goto done; \
} STMT_END
#define test_memeq_hex(expr1, hex) \
@@ -160,7 +160,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, _test_v2, _mem1, _test_v2); \
- return; \
+ goto done; \
} \
tor_free(_mem2); \
STMT_END
@@ -177,7 +177,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2); \
- return; \
+ goto done; \
} STMT_END
#endif