summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-01 15:02:01 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-01 15:20:37 -0400
commit6c440da9260b6f8fffca7cb95ed6e51f55c71b14 (patch)
tree79b12be0db0beb3fa918b5a37ad4b777be5b75a2 /src/test
parent13116378b1a8118e277320e377a691064e54983a (diff)
downloadtor-6c440da9260b6f8fffca7cb95ed6e51f55c71b14.tar.gz
tor-6c440da9260b6f8fffca7cb95ed6e51f55c71b14.zip
Remove system headers from or.h
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_addr.c5
-rw-r--r--src/test/test_bt_cl.c5
-rw-r--r--src/test/test_checkdir.c5
-rw-r--r--src/test/test_config.c7
-rw-r--r--src/test/test_crypto.c7
-rw-r--r--src/test/test_dir.c4
-rw-r--r--src/test/test_extorport.c5
-rw-r--r--src/test/test_hs.c4
-rw-r--r--src/test/test_logging.c4
-rw-r--r--src/test/test_microdesc.c5
-rw-r--r--src/test/test_routerkeys.c7
-rw-r--r--src/test/test_shared_random.c4
-rw-r--r--src/test/test_switch_id.c3
-rw-r--r--src/test/test_util.c10
-rw-r--r--src/test/testing_common.c6
15 files changed, 76 insertions, 5 deletions
diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 0a3212adbc..1069e25b43 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -11,6 +11,10 @@
#include "or/addressmap.h"
#include "test/log_test_helpers.h"
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
/** Mocking replacement: only handles localhost. */
static int
mock_tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out)
@@ -1257,4 +1261,3 @@ struct testcase_t addr_tests[] = {
{ "make_null", test_addr_make_null, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c
index c64ca8e2b3..8a8221f190 100644
--- a/src/test/test_bt_cl.c
+++ b/src/test/test_bt_cl.c
@@ -12,6 +12,10 @@
#include "lib/err/backtrace.h"
#include "lib/log/torlog.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* -1: no crash.
* 0: crash with a segmentation fault.
* 1x: crash with an assertion failure. */
@@ -118,4 +122,3 @@ main(int argc, char **argv)
return 0;
}
-
diff --git a/src/test/test_checkdir.c b/src/test/test_checkdir.c
index d0c899a07e..09688cf0a9 100644
--- a/src/test/test_checkdir.c
+++ b/src/test/test_checkdir.c
@@ -14,6 +14,10 @@
#include "test/test.h"
#include "common/util.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifdef _WIN32
#define mkdir(a,b) mkdir(a)
#define tt_int_op_nowin(a,op,b) do { (void)(a); (void)(b); } while (0)
@@ -146,4 +150,3 @@ struct testcase_t checkdir_tests[] = {
CHECKDIR(perms, TT_FORK),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_config.c b/src/test/test_config.c
index d84cac4e91..25199454e4 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -53,6 +53,13 @@
#include "lib/net/gethostname.h"
#include "lib/encoding/confline.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
static void
test_config_addressmap(void *arg)
{
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index e342c933bc..194c54e857 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -19,6 +19,13 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "ed25519_vectors.inc"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/** Run unit tests for Diffie-Hellman functionality. */
static void
test_crypto_dh(void *arg)
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index a2b4ec68a8..5adfb95706 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -63,6 +63,10 @@
#include "or/vote_microdesc_hash_st.h"
#include "or/vote_routerstatus_st.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#define NS_MODULE dir
static void
diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index 0032ef5b78..4ddef4e43b 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -18,6 +18,10 @@
#include "test/test.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
/* Test connection_or_remove_from_ext_or_id_map and
* connection_or_set_ext_or_identifier */
static void
@@ -610,4 +614,3 @@ struct testcase_t extorport_tests[] = {
{ "handshake", test_ext_or_handshake, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 2a6cd28272..b17e8cf21f 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -30,6 +30,10 @@
#include "test/test_helpers.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* mock ID digest and longname for node that's in nodelist */
#define HSDIR_EXIST_ID "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" \
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
diff --git a/src/test/test_logging.c b/src/test/test_logging.c
index d979411469..48cdf2e6bc 100644
--- a/src/test/test_logging.c
+++ b/src/test/test_logging.c
@@ -11,6 +11,10 @@
#include "test/test.h"
#include "lib/process/subprocess.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
static void
dummy_cb_fn(int severity, uint32_t domain, const char *msg)
{
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 1b680c02c5..2038f54984 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -20,6 +20,10 @@
#include "test/test.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifdef _WIN32
/* For mkdir() */
#include <direct.h>
@@ -815,4 +819,3 @@ struct testcase_t microdesc_tests[] = {
{ "corrupt_desc", test_md_corrupt_desc, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c
index 3fc381cd20..8c2be30a8f 100644
--- a/src/test/test_routerkeys.c
+++ b/src/test/test_routerkeys.c
@@ -20,6 +20,13 @@
#include <direct.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
static void
test_routerkeys_write_fingerprint(void *arg)
{
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 293ed6cf33..1b4fdc8992 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -26,6 +26,10 @@
#include "or/networkstatus_st.h"
#include "or/or_state_st.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
static authority_cert_t *mock_cert;
static authority_cert_t *
diff --git a/src/test/test_switch_id.c b/src/test/test_switch_id.c
index 11fe53b7c5..95801822f9 100644
--- a/src/test/test_switch_id.c
+++ b/src/test/test_switch_id.c
@@ -7,6 +7,9 @@
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#define TEST_BUILT_WITH_CAPS 0
#define TEST_HAVE_CAPS 1
diff --git a/src/test/test_util.c b/src/test/test_util.c
index ab0573e560..3c0b4f77fc 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -48,6 +48,16 @@
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef _WIN32
#include <tchar.h>
#endif
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index 0b7a3287a4..ace564d0fe 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -28,6 +28,12 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#ifdef _WIN32
/* For mkdir() */