From e44fd97d720801d2d1796bad3ad392831a76c4ed Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 8 Jul 2015 15:57:26 +0200 Subject: [PATCH] unittests: use a global packetpool --- src/alert-unified2-alert.c | 1 - src/flow-manager.c | 4 ---- src/runmode-unittests.c | 6 ++++++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/alert-unified2-alert.c b/src/alert-unified2-alert.c index 26bacb28cc..ede624c4f3 100644 --- a/src/alert-unified2-alert.c +++ b/src/alert-unified2-alert.c @@ -1949,7 +1949,6 @@ error: */ void Unified2RegisterTests(void) { - PacketPoolInit(); #ifdef UNITTESTS UtRegisterTest("Unified2Test01 -- Ipv4 test", Unified2Test01, 1); UtRegisterTest("Unified2Test02 -- Ipv6 test", Unified2Test02, 1); diff --git a/src/flow-manager.c b/src/flow-manager.c index 411dcbc88c..15ad6162a0 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -1228,10 +1228,7 @@ static int FlowMgrTest04 (void) static int FlowMgrTest05 (void) { int result = 0; - extern intmax_t max_pending_packets; - max_pending_packets = 128; - PacketPoolInit(); FlowInitConfig(FLOW_QUIET); FlowConfig backup; memcpy(&backup, &flow_config, sizeof(FlowConfig)); @@ -1269,7 +1266,6 @@ static int FlowMgrTest05 (void) memcpy(&flow_config, &backup, sizeof(FlowConfig)); FlowShutdown(); - PacketPoolDestroy(); return result; } #endif /* UNITTESTS */ diff --git a/src/runmode-unittests.c b/src/runmode-unittests.c index 93fd7f0b08..4f3fc8bf7d 100644 --- a/src/runmode-unittests.c +++ b/src/runmode-unittests.c @@ -280,7 +280,13 @@ void RunUnittests(int list_unittests, char *regex_arg) if (list_unittests) { UtListTests(regex_arg); } else { + /* global packet pool */ + extern intmax_t max_pending_packets; + max_pending_packets = 128; + PacketPoolInit(); + uint32_t failed = UtRunTests(regex_arg); + PacketPoolDestroy(); UtCleanup(); #ifdef __SC_CUDA_SUPPORT__ if (PatternMatchDefaultMatcher() == MPM_AC_CUDA)