From: Victor Julien Date: Wed, 8 Jul 2015 13:57:26 +0000 (+0200) Subject: unittests: use a global packetpool X-Git-Tag: suricata-3.0RC1~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44fd97d720801d2d1796bad3ad392831a76c4ed;p=thirdparty%2Fsuricata.git unittests: use a global packetpool --- 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)