Fix various GCC LTO warnings in the unit tests.

This commit is contained in:
Nick Mathewson 2018-09-18 15:32:25 -04:00
parent 7c8f20ba44
commit 6925b61cfd
4 changed files with 6 additions and 1 deletions

View File

@ -534,6 +534,7 @@ test_load_keys_with_client_auth(void *arg)
tt_int_op(get_hs_service_map_size(), OP_EQ, 1); tt_int_op(get_hs_service_map_size(), OP_EQ, 1);
service = get_first_service(); service = get_first_service();
tt_assert(service);
tt_assert(service->config.clients); tt_assert(service->config.clients);
tt_int_op(smartlist_len(service->config.clients), OP_EQ, tt_int_op(smartlist_len(service->config.clients), OP_EQ,
smartlist_len(pubkey_b32_list)); smartlist_len(pubkey_b32_list));

View File

@ -1496,6 +1496,7 @@ NS(test_main)(void *arg)
int r; int r;
(void)arg; (void)arg;
memset(&NS(mock_node), 0, sizeof(NS(mock_node)));
NS(mock_node).ri = NULL; NS(mock_node).ri = NULL;
NS(mock_node).rs = NULL; NS(mock_node).rs = NULL;
@ -1529,6 +1530,7 @@ NS(test_main)(void *arg)
strncpy(rs.nickname, nickname, sizeof(rs.nickname) - 1); strncpy(rs.nickname, nickname, sizeof(rs.nickname) - 1);
rs.nickname[sizeof(rs.nickname) - 1] = '\0'; rs.nickname[sizeof(rs.nickname) - 1] = '\0';
memset(&NS(mock_node), 0, sizeof(NS(mock_node)));
NS(mock_node).ri = NULL; NS(mock_node).ri = NULL;
NS(mock_node).rs = &rs; NS(mock_node).rs = &rs;
@ -1560,6 +1562,7 @@ NS(test_main)(void *arg)
strmap_set_lc(set->names, nickname, (void *)1); strmap_set_lc(set->names, nickname, (void *)1);
ri.nickname = (char *)nickname; ri.nickname = (char *)nickname;
memset(&mock_node, 0, sizeof(mock_node));
mock_node.ri = &ri; mock_node.ri = &ri;
mock_node.rs = NULL; mock_node.rs = NULL;

View File

@ -283,7 +283,7 @@ test_storagedir_save_labeled(void *arg)
int r = storage_dir_save_labeled_to_file(d, labels, inp, 8192, &fname); int r = storage_dir_save_labeled_to_file(d, labels, inp, 8192, &fname);
tt_int_op(r, OP_EQ, 0); tt_int_op(r, OP_EQ, 0);
size_t n; size_t n = 0;
saved = storage_dir_read(d, fname, 1, &n); saved = storage_dir_read(d, fname, 1, &n);
tt_assert(memchr(saved, '\0', n)); tt_assert(memchr(saved, '\0', n));
tt_str_op((char*)saved, OP_EQ, expected); /* NUL guarantees strcmp works */ tt_str_op((char*)saved, OP_EQ, expected); /* NUL guarantees strcmp works */

View File

@ -238,6 +238,7 @@ test_tortls_x509_cert_get_id_digests(void *ignored)
cert->pkey_digests_set = 1; cert->pkey_digests_set = 1;
cert->pkey_digests = *d; cert->pkey_digests = *d;
res = tor_x509_cert_get_id_digests(cert); res = tor_x509_cert_get_id_digests(cert);
tt_assert(res);
tt_int_op(res->d[0][0], OP_EQ, 42); tt_int_op(res->d[0][0], OP_EQ, 42);
done: done: