[tor-commits] [tor/master] Fix various GCC LTO warnings in the unit tests.
nickm at torproject.org
nickm at torproject.org
Sun Oct 14 19:42:14 UTC 2018
commit 6925b61cfdf50a5686de02645b04b269c031f05d
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Sep 18 15:32:25 2018 -0400
Fix various GCC LTO warnings in the unit tests.
---
src/test/test_hs_service.c | 1 +
src/test/test_routerset.c | 3 +++
src/test/test_storagedir.c | 2 +-
src/test/test_tortls.c | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index bceeafd14..d6404bd71 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -534,6 +534,7 @@ test_load_keys_with_client_auth(void *arg)
tt_int_op(get_hs_service_map_size(), OP_EQ, 1);
service = get_first_service();
+ tt_assert(service);
tt_assert(service->config.clients);
tt_int_op(smartlist_len(service->config.clients), OP_EQ,
smartlist_len(pubkey_b32_list));
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index 2017ef005..db7a6a54e 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -1496,6 +1496,7 @@ NS(test_main)(void *arg)
int r;
(void)arg;
+ memset(&NS(mock_node), 0, sizeof(NS(mock_node)));
NS(mock_node).ri = NULL;
NS(mock_node).rs = NULL;
@@ -1529,6 +1530,7 @@ NS(test_main)(void *arg)
strncpy(rs.nickname, nickname, sizeof(rs.nickname) - 1);
rs.nickname[sizeof(rs.nickname) - 1] = '\0';
+ memset(&NS(mock_node), 0, sizeof(NS(mock_node)));
NS(mock_node).ri = NULL;
NS(mock_node).rs = &rs;
@@ -1560,6 +1562,7 @@ NS(test_main)(void *arg)
strmap_set_lc(set->names, nickname, (void *)1);
ri.nickname = (char *)nickname;
+ memset(&mock_node, 0, sizeof(mock_node));
mock_node.ri = &ri;
mock_node.rs = NULL;
diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c
index 68cee418a..76aae7e03 100644
--- a/src/test/test_storagedir.c
+++ b/src/test/test_storagedir.c
@@ -283,7 +283,7 @@ test_storagedir_save_labeled(void *arg)
int r = storage_dir_save_labeled_to_file(d, labels, inp, 8192, &fname);
tt_int_op(r, OP_EQ, 0);
- size_t n;
+ size_t n = 0;
saved = storage_dir_read(d, fname, 1, &n);
tt_assert(memchr(saved, '\0', n));
tt_str_op((char*)saved, OP_EQ, expected); /* NUL guarantees strcmp works */
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index f4315364a..79b52437f 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -238,6 +238,7 @@ test_tortls_x509_cert_get_id_digests(void *ignored)
cert->pkey_digests_set = 1;
cert->pkey_digests = *d;
res = tor_x509_cert_get_id_digests(cert);
+ tt_assert(res);
tt_int_op(res->d[0][0], OP_EQ, 42);
done:
More information about the tor-commits
mailing list