mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Fix numerous type errors in the unit tests
Remove tinytest casts that were suppressing them. Fix for #11825.
This commit is contained in:
parent
1f11be2170
commit
5bb6172367
@ -113,8 +113,8 @@
|
|||||||
#define tt_assert_test_fmt_type(a,b,str_test,type,test,printf_type,printf_fmt, \
|
#define tt_assert_test_fmt_type(a,b,str_test,type,test,printf_type,printf_fmt, \
|
||||||
setup_block,cleanup_block,die_on_fail) \
|
setup_block,cleanup_block,die_on_fail) \
|
||||||
TT_STMT_BEGIN \
|
TT_STMT_BEGIN \
|
||||||
type val1_ = (type)(a); \
|
type val1_ = (a); \
|
||||||
type val2_ = (type)(b); \
|
type val2_ = (b); \
|
||||||
int tt_status_ = (test); \
|
int tt_status_ = (test); \
|
||||||
if (!tt_status_ || tinytest_get_verbosity_()>1) { \
|
if (!tt_status_ || tinytest_get_verbosity_()>1) { \
|
||||||
printf_type print_; \
|
printf_type print_; \
|
||||||
@ -163,7 +163,7 @@
|
|||||||
(val1_ op val2_),"%lu",TT_EXIT_TEST_FUNCTION)
|
(val1_ op val2_),"%lu",TT_EXIT_TEST_FUNCTION)
|
||||||
|
|
||||||
#define tt_ptr_op(a,op,b) \
|
#define tt_ptr_op(a,op,b) \
|
||||||
tt_assert_test_type(a,b,#a" "#op" "#b,void*, \
|
tt_assert_test_type(a,b,#a" "#op" "#b,const void*, \
|
||||||
(val1_ op val2_),"%p",TT_EXIT_TEST_FUNCTION)
|
(val1_ op val2_),"%p",TT_EXIT_TEST_FUNCTION)
|
||||||
|
|
||||||
#define tt_str_op(a,op,b) \
|
#define tt_str_op(a,op,b) \
|
||||||
@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
#define tt_mem_op(expr1, op, expr2, len) \
|
#define tt_mem_op(expr1, op, expr2, len) \
|
||||||
tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2, \
|
tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2, \
|
||||||
const char *, \
|
const void *, \
|
||||||
(val1_ && val2_ && memcmp(val1_, val2_, len) op 0), \
|
(val1_ && val2_ && memcmp(val1_, val2_, len) op 0), \
|
||||||
char *, "%s", \
|
char *, "%s", \
|
||||||
{ print_ = tinytest_format_hex_(value_, (len)); }, \
|
{ print_ = tinytest_format_hex_(value_, (len)); }, \
|
||||||
@ -189,7 +189,7 @@
|
|||||||
(val1_ op val2_),"%lu",(void)0)
|
(val1_ op val2_),"%lu",(void)0)
|
||||||
|
|
||||||
#define tt_want_ptr_op(a,op,b) \
|
#define tt_want_ptr_op(a,op,b) \
|
||||||
tt_assert_test_type(a,b,#a" "#op" "#b,void*, \
|
tt_assert_test_type(a,b,#a" "#op" "#b,const void*, \
|
||||||
(val1_ op val2_),"%p",(void)0)
|
(val1_ op val2_),"%p",(void)0)
|
||||||
|
|
||||||
#define tt_want_str_op(a,op,b) \
|
#define tt_want_str_op(a,op,b) \
|
||||||
|
@ -222,7 +222,7 @@ test_buffer_pullup(void *arg)
|
|||||||
buf_pullup(buf, 16, 1);
|
buf_pullup(buf, 16, 1);
|
||||||
buf_get_first_chunk_data(buf, &cp, &sz);
|
buf_get_first_chunk_data(buf, &cp, &sz);
|
||||||
tt_ptr_op(cp, ==, NULL);
|
tt_ptr_op(cp, ==, NULL);
|
||||||
tt_ptr_op(sz, ==, 0);
|
tt_uint_op(sz, ==, 0);
|
||||||
|
|
||||||
/* Let's make sure nothing got allocated */
|
/* Let's make sure nothing got allocated */
|
||||||
tt_int_op(buf_get_total_allocation(), ==, 0);
|
tt_int_op(buf_get_total_allocation(), ==, 0);
|
||||||
|
@ -53,7 +53,7 @@ circuitmux_detach_mock(circuitmux_t *cmux, circuit_t *circ)
|
|||||||
tt_int_op(cam.ncalls, ==, 1); \
|
tt_int_op(cam.ncalls, ==, 1); \
|
||||||
tt_ptr_op(cam.cmux, ==, (mux_)); \
|
tt_ptr_op(cam.cmux, ==, (mux_)); \
|
||||||
tt_ptr_op(cam.circ, ==, (circ_)); \
|
tt_ptr_op(cam.circ, ==, (circ_)); \
|
||||||
tt_ptr_op(cam.dir, ==, (dir_)); \
|
tt_int_op(cam.dir, ==, (dir_)); \
|
||||||
memset(&cam, 0, sizeof(cam)); \
|
memset(&cam, 0, sizeof(cam)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ test_ext_or_cookie_auth_testvec(void *arg)
|
|||||||
handle_client_auth_nonce(client_nonce, 32, &client_hash, &reply,
|
handle_client_auth_nonce(client_nonce, 32, &client_hash, &reply,
|
||||||
&reply_len));
|
&reply_len));
|
||||||
tt_ptr_op(reply, !=, NULL );
|
tt_ptr_op(reply, !=, NULL );
|
||||||
tt_ptr_op(reply_len, ==, 64);
|
tt_uint_op(reply_len, ==, 64);
|
||||||
test_memeq(reply+32, "te road There is always another ", 32);
|
test_memeq(reply+32, "te road There is always another ", 32);
|
||||||
/* HMACSHA256("Gliding wrapt in a brown mantle,"
|
/* HMACSHA256("Gliding wrapt in a brown mantle,"
|
||||||
* "ExtORPort authentication server-to-client hash"
|
* "ExtORPort authentication server-to-client hash"
|
||||||
|
Loading…
Reference in New Issue
Block a user