summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench.c4
-rw-r--r--src/test/fuzz/fuzzing.h2
-rw-r--r--src/test/fuzz/fuzzing_common.c4
-rw-r--r--src/test/ptr_helpers.c2
-rw-r--r--src/test/ptr_helpers.h2
-rw-r--r--src/test/test-memwipe.c2
-rw-r--r--src/test/test_circuitpadding.c4
-rw-r--r--src/test/test_config.c6
-rw-r--r--src/test/test_connection.h2
-rw-r--r--src/test/test_crypto.c10
-rw-r--r--src/test/test_dir_common.h2
-rw-r--r--src/test/test_dns.c4
-rw-r--r--src/test/test_dos.c2
-rw-r--r--src/test/test_link_handshake.c4
-rw-r--r--src/test/test_periodic_event.c2
-rw-r--r--src/test/test_process.c4
-rw-r--r--src/test/test_process_slow.c2
-rw-r--r--src/test/test_protover.c10
-rw-r--r--src/test/test_rng.c2
-rw-r--r--src/test/test_shared_random.c2
-rw-r--r--src/test/test_tortls.c6
-rw-r--r--src/test/test_tortls.h2
-rw-r--r--src/test/test_tortls_openssl.c4
-rw-r--r--src/test/test_util.c10
24 files changed, 47 insertions, 47 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index 65fa617cbd..cf732df593 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -22,7 +22,7 @@
#include <openssl/ec.h>
#include <openssl/ecdh.h>
#include <openssl/obj_mac.h>
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
#include "core/or/circuitlist.h"
#include "app/config/config.h"
@@ -701,7 +701,7 @@ bench_ecdh_p224(void)
{
bench_ecdh_impl(NID_secp224r1, "P-224");
}
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
static void
bench_md_parse(void)
diff --git a/src/test/fuzz/fuzzing.h b/src/test/fuzz/fuzzing.h
index 150ac4aa7d..2d278825ec 100644
--- a/src/test/fuzz/fuzzing.h
+++ b/src/test/fuzz/fuzzing.h
@@ -9,5 +9,5 @@ int fuzz_main(const uint8_t *data, size_t sz);
void disable_signature_checking(void);
-#endif /* FUZZING_H */
+#endif /* !defined(FUZZING_H) */
diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c
index 387c865a9b..6d0f9d7d60 100644
--- a/src/test/fuzz/fuzzing_common.c
+++ b/src/test/fuzz/fuzzing_common.c
@@ -137,7 +137,7 @@ LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
return fuzz_main(Data, Size);
}
-#else /* Not LLVM_FUZZ, so AFL. */
+#else /* !(defined(LLVM_FUZZ)) */
int
main(int argc, char **argv)
@@ -194,4 +194,4 @@ main(int argc, char **argv)
return 0;
}
-#endif
+#endif /* defined(LLVM_FUZZ) */
diff --git a/src/test/ptr_helpers.c b/src/test/ptr_helpers.c
index 296238feeb..a55ab437fa 100644
--- a/src/test/ptr_helpers.c
+++ b/src/test/ptr_helpers.c
@@ -3,7 +3,7 @@
* Copyright (c) 2007-2019, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "ptr_helpers.h"
+#include "test/ptr_helpers.h"
/**
* Cast <b> (inptr_t value) to a void pointer.
diff --git a/src/test/ptr_helpers.h b/src/test/ptr_helpers.h
index 67776b1006..7349bddd51 100644
--- a/src/test/ptr_helpers.h
+++ b/src/test/ptr_helpers.h
@@ -20,4 +20,4 @@ cast_uintptr_to_voidstar(uintptr_t x);
uintptr_t
cast_voidstar_to_uintptr(void *x);
-#endif
+#endif /* !defined(TOR_PTR_HELPERS_H) */
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 43754ed1c2..3f952e484f 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -49,7 +49,7 @@ const char *s = NULL;
* us do bad things, such as access freed buffers, without crashing. */
extern const char *malloc_options;
const char *malloc_options = "sufjj";
-#endif
+#endif /* defined(OpenBSD) */
static unsigned
fill_a_buffer_memset(void)
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c
index a2d192203e..236f4a192d 100644
--- a/src/test/test_circuitpadding.c
+++ b/src/test/test_circuitpadding.c
@@ -6,7 +6,7 @@
#define CRYPT_PATH_PRIVATE
#include "core/or/or.h"
-#include "test.h"
+#include "test/test.h"
#include "lib/testsupport/testsupport.h"
#include "core/or/connection_or.h"
#include "core/or/channel.h"
@@ -2329,7 +2329,7 @@ test_circuitpadding_circuitsetup_machine(void *arg)
return;
}
-#endif
+#endif /* 0 */
/** Helper function: Initializes a padding machine where every state uses the
* uniform probability distribution. */
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 6cfb7b764b..12b78f806a 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5066,7 +5066,7 @@ test_config_include_no_permission(void *data)
chmod(dir, 0700);
tor_free(dir);
}
-#endif
+#endif /* !defined(_WIN32) */
static void
test_config_include_recursion_before_after(void *data)
@@ -5698,7 +5698,7 @@ test_config_compute_max_mem_in_queues(void *data)
#else
/* We are on a 32-bit system. */
tt_u64_op(compute_real_max_mem_in_queues(0, 0), OP_EQ, GIGABYTE(1));
-#endif
+#endif /* SIZEOF_VOID_P >= 8 */
/* We are able to detect the amount of RAM on the system. */
total_system_memory_return = 0;
@@ -5739,7 +5739,7 @@ test_config_compute_max_mem_in_queues(void *data)
/* We will at maximum get MAX_DEFAULT_MEMORY_QUEUE_SIZE here. */
tt_u64_op(compute_real_max_mem_in_queues(0, 0), OP_EQ,
MAX_DEFAULT_MEMORY_QUEUE_SIZE);
-#endif
+#endif /* SIZEOF_SIZE_T > 4 */
done:
UNMOCK(get_total_system_memory);
diff --git a/src/test/test_connection.h b/src/test/test_connection.h
index 027e405d89..40121e6d38 100644
--- a/src/test/test_connection.h
+++ b/src/test/test_connection.h
@@ -14,4 +14,4 @@
void test_conn_lookup_addr_helper(const char *address,
int family, tor_addr_t *addr);
-#endif
+#endif /* !defined(TOR_TEST_CONNECTION_H) */
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 872da3d2c5..178a9a5097 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -32,7 +32,7 @@
DISABLE_GCC_WARNING(redundant-decls)
#include <openssl/dh.h>
ENABLE_GCC_WARNING(redundant-decls)
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
/** Run unit tests for Diffie-Hellman functionality. */
static void
@@ -190,7 +190,7 @@ test_crypto_dh(void *arg)
DH_get0_key(dh4, &pk, &sk);
#else
pk = dh4->pub_key;
-#endif
+#endif /* defined(OPENSSL_1_1_API) */
tt_assert(pk);
tt_int_op(BN_num_bytes(pk), OP_LE, DH1024_KEY_LEN);
tt_int_op(BN_num_bytes(pk), OP_GT, 0);
@@ -207,7 +207,7 @@ test_crypto_dh(void *arg)
tt_int_op(s1len, OP_GT, 0);
tt_mem_op(s1, OP_EQ, s2, s1len);
}
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
done:
crypto_dh_free(dh1);
@@ -219,7 +219,7 @@ test_crypto_dh(void *arg)
DH_free(dh4);
if (pubkey_tmp)
BN_free(pubkey_tmp);
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
}
static void
@@ -248,7 +248,7 @@ test_crypto_openssl_version(void *arg)
tt_int_op(a, OP_GE, 0);
tt_int_op(b, OP_GE, 0);
tt_int_op(c, OP_GE, 0);
-#endif
+#endif /* defined(ENABLE_NSS) */
done:
;
diff --git a/src/test/test_dir_common.h b/src/test/test_dir_common.h
index ab99ed36f4..619dc83eb9 100644
--- a/src/test/test_dir_common.h
+++ b/src/test/test_dir_common.h
@@ -52,4 +52,4 @@ int dir_common_construct_vote_3(networkstatus_t **vote,
networkstatus_t **vote_out, int *n_vrs, time_t now,
int clear_rl);
-#endif
+#endif /* !defined(TOR_TEST_DIR_COMMON_H) */
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index 231e6965f7..51ff8729d0 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -67,7 +67,7 @@ NS(test_main)(void *arg)
tt_assert(tor_addr_family(nameserver_addr) == AF_INET);
tt_assert(tor_addr_eq_ipv4h(nameserver_addr, 0x7f000001));
-#endif
+#endif /* !defined(_WIN32) */
UNMOCK(get_options);
@@ -77,7 +77,7 @@ NS(test_main)(void *arg)
}
#undef NS_SUBMODULE
-#endif
+#endif /* defined(HAVE_EVDNS_BASE_GET_NAMESERVER_ADDR) */
#define NS_SUBMODULE clip_ttl
diff --git a/src/test/test_dos.c b/src/test/test_dos.c
index 4756c5014e..bda9908e6c 100644
--- a/src/test/test_dos.c
+++ b/src/test/test_dos.c
@@ -411,7 +411,7 @@ test_dos_bucket_refill(void *arg)
}
tt_uint_op(current_circ_count, OP_EQ, 0);
tt_uint_op(dos_stats->cc_stats.circuit_bucket, OP_EQ, current_circ_count);
-#endif
+#endif /* SIZEOF_TIME_T == 8 */
done:
tor_free(chan);
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index 4e4c86aa0a..5e78e1ce4d 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -948,7 +948,7 @@ test_link_handshake_send_authchallenge(void *arg)
#else
tt_int_op(36, OP_EQ, cell1->payload_len);
tt_int_op(36, OP_EQ, cell2->payload_len);
-#endif
+#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */
tt_int_op(0, OP_EQ, cell1->circ_id);
tt_int_op(0, OP_EQ, cell2->circ_id);
tt_int_op(CELL_AUTH_CHALLENGE, OP_EQ, cell1->command);
@@ -960,7 +960,7 @@ test_link_handshake_send_authchallenge(void *arg)
#else
tt_mem_op("\x00\x01\x00\x03", OP_EQ, cell1->payload + 32, 4);
tt_mem_op("\x00\x01\x00\x03", OP_EQ, cell2->payload + 32, 4);
-#endif
+#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */
tt_mem_op(cell1->payload, OP_NE, cell2->payload, 32);
done:
diff --git a/src/test/test_periodic_event.c b/src/test/test_periodic_event.c
index 961a8be698..267156a908 100644
--- a/src/test/test_periodic_event.c
+++ b/src/test/test_periodic_event.c
@@ -108,7 +108,7 @@ test_pe_launch(void *arg)
periodic_event_item_t *item = &periodic_events[i];
tt_int_op(periodic_event_is_enabled(item), OP_EQ, 0);
}
-#endif
+#endif /* 0 */
initialize_periodic_events();
periodic_events_connect_all();
diff --git a/src/test/test_process.c b/src/test/test_process.c
index 7cc01d2442..7836312761 100644
--- a/src/test/test_process.c
+++ b/src/test/test_process.c
@@ -594,7 +594,7 @@ test_unix(void *arg)
done:
process_free(process);
-#endif
+#endif /* !defined(_WIN32) */
}
static void
@@ -649,7 +649,7 @@ test_win32(void *arg)
done:
tor_free(joined_argv);
process_free(process);
-#endif
+#endif /* defined(_WIN32) */
}
struct testcase_t process_tests[] = {
diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c
index 1322d7b833..91252c725d 100644
--- a/src/test/test_process_slow.c
+++ b/src/test/test_process_slow.c
@@ -135,7 +135,7 @@ get_win32_test_binary_path(void)
done:
return NULL;
}
-#endif
+#endif /* defined(_WIN32) */
static void
main_loop_timeout_cb(periodic_timer_t *timer, void *data)
diff --git a/src/test/test_protover.c b/src/test/test_protover.c
index 63c508bd13..1759aef97d 100644
--- a/src/test/test_protover.c
+++ b/src/test/test_protover.c
@@ -22,7 +22,7 @@ test_protover_parse(void *arg)
tt_skip();
done:
;
-#else
+#else /* !(defined(HAVE_RUST)) */
char *re_encoded = NULL;
const char *orig = "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900";
@@ -89,7 +89,7 @@ test_protover_parse(void *arg)
SMARTLIST_FOREACH(elts, proto_entry_t *, ent, proto_entry_free(ent));
smartlist_free(elts);
tor_free(re_encoded);
-#endif
+#endif /* defined(HAVE_RUST) */
}
static void
@@ -133,7 +133,7 @@ test_protover_parse_fail(void *arg)
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
tt_ptr_op(elts, OP_EQ, NULL);
-#endif
+#endif /* defined(HAVE_RUST) */
done:
;
}
@@ -335,7 +335,7 @@ test_protover_all_supported(void *arg)
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaa=1-65536", &msg));
tor_end_capture_bugs_();
-#endif
+#endif /* !defined(HAVE_RUST) */
done:
tor_end_capture_bugs_();
@@ -459,7 +459,7 @@ test_protover_supported_protocols(void *arg)
tt_assert(protocol_list_supports_protocol(supported_protocols,
PRT_LINKAUTH,
PROTOVER_LINKAUTH_V1));
-#endif
+#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */
/* Latest LinkAuth is not exposed in the headers. */
tt_assert(protocol_list_supports_protocol(supported_protocols,
PRT_LINKAUTH,
diff --git a/src/test/test_rng.c b/src/test/test_rng.c
index c749de112a..dcf08fff1d 100644
--- a/src/test/test_rng.c
+++ b/src/test/test_rng.c
@@ -46,7 +46,7 @@ main(int argc, char **argv)
return 1;
}
}
-#endif
+#endif /* 0 */
crypto_fast_rng_t *rng = crypto_fast_rng_new();
while (1) {
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 9fb88b9bee..9c8703fa6f 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -1367,7 +1367,7 @@ test_utils_auth(void *arg)
sr_state_set_current_srv(sr_state_get_current_srv());
sr_state_set_previous_srv(sr_state_get_previous_srv());
}
-#endif
+#endif /* 0 */
done:
sr_state_free_all();
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 11e35be2fa..5f87434f6a 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -219,7 +219,7 @@ test_tortls_tor_tls_get_error(void *data)
crypto_pk_free(key2);
tor_tls_free(tls);
}
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
static void
test_tortls_x509_cert_get_id_digests(void *ignored)
@@ -336,7 +336,7 @@ test_tortls_server_got_renegotiate(void *ignored)
done:
tor_free(tls);
}
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
static void
test_tortls_evaluate_ecgroup_for_tls(void *ignored)
@@ -526,7 +526,7 @@ struct testcase_t tortls_tests[] = {
LOCAL_TEST_CASE(get_forced_write_size, 0),
LOCAL_TEST_CASE(used_v1_handshake, TT_FORK),
LOCAL_TEST_CASE(server_got_renegotiate, 0),
-#endif
+#endif /* defined(ENABLE_OPENSSL) */
LOCAL_TEST_CASE(evaluate_ecgroup_for_tls, 0),
LOCAL_TEST_CASE(double_init, TT_FORK),
LOCAL_TEST_CASE(address, TT_FORK),
diff --git a/src/test/test_tortls.h b/src/test/test_tortls.h
index 1a8b117d0f..4567b9f6a0 100644
--- a/src/test/test_tortls.h
+++ b/src/test/test_tortls.h
@@ -10,4 +10,4 @@ extern const char *notCompletelyValidCertString;
extern const char *validCertString;
extern const char *caCertString;
-#endif
+#endif /* !defined(TEST_TORTLS_H) */
diff --git a/src/test/test_tortls_openssl.c b/src/test/test_tortls_openssl.c
index 73041a871c..81e2d3aa4f 100644
--- a/src/test/test_tortls_openssl.c
+++ b/src/test/test_tortls_openssl.c
@@ -133,7 +133,7 @@ library_init(void)
#else
SSL_library_init();
SSL_load_error_strings();
-#endif
+#endif /* defined(OPENSSL_1_1_API) */
}
static void
@@ -477,7 +477,7 @@ fake_x509_free(X509 *cert)
tor_free(cert);
}
}
-#endif
+#endif /* !defined(OPENSSL_OPAQUE) */
static tor_x509_cert_t *fixed_x509_cert = NULL;
static tor_x509_cert_t *
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 79df2825be..2faadd4e19 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6116,9 +6116,9 @@ test_util_log_mallinfo(void *arg)
} else {
tt_u64_op(mem1, OP_LT, mem2);
}
-#else
+#else /* !(defined(HAVE_MALLINFO)) */
tt_skip();
-#endif
+#endif /* defined(HAVE_MALLINFO) */
done:
teardown_capture_of_logs();
tor_free(log1);
@@ -6175,7 +6175,7 @@ test_util_map_anon_nofork(void *arg)
tt_skip();
done:
;
-#else
+#else /* !(defined(_WIN32)) */
/* We have the right OS support. We're going to try marking the buffer as
* either zero-on-fork or as drop-on-fork, whichever is supported. Then we
* will fork and send a byte back to the parent process. This will either
@@ -6236,7 +6236,7 @@ test_util_map_anon_nofork(void *arg)
* implemented. */
tt_skip();
}
-#endif
+#endif /* !defined(NOINHERIT_CAN_FAIL) */
done:
tor_munmap_anonymous(ptr, sz);
@@ -6246,7 +6246,7 @@ test_util_map_anon_nofork(void *arg)
if (pipefd[1] >= 0) {
close(pipefd[1]);
}
-#endif
+#endif /* defined(_WIN32) */
}
#define UTIL_LEGACY(name) \