aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2016-07-03 19:42:36 +0200
committerSebastian Hahn <sebastian@torproject.org>2016-07-04 12:40:09 +0200
commit265e40b481d23ea0ee8b4e1705fb013532d1f6b2 (patch)
tree9a2bdf42de2c95cbbbe861078887a684b5d91b38 /src/test
parentec6ea66240df36d2a6bb6d4fd0df6f4c2cdb3191 (diff)
downloadtor-265e40b481d23ea0ee8b4e1705fb013532d1f6b2.tar.gz
tor-265e40b481d23ea0ee8b4e1705fb013532d1f6b2.zip
Raise libevent dependency to 2.0.10-stable or newer
Only some very ancient distributions don't ship with Libevent 2 anymore, even the oldest supported Ubuntu LTS version has it. This allows us to get rid of a lot of compat code.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-timers.c4
-rw-r--r--src/test/test_compat_libevent.c102
-rw-r--r--src/test/test_scheduler.c11
-rw-r--r--src/test/test_workqueue.c4
4 files changed, 1 insertions, 120 deletions
diff --git a/src/test/test-timers.c b/src/test/test-timers.c
index 0196ec1fef..7216528f0e 100644
--- a/src/test/test-timers.c
+++ b/src/test/test-timers.c
@@ -7,11 +7,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
-#else
-#include <event.h>
-#endif
#include "compat.h"
#include "compat_libevent.h"
diff --git a/src/test/test_compat_libevent.c b/src/test/test_compat_libevent.c
index 266ebbcf3b..c81f043834 100644
--- a/src/test/test_compat_libevent.c
+++ b/src/test/test_compat_libevent.c
@@ -9,15 +9,11 @@
#include "compat_libevent.h"
-#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
#include <event2/thread.h>
#ifdef USE_BUFFEREVENTS
#include <event2/bufferevent.h>
#endif
-#else
-#include <event.h>
-#endif
#include "log_test_helpers.h"
@@ -107,105 +103,13 @@ test_compat_libevent_logging_callback(void *ignored)
}
static void
-test_compat_libevent_le_versions_compatibility(void *ignored)
-{
- (void)ignored;
- int res;
-
- res = le_versions_compatibility(LE_OTHER);
- tt_int_op(res, OP_EQ, 0);
-
- res = le_versions_compatibility(V_OLD(0,9,'c'));
- tt_int_op(res, OP_EQ, 1);
-
- res = le_versions_compatibility(V(1,3,98));
- tt_int_op(res, OP_EQ, 2);
-
- res = le_versions_compatibility(V(1,4,98));
- tt_int_op(res, OP_EQ, 3);
-
- res = le_versions_compatibility(V(1,5,0));
- tt_int_op(res, OP_EQ, 4);
-
- res = le_versions_compatibility(V(2,0,0));
- tt_int_op(res, OP_EQ, 4);
-
- res = le_versions_compatibility(V(2,0,2));
- tt_int_op(res, OP_EQ, 5);
-
- done:
- (void)0;
-}
-
-static void
-test_compat_libevent_tor_decode_libevent_version(void *ignored)
-{
- (void)ignored;
- le_version_t res;
-
- res = tor_decode_libevent_version("SOMETHING WRONG");
- tt_int_op(res, OP_EQ, LE_OTHER);
-
- res = tor_decode_libevent_version("1.4.11");
- tt_int_op(res, OP_EQ, V(1,4,11));
-
- res = tor_decode_libevent_version("1.4.12b-stable");
- tt_int_op(res, OP_EQ, V(1,4,12));
-
- res = tor_decode_libevent_version("1.4.17b_stable");
- tt_int_op(res, OP_EQ, V(1,4,17));
-
- res = tor_decode_libevent_version("1.4.12!stable");
- tt_int_op(res, OP_EQ, LE_OTHER);
-
- res = tor_decode_libevent_version("1.4.12b!stable");
- tt_int_op(res, OP_EQ, LE_OTHER);
-
- res = tor_decode_libevent_version("1.4.13-");
- tt_int_op(res, OP_EQ, V(1,4,13));
-
- res = tor_decode_libevent_version("1.4.14_");
- tt_int_op(res, OP_EQ, V(1,4,14));
-
- res = tor_decode_libevent_version("1.4.15c-");
- tt_int_op(res, OP_EQ, V(1,4,15));
-
- res = tor_decode_libevent_version("1.4.16c_");
- tt_int_op(res, OP_EQ, V(1,4,16));
-
- res = tor_decode_libevent_version("1.4.17-s");
- tt_int_op(res, OP_EQ, V(1,4,17));
-
- res = tor_decode_libevent_version("1.5");
- tt_int_op(res, OP_EQ, V(1,5,0));
-
- res = tor_decode_libevent_version("1.2");
- tt_int_op(res, OP_EQ, V(1,2,0));
-
- res = tor_decode_libevent_version("1.2-");
- tt_int_op(res, OP_EQ, LE_OTHER);
-
- res = tor_decode_libevent_version("1.6e");
- tt_int_op(res, OP_EQ, V_OLD(1,6,'e'));
-
- done:
- (void)0;
-}
-
-#if defined(LIBEVENT_VERSION)
-#define HEADER_VERSION LIBEVENT_VERSION
-#elif defined(_EVENT_VERSION)
-#define HEADER_VERSION _EVENT_VERSION
-#endif
-
-static void
test_compat_libevent_header_version(void *ignored)
{
(void)ignored;
const char *res;
res = tor_libevent_get_header_version_str();
- tt_str_op(res, OP_EQ, HEADER_VERSION);
+ tt_str_op(res, OP_EQ, LIBEVENT_VERSION);
done:
(void)0;
@@ -214,10 +118,6 @@ test_compat_libevent_header_version(void *ignored)
struct testcase_t compat_libevent_tests[] = {
{ "logging_callback", test_compat_libevent_logging_callback,
TT_FORK, NULL, NULL },
- { "le_versions_compatibility",
- test_compat_libevent_le_versions_compatibility, 0, NULL, NULL },
- { "tor_decode_libevent_version",
- test_compat_libevent_tor_decode_libevent_version, 0, NULL, NULL },
{ "header_version", test_compat_libevent_header_version, 0, NULL, NULL },
END_OF_TESTCASES
};
diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c
index 15fbb2d186..6d21d0344d 100644
--- a/src/test/test_scheduler.c
+++ b/src/test/test_scheduler.c
@@ -5,12 +5,7 @@
#include "orconfig.h"
-/* Libevent stuff */
-#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
-#else
-#include <event.h>
-#endif
#define TOR_CHANNEL_INTERNAL_
#define CHANNEL_PRIVATE_
@@ -90,9 +85,7 @@ mock_event_free_all(void)
static void
mock_event_init(void)
{
-#ifdef HAVE_EVENT2_EVENT_H
struct event_config *cfg = NULL;
-#endif
tt_ptr_op(mock_event_base, ==, NULL);
@@ -102,7 +95,6 @@ mock_event_init(void)
*/
if (!mock_event_base) {
-#ifdef HAVE_EVENT2_EVENT_H
cfg = event_config_new();
#if LIBEVENT_VERSION_NUMBER >= V(2,0,9)
/* We can enable changelist support with epoll, since we don't give
@@ -111,9 +103,6 @@ mock_event_init(void)
#endif
mock_event_base = event_base_new_with_config(cfg);
event_config_free(cfg);
-#else
- mock_event_base = event_init();
-#endif
}
tt_assert(mock_event_base != NULL);
diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c
index 75d68a7ce0..ccb8d0c8ca 100644
--- a/src/test/test_workqueue.c
+++ b/src/test/test_workqueue.c
@@ -12,11 +12,7 @@
#include "compat_libevent.h"
#include <stdio.h>
-#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
-#else
-#include <event.h>
-#endif
#define MAX_INFLIGHT (1<<16)