]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
move unittest out of suricata.c
authorEric Leblond <eric@regit.org>
Tue, 9 Apr 2013 10:21:43 +0000 (12:21 +0200)
committerEric Leblond <eric@regit.org>
Mon, 29 Jul 2013 12:33:41 +0000 (14:33 +0200)
src/Makefile.am
src/runmode-unittests.c [new file with mode: 0644]
src/runmode-unittests.h [new file with mode: 0644]
src/suricata.c
src/util-running-modes.c
src/util-running-modes.h

index c80146a6d55f85947ad34cd4660cb16a0a38a04f..b3a7783a0a0d2070487ab5a9701125b603cb0ffb 100644 (file)
@@ -222,6 +222,7 @@ runmode-nfq.c runmode-nfq.h \
 runmode-pcap.c runmode-pcap.h \
 runmode-pcap-file.c runmode-pcap-file.h \
 runmode-pfring.c runmode-pfring.h \
+runmode-unittests.c runmode-unittests.h \
 runmode-unix-socket.c runmode-unix-socket.h \
 runmode-tile.c runmode-tile.h \
 runmodes.c runmodes.h \
diff --git a/src/runmode-unittests.c b/src/runmode-unittests.c
new file mode 100644 (file)
index 0000000..f5d2f99
--- /dev/null
@@ -0,0 +1,284 @@
+/* Copyright (C) 2013 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/** \file
+ *
+ *  \author Eric Leblond <eric@regit.org>
+ */
+
+#include "suricata-common.h"
+#include "config.h"
+#include "util-unittest.h"
+
+#ifdef UNITTESTS
+
+#include "detect-parse.h"
+#include "detect-engine.h"
+#include "detect-engine-address.h"
+#include "detect-engine-proto.h"
+#include "detect-engine-port.h"
+#include "detect-engine-mpm.h"
+#include "detect-engine-sigorder.h"
+#include "detect-engine-payload.h"
+#include "detect-engine-dcepayload.h"
+#include "detect-engine-uri.h"
+#include "detect-engine-hcbd.h"
+#include "detect-engine-hsbd.h"
+#include "detect-engine-hhd.h"
+#include "detect-engine-hrhd.h"
+#include "detect-engine-hmd.h"
+#include "detect-engine-hcd.h"
+#include "detect-engine-hrud.h"
+#include "detect-engine-hsmd.h"
+#include "detect-engine-hscd.h"
+#include "detect-engine-hua.h"
+#include "detect-engine-hhhd.h"
+#include "detect-engine-hrhhd.h"
+#include "detect-engine-state.h"
+#include "detect-engine-tag.h"
+#include "detect-fast-pattern.h"
+#include "flow.h"
+#include "flow-timeout.h"
+#include "flow-manager.h"
+#include "flow-var.h"
+#include "flow-bit.h"
+#include "pkt-var.h"
+
+#include "host.h"
+#include "unix-manager.h"
+
+#include "app-layer-detect-proto.h"
+#include "app-layer-parser.h"
+#include "app-layer-smb.h"
+#include "app-layer-dcerpc.h"
+#include "app-layer-dcerpc-udp.h"
+#include "app-layer-htp.h"
+#include "app-layer-ftp.h"
+#include "app-layer-ssl.h"
+#include "app-layer-ssh.h"
+#include "app-layer-smtp.h"
+
+#include "util-action.h"
+#include "util-radix-tree.h"
+#include "util-host-os-info.h"
+#include "util-cidr.h"
+#include "util-unittest-helper.h"
+#include "util-time.h"
+#include "util-rule-vars.h"
+#include "util-classification-config.h"
+#include "util-threshold-config.h"
+#include "util-reference-config.h"
+#include "util-profiling.h"
+#include "util-magic.h"
+#include "util-memcmp.h"
+#include "util-misc.h"
+#include "util-ringbuffer.h"
+#include "util-signal.h"
+
+#include "reputation.h"
+#include "util-atomic.h"
+#include "util-spm.h"
+#include "util-hash.h"
+#include "util-hashlist.h"
+#include "util-bloomfilter.h"
+#include "util-bloomfilter-counting.h"
+#include "util-pool.h"
+#include "util-byte.h"
+#include "util-proto-name.h"
+
+#include "util-mpm-ac.h"
+#include "detect-engine-mpm.h"
+
+#include "util-decode-asn1.h"
+
+#include "conf.h"
+#include "conf-yaml-loader.h"
+#include "tmqh-flow.h"
+#include "defrag.h"
+#include "detect-engine-siggroup.h"
+
+#endif /* UNITTESTS */
+
+void RegisterAllModules();
+void TmqhSetup (void);
+
+int SuriRunUnittests(int list_unittests, char *regex_arg)
+{
+#ifdef UNITTESTS
+    /* Initializations for global vars, queues, etc (memsets, mutex init..) */
+    GlobalInits();
+    TimeInit();
+    SupportFastPatternForSigMatchTypes();
+
+    default_packet_size = DEFAULT_PACKET_SIZE;
+#ifdef __SC_CUDA_SUPPORT__
+    /* Init the CUDA environment */
+    SCCudaInitCudaEnvironment();
+    CudaBufferInit();
+#endif
+    /* load the pattern matchers */
+    MpmTableSetup();
+#ifdef __SC_CUDA_SUPPORT__
+    MpmCudaEnvironmentSetup();
+#endif
+
+    AppLayerDetectProtoThreadInit();
+    AppLayerParsersInitPostProcess();
+
+    /* hardcoded initialization code */
+    SigTableSetup(); /* load the rule keywords */
+    TmqhSetup();
+
+    StorageInit();
+    CIDRInit();
+    SigParsePrepare();
+
+#ifdef DBG_MEM_ALLOC
+    SCLogInfo("Memory used at startup: %"PRIdMAX, (intmax_t)global_mem);
+#endif
+    SCReputationInitCtx();
+    SCProtoNameInit();
+
+    TagInitCtx();
+
+    RegisterAllModules();
+
+    DetectEngineRegisterAppInspectionEngines();
+
+    StorageFinalize();
+   /* test and initialize the unittesting subsystem */
+    if(regex_arg == NULL){
+        regex_arg = ".*";
+        UtRunSelftest(regex_arg); /* inits and cleans up again */
+    }
+
+    AppLayerHtpEnableRequestBodyCallback();
+    AppLayerHtpNeedFileInspection();
+
+    UtInitialize();
+    UTHRegisterTests();
+    SCReputationRegisterTests();
+    TmModuleRegisterTests();
+    SigTableRegisterTests();
+    HashTableRegisterTests();
+    HashListTableRegisterTests();
+    BloomFilterRegisterTests();
+    BloomFilterCountingRegisterTests();
+    PoolRegisterTests();
+    ByteRegisterTests();
+    MpmRegisterTests();
+    FlowBitRegisterTests();
+    SCPerfRegisterTests();
+    DecodePPPRegisterTests();
+    DecodeVLANRegisterTests();
+    HTPParserRegisterTests();
+    SSLParserRegisterTests();
+    SSHParserRegisterTests();
+    SMBParserRegisterTests();
+    DCERPCParserRegisterTests();
+    DCERPCUDPParserRegisterTests();
+    FTPParserRegisterTests();
+    DecodeRawRegisterTests();
+    DecodePPPOERegisterTests();
+    DecodeICMPV4RegisterTests();
+    DecodeICMPV6RegisterTests();
+    DecodeIPV4RegisterTests();
+    DecodeIPV6RegisterTests();
+    DecodeTCPRegisterTests();
+    DecodeUDPV4RegisterTests();
+    DecodeGRERegisterTests();
+    DecodeAsn1RegisterTests();
+    AlpDetectRegisterTests();
+    ConfRegisterTests();
+    ConfYamlRegisterTests();
+    TmqhFlowRegisterTests();
+    FlowRegisterTests();
+    SCSigRegisterSignatureOrderingTests();
+    SCRadixRegisterTests();
+    DefragRegisterTests();
+    SigGroupHeadRegisterTests();
+    SCHInfoRegisterTests();
+    SCRuleVarsRegisterTests();
+    AppLayerParserRegisterTests();
+    ThreadMacrosRegisterTests();
+    UtilSpmSearchRegistertests();
+    UtilActionRegisterTests();
+    SCClassConfRegisterTests();
+    SCThresholdConfRegisterTests();
+    SCRConfRegisterTests();
+#ifdef __SC_CUDA_SUPPORT__
+    SCCudaRegisterTests();
+#endif
+    PayloadRegisterTests();
+    DcePayloadRegisterTests();
+    UriRegisterTests();
+#ifdef PROFILING
+    SCProfilingRegisterTests();
+#endif
+    DeStateRegisterTests();
+    DetectRingBufferRegisterTests();
+    MemcmpRegisterTests();
+    DetectEngineHttpClientBodyRegisterTests();
+    DetectEngineHttpServerBodyRegisterTests();
+    DetectEngineHttpHeaderRegisterTests();
+    DetectEngineHttpRawHeaderRegisterTests();
+    DetectEngineHttpMethodRegisterTests();
+    DetectEngineHttpCookieRegisterTests();
+    DetectEngineHttpRawUriRegisterTests();
+    DetectEngineHttpStatMsgRegisterTests();
+    DetectEngineHttpStatCodeRegisterTests();
+    DetectEngineHttpUARegisterTests();
+    DetectEngineHttpHHRegisterTests();
+    DetectEngineHttpHRHRegisterTests();
+    DetectEngineRegisterTests();
+    SCLogRegisterTests();
+    SMTPParserRegisterTests();
+    MagicRegisterTests();
+    UtilMiscRegisterTests();
+    DetectAddressTests();
+    DetectProtoTests();
+    DetectPortTests();
+    SCAtomicRegisterTests();
+#ifdef __SC_CUDA_SUPPORT__
+    CudaBufferRegisterUnittests();
+#endif
+    if (list_unittests) {
+        UtListTests(regex_arg);
+    } else {
+        uint32_t failed = UtRunTests(regex_arg);
+        UtCleanup();
+#ifdef __SC_CUDA_SUPPORT__
+        if (PatternMatchDefaultMatcher() == MPM_AC_CUDA)
+            MpmCudaBufferDeSetup();
+        CudaHandlerFreeProfiles();
+#endif
+        if (failed) {
+            exit(EXIT_FAILURE);
+        }
+    }
+
+#ifdef DBG_MEM_ALLOC
+    SCLogInfo("Total memory used (without SCFree()): %"PRIdMAX, (intmax_t)global_mem);
+#endif
+
+    exit(EXIT_SUCCESS);
+#else
+    SCLogError(SC_ERR_NOT_SUPPORTED, "Unittests are not build-in");
+    exit(EXIT_FAILURE);
+#endif /* UNITTESTS */
+}
+
diff --git a/src/runmode-unittests.h b/src/runmode-unittests.h
new file mode 100644 (file)
index 0000000..fe15e32
--- /dev/null
@@ -0,0 +1,29 @@
+/* Copyright (C) 2013 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/** \file
+ *
+ *  \author Eric Leblond <eric@regit.org>
+ */
+
+
+#ifndef __UTIL_RUNMODE_UNITTESTS_H__
+#define __UTIL_RUNMODE_UNITTESTS_H__
+
+int SuriRunUnittests(int list_unittests, char *regex_arg);
+
+#endif /* __UTIL_RUNMODE_UNITTESTS_H__ */
index f42d0488758c74338c6051f25bb6a047d1824430..f58664104589deaf0219a3ff88c5c884786decd6 100644 (file)
 
 #include "util-atomic.h"
 #include "util-spm.h"
-#include "util-hash.h"
-#include "util-hashlist.h"
-#include "util-bloomfilter.h"
-#include "util-bloomfilter-counting.h"
-#include "util-pool.h"
-#include "util-byte.h"
 #include "util-cpu.h"
 #include "util-action.h"
 #include "util-pidfile.h"
 #include "util-misc.h"
 #include "util-running-modes.h"
 
-#include "detect-parse.h"
 #include "detect-engine.h"
+#include "detect-parse.h"
+#include "detect-fast-pattern.h"
+#include "detect-engine-tag.h"
 #include "detect-engine-address.h"
-#include "detect-engine-proto.h"
 #include "detect-engine-port.h"
 #include "detect-engine-mpm.h"
-#include "detect-engine-sigorder.h"
-#include "detect-engine-payload.h"
-#include "detect-engine-dcepayload.h"
-#include "detect-engine-uri.h"
-#include "detect-engine-hcbd.h"
-#include "detect-engine-hsbd.h"
-#include "detect-engine-hhd.h"
-#include "detect-engine-hrhd.h"
-#include "detect-engine-hmd.h"
-#include "detect-engine-hcd.h"
-#include "detect-engine-hrud.h"
-#include "detect-engine-hsmd.h"
-#include "detect-engine-hscd.h"
-#include "detect-engine-hua.h"
-#include "detect-engine-hhhd.h"
-#include "detect-engine-hrhhd.h"
-#include "detect-engine-state.h"
-#include "detect-engine-tag.h"
-#include "detect-fast-pattern.h"
 
 #include "tm-queuehandlers.h"
 #include "tm-queues.h"
 #include "host.h"
 #include "unix-manager.h"
 
-#include "app-layer-detect-proto.h"
-#include "app-layer-parser.h"
-#include "app-layer-smb.h"
-#include "app-layer-dcerpc.h"
-#include "app-layer-dcerpc-udp.h"
 #include "app-layer-htp.h"
-#include "app-layer-ftp.h"
-#include "app-layer-ssl.h"
-#include "app-layer-ssh.h"
-#include "app-layer-smtp.h"
 
 #include "util-radix-tree.h"
 #include "util-host-os-info.h"
 #include "defrag.h"
 
 #include "runmodes.h"
+#include "runmode-unittests.h"
 
 #include "util-cuda.h"
 #include "util-decode-asn1.h"
 #include "util-debug.h"
 #include "util-error.h"
-#include "detect-engine-siggroup.h"
 #include "util-daemon.h"
 #include "reputation.h"
 
 
 #include "tmqh-packetpool.h"
 
-#include "util-ringbuffer.h"
-#include "util-mem.h"
-#include "util-memcmp.h"
 #include "util-proto-name.h"
-#include "util-spm-bm.h"
 #ifdef __SC_CUDA_SUPPORT__
 #include "util-cuda-buffer.h"
 #include "util-mpm-ac.h"
@@ -714,6 +677,87 @@ int coverage_unittests;
 int g_ut_modules;
 int g_ut_covered;
 
+void RegisterAllModules()
+{
+    /* nfq */
+    TmModuleReceiveNFQRegister();
+    TmModuleVerdictNFQRegister();
+    TmModuleDecodeNFQRegister();
+    /* ipfw */
+    TmModuleReceiveIPFWRegister();
+    TmModuleVerdictIPFWRegister();
+    TmModuleDecodeIPFWRegister();
+    /* pcap live */
+    TmModuleReceivePcapRegister();
+    TmModuleDecodePcapRegister();
+    /* pcap file */
+    TmModuleReceivePcapFileRegister();
+    TmModuleDecodePcapFileRegister();
+#ifdef HAVE_MPIPE
+    /* mpipe */
+    TmModuleReceiveMpipeRegister();
+    TmModuleDecodeMpipeRegister();
+#endif
+    /* af-packet */
+    TmModuleReceiveAFPRegister();
+    TmModuleDecodeAFPRegister();
+    /* pfring */
+    TmModuleReceivePfringRegister();
+    TmModuleDecodePfringRegister();
+    /* dag file */
+    TmModuleReceiveErfFileRegister();
+    TmModuleDecodeErfFileRegister();
+    /* dag live */
+    TmModuleReceiveErfDagRegister();
+    TmModuleDecodeErfDagRegister();
+    /* napatech */
+    TmModuleNapatechStreamRegister();
+    TmModuleNapatechDecodeRegister();
+
+    /* stream engine */
+    TmModuleStreamTcpRegister();
+    /* detection */
+    TmModuleDetectRegister();
+    /* respond-reject */
+    TmModuleRespondRejectRegister();
+
+    /* fast log */
+    TmModuleAlertFastLogRegister();
+    TmModuleAlertFastLogIPv4Register();
+    TmModuleAlertFastLogIPv6Register();
+    /* debug log */
+    TmModuleAlertDebugLogRegister();
+    /* prelue log */
+    TmModuleAlertPreludeRegister();
+    /* syslog log */
+    TmModuleAlertSyslogRegister();
+    TmModuleAlertSyslogIPv4Register();
+    TmModuleAlertSyslogIPv6Register();
+    /* unified2 log */
+    TmModuleUnified2AlertRegister();
+    /* pcap info log */
+    TmModuleAlertPcapInfoRegister();
+    /* drop log */
+    TmModuleLogDropLogRegister();
+    /* http log */
+    TmModuleLogHttpLogRegister();
+    TmModuleLogHttpLogIPv4Register();
+    TmModuleLogHttpLogIPv6Register();
+    TmModuleLogTlsLogRegister();
+    TmModuleLogTlsLogIPv4Register();
+    TmModuleLogTlsLogIPv6Register();
+    /* pcap log */
+    TmModulePcapLogRegister();
+    /* file log */
+    TmModuleLogFileLogRegister();
+    TmModuleLogFilestoreRegister();
+    /* dns log */
+    TmModuleLogDnsLogRegister();
+    /* cuda */
+    TmModuleDebugList();
+
+}
+
 int main(int argc, char **argv)
 {
     int opt;
@@ -722,9 +766,7 @@ int main(int argc, char **argv)
     int sig_file_exclusive = FALSE;
     int conf_test = 0;
     char *pid_filename = NULL;
-#ifdef UNITTESTS
     char *regex_arg = NULL;
-#endif
     int dump_config = 0;
     int list_app_layer_protocols = 0;
     int list_unittests = 0;
@@ -1332,6 +1374,10 @@ int main(int argc, char **argv)
     }
 #endif
 
+    if (run_mode == RUNMODE_UNITTEST) {
+        return SuriRunUnittests(list_unittests, regex_arg);
+    }
+
 #ifdef REVISION
     SCLogInfo("This is %s version %s (rev %s)", PROG_NAME, PROG_VER, xstr(REVISION));
 #elif defined RELEASE
@@ -1359,20 +1405,12 @@ int main(int argc, char **argv)
     TimeInit();
     SupportFastPatternForSigMatchTypes();
 
-    if (run_mode != RUNMODE_UNITTEST) {
-        if (conf_filename == NULL)
-            conf_filename = DEFAULT_CONF_FILE;
-    }
+    if (conf_filename == NULL)
+        conf_filename = DEFAULT_CONF_FILE;
 
     /** \todo we need an api for these */
     /* Load yaml configuration file if provided. */
     if (conf_filename != NULL) {
-#ifdef UNITTESTS
-        if (run_mode == RUNMODE_UNITTEST) {
-            SCLogError(SC_ERR_CMD_LINE, "should not use a configuration file with unittests");
-            exit(EXIT_FAILURE);
-        }
-#endif
         if (ConfYamlLoadFile(conf_filename) != 0) {
             /* Error already displayed. */
             exit(EXIT_FAILURE);
@@ -1557,83 +1595,7 @@ int main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
-
-    /* nfq */
-    TmModuleReceiveNFQRegister();
-    TmModuleVerdictNFQRegister();
-    TmModuleDecodeNFQRegister();
-    /* ipfw */
-    TmModuleReceiveIPFWRegister();
-    TmModuleVerdictIPFWRegister();
-    TmModuleDecodeIPFWRegister();
-    /* pcap live */
-    TmModuleReceivePcapRegister();
-    TmModuleDecodePcapRegister();
-    /* pcap file */
-    TmModuleReceivePcapFileRegister();
-    TmModuleDecodePcapFileRegister();
-#ifdef HAVE_MPIPE
-    /* mpipe */
-    TmModuleReceiveMpipeRegister();
-    TmModuleDecodeMpipeRegister();
-#endif
-    /* af-packet */
-    TmModuleReceiveAFPRegister();
-    TmModuleDecodeAFPRegister();
-    /* pfring */
-    TmModuleReceivePfringRegister();
-    TmModuleDecodePfringRegister();
-    /* dag file */
-    TmModuleReceiveErfFileRegister();
-    TmModuleDecodeErfFileRegister();
-    /* dag live */
-    TmModuleReceiveErfDagRegister();
-    TmModuleDecodeErfDagRegister();
-    /* napatech */
-    TmModuleNapatechStreamRegister();
-    TmModuleNapatechDecodeRegister();
-
-    /* stream engine */
-    TmModuleStreamTcpRegister();
-    /* detection */
-    TmModuleDetectRegister();
-    /* respond-reject */
-    TmModuleRespondRejectRegister();
-
-    /* fast log */
-    TmModuleAlertFastLogRegister();
-    TmModuleAlertFastLogIPv4Register();
-    TmModuleAlertFastLogIPv6Register();
-    /* debug log */
-    TmModuleAlertDebugLogRegister();
-    /* prelue log */
-    TmModuleAlertPreludeRegister();
-    /* syslog log */
-    TmModuleAlertSyslogRegister();
-    TmModuleAlertSyslogIPv4Register();
-    TmModuleAlertSyslogIPv6Register();
-    /* unified2 log */
-    TmModuleUnified2AlertRegister();
-    /* pcap info log */
-    TmModuleAlertPcapInfoRegister();
-    /* drop log */
-    TmModuleLogDropLogRegister();
-    /* http log */
-    TmModuleLogHttpLogRegister();
-    TmModuleLogHttpLogIPv4Register();
-    TmModuleLogHttpLogIPv6Register();
-    TmModuleLogTlsLogRegister();
-    TmModuleLogTlsLogIPv4Register();
-    TmModuleLogTlsLogIPv6Register();
-    /* pcap log */
-    TmModulePcapLogRegister();
-    /* file log */
-    TmModuleLogFileLogRegister();
-    TmModuleLogFilestoreRegister();
-    /* dns log */
-    TmModuleLogDnsLogRegister();
-    /* cuda */
-    TmModuleDebugList();
+    RegisterAllModules();
 
     AppLayerHtpNeedFileInspection();
 
@@ -1649,126 +1611,6 @@ int main(int argc, char **argv)
     }
 
     StorageFinalize();
-#ifdef UNITTESTS
-
-    if (run_mode == RUNMODE_UNITTEST) {
-#ifdef DBG_MEM_ALLOC
-        SCLogInfo("Memory used at startup: %"PRIdMAX, (intmax_t)global_mem);
-#endif
-        /* test and initialize the unittesting subsystem */
-        if(regex_arg == NULL && !coverage_unittests){
-            regex_arg = ".*";
-            UtRunSelftest(regex_arg); /* inits and cleans up again */
-        }
-
-        AppLayerHtpEnableRequestBodyCallback();
-        AppLayerHtpNeedFileInspection();
-
-        UtInitialize();
-        UTHRegisterTests();
-        SCReputationRegisterTests();
-        TmModuleRegisterTests();
-        SigTableRegisterTests();
-        HashTableRegisterTests();
-        HashListTableRegisterTests();
-        BloomFilterRegisterTests();
-        BloomFilterCountingRegisterTests();
-        PoolRegisterTests();
-        ByteRegisterTests();
-        MpmRegisterTests();
-        FlowBitRegisterTests();
-        SCPerfRegisterTests();
-
-        DecodePPPRegisterTests();
-        DecodeVLANRegisterTests();
-        DecodeRawRegisterTests();
-        DecodePPPOERegisterTests();
-        DecodeICMPV4RegisterTests();
-        DecodeICMPV6RegisterTests();
-        DecodeIPV4RegisterTests();
-        DecodeIPV6RegisterTests();
-        DecodeTCPRegisterTests();
-        DecodeUDPV4RegisterTests();
-        DecodeGRERegisterTests();
-        DecodeAsn1RegisterTests();
-
-        AlpDetectRegisterTests();
-        ConfRegisterTests();
-        ConfYamlRegisterTests();
-        TmqhFlowRegisterTests();
-        FlowRegisterTests();
-        SCSigRegisterSignatureOrderingTests();
-        SCRadixRegisterTests();
-        DefragRegisterTests();
-        SigGroupHeadRegisterTests();
-        SCHInfoRegisterTests();
-        SCRuleVarsRegisterTests();
-        AppLayerParserRegisterTests();
-        ThreadMacrosRegisterTests();
-        UtilSpmSearchRegistertests();
-        UtilActionRegisterTests();
-        SCClassConfRegisterTests();
-        SCThresholdConfRegisterTests();
-        SCRConfRegisterTests();
-#ifdef __SC_CUDA_SUPPORT__
-        SCCudaRegisterTests();
-#endif
-        PayloadRegisterTests();
-        DcePayloadRegisterTests();
-        UriRegisterTests();
-#ifdef PROFILING
-        SCProfilingRegisterTests();
-#endif
-        DeStateRegisterTests();
-        DetectRingBufferRegisterTests();
-        MemcmpRegisterTests();
-        DetectEngineHttpClientBodyRegisterTests();
-        DetectEngineHttpServerBodyRegisterTests();
-        DetectEngineHttpHeaderRegisterTests();
-        DetectEngineHttpRawHeaderRegisterTests();
-        DetectEngineHttpMethodRegisterTests();
-        DetectEngineHttpCookieRegisterTests();
-        DetectEngineHttpRawUriRegisterTests();
-        DetectEngineHttpStatMsgRegisterTests();
-        DetectEngineHttpStatCodeRegisterTests();
-        DetectEngineHttpUARegisterTests();
-        DetectEngineHttpHHRegisterTests();
-        DetectEngineHttpHRHRegisterTests();
-        DetectEngineRegisterTests();
-        SCLogRegisterTests();
-        MagicRegisterTests();
-        UtilMiscRegisterTests();
-        DetectAddressTests();
-        DetectProtoTests();
-        DetectPortTests();
-        SCAtomicRegisterTests();
-#ifdef __SC_CUDA_SUPPORT__
-        CudaBufferRegisterUnittests();
-#endif
-        StorageRegisterTests();
-        RegisterHostStorageTests();
-
-        if (list_unittests) {
-            UtListTests(regex_arg);
-        } else if (coverage_unittests) {
-            /* nothing */
-            SCLogInfo("%d out of %d code modules have unittests (%.0f%%)",
-                    g_ut_covered, g_ut_modules, (float)((float)g_ut_covered/(float)g_ut_modules)*100);
-        } else {
-            uint32_t failed = UtRunTests(regex_arg);
-            UtCleanup();
-            if (failed) {
-                exit(EXIT_FAILURE);
-            }
-        }
-
-#ifdef DBG_MEM_ALLOC
-        SCLogInfo("Total memory used (without SCFree()): %"PRIdMAX, (intmax_t)global_mem);
-#endif
-
-        exit(EXIT_SUCCESS);
-    }
-#endif /* UNITTESTS */
 
     TmModuleRunInit();
 
index 073199b5eb0da30d02ebab2ca3efe060127ce997..dda9dae3de8c04210494857b0c50cd3a9ea4029d 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "app-layer-detect-proto.h"
 #include "util-cuda.h"
+#include "util-unittest.h"
 
 int SuriListKeywords(const char *keyword_info)
 {
index a2a97fedacb90b22f09226254ab233908710400e..404fd7e0f631fbccd559299eb6130ff5a57d8222 100644 (file)
@@ -30,5 +30,4 @@ int SuriListAppLayerProtocols();
 int SuriListCudaCards();
 #endif
 
-
 #endif /* __UTIL_RUNNING_MODES_H__ */