]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: hide RegisterTests behind ifdef UNITTESTS
authorVictor Julien <victor@inliniac.net>
Tue, 21 Jul 2020 14:04:58 +0000 (16:04 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 24 Jul 2020 11:04:42 +0000 (13:04 +0200)
Update all callers to more aggressively use UNITTESTS guards as well.

114 files changed:
src/detect-app-layer-event.c
src/detect-app-layer-protocol.c
src/detect-asn1.c
src/detect-base64-data.c
src/detect-base64-decode.c
src/detect-bypass.c
src/detect-byte-extract.c
src/detect-bytejump.c
src/detect-bytemath.c
src/detect-bytetest.c
src/detect-cipservice.c
src/detect-classtype.c
src/detect-config.c
src/detect-content.c
src/detect-csum.c
src/detect-dce-iface.c
src/detect-dce-opnum.c
src/detect-dce-stub-data.c
src/detect-depth.c
src/detect-detection-filter.c
src/detect-distance.c
src/detect-dnp3.c
src/detect-dns-query.c
src/detect-dsize.c
src/detect-engine-event.c
src/detect-engine-register.c
src/detect-fast-pattern.c
src/detect-fileext.c
src/detect-filemagic.c
src/detect-filemd5.c
src/detect-filename.c
src/detect-filesha1.c
src/detect-filesha256.c
src/detect-filesize.c
src/detect-filestore.c
src/detect-flow.c
src/detect-flowbits.c
src/detect-flowint.c
src/detect-flowvar.c
src/detect-fragbits.c
src/detect-fragbits.h
src/detect-fragoffset.c
src/detect-ftpbounce.c
src/detect-ftpdata.c
src/detect-geoip.c
src/detect-gid.c
src/detect-gid.h
src/detect-hostbits.c
src/detect-http-request-line.c
src/detect-http-response-line.c
src/detect-icmp-id.c
src/detect-icmp-seq.c
src/detect-icode.c
src/detect-id.c
src/detect-ipopts.c
src/detect-ipproto.c
src/detect-iprep.c
src/detect-isdataat.c
src/detect-itype.c
src/detect-krb5-errcode.c
src/detect-krb5-msgtype.c
src/detect-l3proto.c
src/detect-lua.c
src/detect-mark.c
src/detect-mark.h
src/detect-metadata.c
src/detect-modbus.c
src/detect-msg.c
src/detect-nfs-procedure.c
src/detect-nfs-version.c
src/detect-noalert.c
src/detect-nocase.c
src/detect-offset.c
src/detect-pcre.c
src/detect-pkt-data.c
src/detect-pktvar.c
src/detect-prefilter.c
src/detect-priority.c
src/detect-replace.c
src/detect-rev.c
src/detect-rfb-secresult.c
src/detect-rpc.c
src/detect-sameip.c
src/detect-sid.c
src/detect-ssh-hassh-server-string.c
src/detect-ssh-hassh-server.c
src/detect-ssh-hassh-string.c
src/detect-ssh-hassh.c
src/detect-ssh-proto-version.c
src/detect-ssh-software-version.c
src/detect-stream_size.c
src/detect-tag.c
src/detect-target.c
src/detect-tcp-ack.c
src/detect-tcp-flags.c
src/detect-tcp-flags.h
src/detect-tcp-seq.c
src/detect-tcp-window.c
src/detect-template-rust-buffer.c
src/detect-threshold.c
src/detect-threshold.h
src/detect-tls.c
src/detect-tos.c
src/detect-transform-compress-whitespace.c
src/detect-transform-dotprefix.c
src/detect-transform-md5.c
src/detect-transform-sha1.c
src/detect-transform-sha256.c
src/detect-transform-strip-whitespace.c
src/detect-uricontent.c
src/detect-urilen.c
src/detect-within.c
src/detect-xbits.c
src/detect.h

index e6700f063eddaf974e706b2a97a49742a879bf6c..686131bf34750f033bc24f2965c722e2bdf001b8 100644 (file)
@@ -51,7 +51,9 @@
 static int DetectAppLayerEventPktMatch(DetectEngineThreadCtx *det_ctx,
                                        Packet *p, const Signature *s, const SigMatchCtx *ctx);
 static int DetectAppLayerEventSetupP1(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectAppLayerEventRegisterTests(void);
+#endif
 static void DetectAppLayerEventFree(DetectEngineCtx *, void *);
 static int DetectEngineAptEventInspect(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
@@ -72,9 +74,10 @@ void DetectAppLayerEventRegister(void)
         DetectAppLayerEventPktMatch;
     sigmatch_table[DETECT_AL_APP_LAYER_EVENT].Setup = DetectAppLayerEventSetupP1;
     sigmatch_table[DETECT_AL_APP_LAYER_EVENT].Free = DetectAppLayerEventFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_APP_LAYER_EVENT].RegisterTests =
         DetectAppLayerEventRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("app-layer-events",
             ALPROTO_UNKNOWN, SIG_FLAG_TOSERVER, 0,
             DetectEngineAptEventInspect);
@@ -806,21 +809,17 @@ static int DetectAppLayerEventTest06(void)
     DetectAppLayerEventFree(NULL, aled);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief This function registers unit tests for "app-layer-event" keyword.
  */
-void DetectAppLayerEventRegisterTests(void)
+static void DetectAppLayerEventRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectAppLayerEventTest01", DetectAppLayerEventTest01);
     UtRegisterTest("DetectAppLayerEventTest02", DetectAppLayerEventTest02);
     UtRegisterTest("DetectAppLayerEventTest03", DetectAppLayerEventTest03);
     UtRegisterTest("DetectAppLayerEventTest04", DetectAppLayerEventTest04);
     UtRegisterTest("DetectAppLayerEventTest05", DetectAppLayerEventTest05);
     UtRegisterTest("DetectAppLayerEventTest06", DetectAppLayerEventTest06);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
index 86b7f51b60f7269fc57ca875aeb4e59fd02bd8c4..569d35253bd33065a7f9c20e7e8aa8597258975b 100644 (file)
@@ -33,7 +33,9 @@
 #include "util-unittest.h"
 #include "util-unittest-helper.h"
 
+#ifdef UNITTESTS
 static void DetectAppLayerProtocolRegisterTests(void);
+#endif
 
 static int DetectAppLayerProtocolPacketMatch(
         DetectEngineThreadCtx *det_ctx,
@@ -266,8 +268,10 @@ void DetectAppLayerProtocolRegister(void)
         DetectAppLayerProtocolSetup;
     sigmatch_table[DETECT_AL_APP_LAYER_PROTOCOL].Free =
         DetectAppLayerProtocolFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_APP_LAYER_PROTOCOL].RegisterTests =
         DetectAppLayerProtocolRegisterTests;
+#endif
     sigmatch_table[DETECT_AL_APP_LAYER_PROTOCOL].flags =
         (SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_HANDLE_NEGATION);
 
@@ -544,11 +548,9 @@ static int DetectAppLayerProtocolTest14(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
 
 static void DetectAppLayerProtocolRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectAppLayerProtocolTest01",
                    DetectAppLayerProtocolTest01);
     UtRegisterTest("DetectAppLayerProtocolTest02",
@@ -577,7 +579,5 @@ static void DetectAppLayerProtocolRegisterTests(void)
                    DetectAppLayerProtocolTest13);
     UtRegisterTest("DetectAppLayerProtocolTest14",
                    DetectAppLayerProtocolTest14);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
index 37c5e290ff6310a8a58c6dbee4bdf11494f85707..499f5c81c17ccf79d337cf385df23fa4504f9b5d 100644 (file)
@@ -40,7 +40,9 @@
 static int DetectAsn1Match(DetectEngineThreadCtx *, Packet *,
                      const Signature *, const SigMatchCtx *);
 static int DetectAsn1Setup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectAsn1RegisterTests(void);
+#endif
 static void DetectAsn1Free(DetectEngineCtx *, void *);
 
 /**
@@ -52,9 +54,9 @@ void DetectAsn1Register(void)
     sigmatch_table[DETECT_ASN1].Match = DetectAsn1Match;
     sigmatch_table[DETECT_ASN1].Setup = DetectAsn1Setup;
     sigmatch_table[DETECT_ASN1].Free  = DetectAsn1Free;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ASN1].RegisterTests = DetectAsn1RegisterTests;
-
-    return;
+#endif
 }
 
 /**
@@ -459,18 +461,14 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectAsn1
  */
 static void DetectAsn1RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectAsn1TestReal01", DetectAsn1TestReal01);
     UtRegisterTest("DetectAsn1TestReal02", DetectAsn1TestReal02);
     UtRegisterTest("DetectAsn1TestReal03", DetectAsn1TestReal03);
     UtRegisterTest("DetectAsn1TestReal04", DetectAsn1TestReal04);
-
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index e12d0d06524e94a2fa6cdb5be6ecbaf811cb63f8..d8df651e9298d314f281432f06820f1556c9c0b1 100644 (file)
@@ -25,7 +25,9 @@
 #include "util-unittest.h"
 
 static int DetectBase64DataSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectBase64DataRegisterTests(void);
+#endif
 
 void DetectBase64DataRegister(void)
 {
@@ -35,9 +37,10 @@ void DetectBase64DataRegister(void)
     sigmatch_table[DETECT_BASE64_DATA].url =
         "/rules/base64-keywords.html#base64-data";
     sigmatch_table[DETECT_BASE64_DATA].Setup = DetectBase64DataSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BASE64_DATA].RegisterTests =
         DetectBase64DataRegisterTests;
-
+#endif
     sigmatch_table[DETECT_BASE64_DATA].flags |= SIGMATCH_NOOPT;
 }
 
@@ -247,16 +250,13 @@ end:
     return retval;
 }
 
-#endif
-
 static void DetectBase64DataRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
 
     UtRegisterTest("DetectBase64DataSetupTest01", DetectBase64DataSetupTest01);
     UtRegisterTest("DetectBase64DataSetupTest02", DetectBase64DataSetupTest02);
     UtRegisterTest("DetectBase64DataSetupTest03", DetectBase64DataSetupTest03);
     UtRegisterTest("DetectBase64DataSetupTest04", DetectBase64DataSetupTest04);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 480b755777e3012140ae499c82b0a34cc90ec051..2e047979fd802b441a18bad2fcb52d9200333045 100644 (file)
@@ -34,7 +34,9 @@ static DetectParseRegex decode_pcre;
 
 static int DetectBase64DecodeSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectBase64DecodeFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectBase64DecodeRegisterTests(void);
+#endif
 
 void DetectBase64DecodeRegister(void)
 {
@@ -45,9 +47,10 @@ void DetectBase64DecodeRegister(void)
         "/rules/base64-keywords.html#base64-decode";
     sigmatch_table[DETECT_BASE64_DECODE].Setup = DetectBase64DecodeSetup;
     sigmatch_table[DETECT_BASE64_DECODE].Free = DetectBase64DecodeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BASE64_DECODE].RegisterTests =
         DetectBase64DecodeRegisterTests;
-
+#endif
     sigmatch_table[DETECT_BASE64_DECODE].flags |= SIGMATCH_OPTIONAL_OPT;
 
     DetectSetupParseRegexes(decode_pattern, &decode_pcre);
@@ -657,11 +660,8 @@ end:
     return retval;
 }
 
-#endif
-
 static void DetectBase64DecodeRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_http_header_buffer_id = DetectBufferTypeGetByName("http_header");
 
     UtRegisterTest("DetectBase64TestDecodeParse", DetectBase64TestDecodeParse);
@@ -676,5 +676,5 @@ static void DetectBase64DecodeRegisterTests(void)
                    DetectBase64DecodeTestDecodeLargeOffset);
     UtRegisterTest("DetectBase64DecodeTestDecodeRelative",
                    DetectBase64DecodeTestDecodeRelative);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 5f38517f2cc6f3413806d0b78dbc9ae792fec96c..4ef981d78f610f60f98eee7c916b92caf8c60857 100644 (file)
@@ -53,7 +53,9 @@
 static int DetectBypassMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectBypassSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectBypassRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for keyword: bypass
@@ -66,7 +68,9 @@ void DetectBypassRegister(void)
     sigmatch_table[DETECT_BYPASS].Match = DetectBypassMatch;
     sigmatch_table[DETECT_BYPASS].Setup = DetectBypassSetup;
     sigmatch_table[DETECT_BYPASS].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BYPASS].RegisterTests = DetectBypassRegisterTests;
+#endif
     sigmatch_table[DETECT_BYPASS].flags = SIGMATCH_NOOPT;
 }
 
@@ -232,11 +236,9 @@ static int DetectBypassTestSig01(void)
     SCFree(livedev);
     PASS;
 }
-#endif /* UNITTESTS */
 
 static void DetectBypassRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectBypassTestSig01", DetectBypassTestSig01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index ed65402321f0519961d62cc0186fa94af2efeb8d..5ebd7b19c4e8ee0ec54ab9be81ff6996524b59f3 100644 (file)
@@ -89,7 +89,9 @@
 static DetectParseRegex parse_regex;
 
 static int DetectByteExtractSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectByteExtractRegisterTests(void);
+#endif
 static void DetectByteExtractFree(DetectEngineCtx *, void *);
 
 /**
@@ -103,8 +105,9 @@ void DetectByteExtractRegister(void)
     sigmatch_table[DETECT_BYTE_EXTRACT].Match = NULL;
     sigmatch_table[DETECT_BYTE_EXTRACT].Setup = DetectByteExtractSetup;
     sigmatch_table[DETECT_BYTE_EXTRACT].Free = DetectByteExtractFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BYTE_EXTRACT].RegisterTests = DetectByteExtractRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -4728,11 +4731,8 @@ static int DetectByteExtractTestParseNoBase(void)
     return result;
 }
 
-#endif /* UNITTESTS */
-
 static void DetectByteExtractRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_http_uri_buffer_id = DetectBufferTypeGetByName("http_uri");
 
@@ -4810,7 +4810,5 @@ static void DetectByteExtractRegisterTests(void)
 
     UtRegisterTest("DetectByteExtractTestParseNoBase",
                    DetectByteExtractTestParseNoBase);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
index bc98223945bfaf43e91b381e66c85513008ae36a..c53005fde8228ee08f287edf8ae2965b0e8c0f54 100644 (file)
@@ -65,7 +65,9 @@ static int DetectBytejumpMatch(DetectEngineThreadCtx *det_ctx,
 static DetectBytejumpData *DetectBytejumpParse(DetectEngineCtx *de_ctx, const char *optstr, char **offset);
 static int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr);
 static void DetectBytejumpFree(DetectEngineCtx*, void *ptr);
+#ifdef UNITTESTS
 static void DetectBytejumpRegisterTests(void);
+#endif
 
 void DetectBytejumpRegister (void)
 {
@@ -75,8 +77,9 @@ void DetectBytejumpRegister (void)
     sigmatch_table[DETECT_BYTEJUMP].Match = DetectBytejumpMatch;
     sigmatch_table[DETECT_BYTEJUMP].Setup = DetectBytejumpSetup;
     sigmatch_table[DETECT_BYTEJUMP].Free  = DetectBytejumpFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BYTEJUMP].RegisterTests = DetectBytejumpRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -1339,15 +1342,11 @@ static int DetectByteJumpTestPacket08 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
-
 /**
  * \brief this function registers unit tests for DetectBytejump
  */
 static void DetectBytejumpRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_dce_stub_data_buffer_id = DetectBufferTypeGetByName("dce_stub_data");
 
@@ -1374,6 +1373,5 @@ static void DetectBytejumpRegisterTests(void)
     UtRegisterTest("DetectByteJumpTestPacket06", DetectByteJumpTestPacket06);
     UtRegisterTest("DetectByteJumpTestPacket07", DetectByteJumpTestPacket07);
     UtRegisterTest("DetectByteJumpTestPacket08", DetectByteJumpTestPacket08);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index 67a115f3fb431dcab422c8be81ba985afd828660..f336a571282237e0ee2c0ea50dddc5f870282499 100644 (file)
 static DetectParseRegex parse_regex;
 
 static int DetectByteMathSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectByteMathRegisterTests(void);
+#endif
 static void DetectByteMathFree(DetectEngineCtx *, void *);
 
 /**
@@ -125,8 +127,9 @@ void DetectBytemathRegister(void)
     sigmatch_table[DETECT_BYTEMATH].Match = NULL;
     sigmatch_table[DETECT_BYTEMATH].Setup = DetectByteMathSetup;
     sigmatch_table[DETECT_BYTEMATH].Free = DetectByteMathFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BYTEMATH].RegisterTests = DetectByteMathRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -1171,11 +1174,8 @@ static int DetectByteMathContext01(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 static void DetectByteMathRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectByteMathParseTest01", DetectByteMathParseTest01);
     UtRegisterTest("DetectByteMathParseTest02", DetectByteMathParseTest02);
     UtRegisterTest("DetectByteMathParseTest03", DetectByteMathParseTest03);
@@ -1193,7 +1193,5 @@ static void DetectByteMathRegisterTests(void)
     UtRegisterTest("DetectByteMathParseTest15", DetectByteMathParseTest15);
     UtRegisterTest("DetectByteMathPacket01",    DetectByteMathPacket01);
     UtRegisterTest("DetectByteMathContext01", DetectByteMathContext01);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
index 244108d4f635d2c6ec443dfb2d9ef2b3ca39eae9..eee824246798fcbf408326e942b4555523f00681 100644 (file)
@@ -72,7 +72,9 @@ static int DetectBytetestMatch(DetectEngineThreadCtx *det_ctx,
                         Packet *p, const Signature *s, const SigMatchCtx *ctx);
 static int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr);
 static void DetectBytetestFree(DetectEngineCtx *, void *ptr);
+#ifdef UNITTESTS
 static void DetectBytetestRegisterTests(void);
+#endif
 
 void DetectBytetestRegister (void)
 {
@@ -82,8 +84,9 @@ void DetectBytetestRegister (void)
     sigmatch_table[DETECT_BYTETEST].Match = DetectBytetestMatch;
     sigmatch_table[DETECT_BYTETEST].Setup = DetectBytetestSetup;
     sigmatch_table[DETECT_BYTETEST].Free  = DetectBytetestFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_BYTETEST].RegisterTests = DetectBytetestRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -1668,15 +1671,11 @@ static int DetectByteTestTestPacket06(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
-
 /**
  * \brief this function registers unit tests for DetectBytetest
  */
 static void DetectBytetestRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_dce_stub_data_buffer_id = DetectBufferTypeGetByName("dce_stub_data");
 
@@ -1711,6 +1710,5 @@ static void DetectBytetestRegisterTests(void)
     UtRegisterTest("DetectByteTestTestPacket04", DetectByteTestTestPacket04);
     UtRegisterTest("DetectByteTestTestPacket05", DetectByteTestTestPacket05);
     UtRegisterTest("DetectByteTestTestPacket06", DetectByteTestTestPacket06);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index 765a8a76d2920ac520be6b10f0a0ff63cb4546f6..f6516d344230351fc5b04ce866c791dad7b3cab4 100644 (file)
@@ -41,7 +41,9 @@
  */
 static int DetectCipServiceSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectCipServiceFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectCipServiceRegisterTests(void);
+#endif
 static int g_cip_buffer_id = 0;
 
 /**
@@ -56,9 +58,10 @@ void DetectCipServiceRegister(void)
     sigmatch_table[DETECT_CIPSERVICE].Match = NULL;
     sigmatch_table[DETECT_CIPSERVICE].Setup = DetectCipServiceSetup;
     sigmatch_table[DETECT_CIPSERVICE].Free = DetectCipServiceFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_CIPSERVICE].RegisterTests
             = DetectCipServiceRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("cip",
             ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0,
             DetectEngineInspectCIP);
@@ -272,20 +275,17 @@ static int DetectCipServiceSignatureTest01 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectCipService
  */
 static void DetectCipServiceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectCipServiceParseTest01",
             DetectCipServiceParseTest01);
     UtRegisterTest("DetectCipServiceSignatureTest01",
             DetectCipServiceSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
 
 /*
  * ENIP COMMAND CODE
@@ -296,7 +296,9 @@ static void DetectCipServiceRegisterTests(void)
  */
 static int DetectEnipCommandSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectEnipCommandFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectEnipCommandRegisterTests(void);
+#endif
 static int g_enip_buffer_id = 0;
 
 /**
@@ -311,9 +313,10 @@ void DetectEnipCommandRegister(void)
     sigmatch_table[DETECT_ENIPCOMMAND].Match = NULL;
     sigmatch_table[DETECT_ENIPCOMMAND].Setup = DetectEnipCommandSetup;
     sigmatch_table[DETECT_ENIPCOMMAND].Free = DetectEnipCommandFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ENIPCOMMAND].RegisterTests
             = DetectEnipCommandRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("enip",
             ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0,
             DetectEngineInspectENIP);
@@ -448,17 +451,14 @@ static int DetectEnipCommandSignatureTest01 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectEnipCommand
  */
 static void DetectEnipCommandRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectEnipCommandParseTest01",
             DetectEnipCommandParseTest01);
     UtRegisterTest("DetectEnipCommandSignatureTest01",
             DetectEnipCommandSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 24a2c9ad512af857cc3ee311288f668cfce4902e..dc60a85c9505ebff5b7898d33d3100dc80702836 100644 (file)
@@ -41,7 +41,9 @@
 static DetectParseRegex parse_regex;
 
 static int DetectClasstypeSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectClasstypeRegisterTests(void);
+#endif
 
 /**
  * \brief Registers the handler functions for the "Classtype" keyword.
@@ -52,8 +54,9 @@ void DetectClasstypeRegister(void)
     sigmatch_table[DETECT_CLASSTYPE].desc = "information about the classification of rules and alerts";
     sigmatch_table[DETECT_CLASSTYPE].url = "/rules/meta.html#classtype";
     sigmatch_table[DETECT_CLASSTYPE].Setup = DetectClasstypeSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_CLASSTYPE].RegisterTests = DetectClasstypeRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -297,16 +300,13 @@ static int DetectClasstypeTest03(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief This function registers unit tests for Classification Config API.
  */
 static void DetectClasstypeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectClasstypeTest01", DetectClasstypeTest01);
     UtRegisterTest("DetectClasstypeTest02", DetectClasstypeTest02);
     UtRegisterTest("DetectClasstypeTest03", DetectClasstypeTest03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 37d0d7a1aa8168e3421fd534dd577c73d5f5173c..f5bea5b92239cbf8b6cee1ee4057e7b272cef026 100644 (file)
@@ -67,7 +67,9 @@ static int DetectConfigPostMatch (DetectEngineThreadCtx *det_ctx, Packet *p,
         const Signature *s, const SigMatchCtx *ctx);
 static int DetectConfigSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectConfigFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectConfigRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for keyword: filestore
@@ -78,8 +80,9 @@ void DetectConfigRegister(void)
     sigmatch_table[DETECT_CONFIG].Match = DetectConfigPostMatch;
     sigmatch_table[DETECT_CONFIG].Setup = DetectConfigSetup;
     sigmatch_table[DETECT_CONFIG].Free  = DetectConfigFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_CONFIG].RegisterTests = DetectConfigRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -318,11 +321,9 @@ static int DetectConfigTest01(void)
     DetectEngineCtxFree(de_ctx);
     PASS;
 }
-#endif /* UNITTESTS */
 
 void DetectConfigRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectConfigTest01", DetectConfigTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index bfadd6ddc6dbc35e7d80b51ce2430eea7b2f7da5..dbd72fc046b16b63f0c0e0a184266b6af8be968f 100644 (file)
@@ -50,7 +50,9 @@
 #include "util-profiling.h"
 #include "detect-dsize.h"
 
+#ifdef UNITTESTS
 static void DetectContentRegisterTests(void);
+#endif
 
 void DetectContentRegister (void)
 {
@@ -60,7 +62,9 @@ void DetectContentRegister (void)
     sigmatch_table[DETECT_CONTENT].Match = NULL;
     sigmatch_table[DETECT_CONTENT].Setup = DetectContentSetup;
     sigmatch_table[DETECT_CONTENT].Free  = DetectContentFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_CONTENT].RegisterTests = DetectContentRegisterTests;
+#endif
     sigmatch_table[DETECT_CONTENT].flags = (SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION);
 }
 
@@ -2992,14 +2996,11 @@ static int DetectLongContentTest3(void)
     return !DetectLongContentTestCommon(sig, 1);
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectContent
  */
 static void DetectContentRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_dce_stub_data_buffer_id = DetectBufferTypeGetByName("dce_stub_data");
 
@@ -3113,5 +3114,5 @@ static void DetectContentRegisterTests(void)
     UtRegisterTest("DetectLongContentTest1", DetectLongContentTest1);
     UtRegisterTest("DetectLongContentTest2", DetectLongContentTest2);
     UtRegisterTest("DetectLongContentTest3", DetectLongContentTest3);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 64442e14cfd5b375f169a3e1ecb450cd4ea3fb6b..2dfe0b61f8281211d3dcbdfa5a864b87bfafbd30 100644 (file)
@@ -81,7 +81,9 @@ static int DetectICMPV6CsumMatch(DetectEngineThreadCtx *,
 static int DetectICMPV6CsumSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectICMPV6CsumFree(DetectEngineCtx *, void *);
 
+#ifdef UNITTESTS
 static void DetectCsumRegisterTests(void);
+#endif
 
 /**
  * \brief Registers handlers for all the checksum keywords.  The checksum
@@ -131,45 +133,39 @@ void DetectCsumRegister (void)
     sigmatch_table[DETECT_IPV4_CSUM].Match = DetectIPV4CsumMatch;
     sigmatch_table[DETECT_IPV4_CSUM].Setup = DetectIPV4CsumSetup;
     sigmatch_table[DETECT_IPV4_CSUM].Free  = DetectIPV4CsumFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_IPV4_CSUM].RegisterTests = DetectCsumRegisterTests;
+#endif
 
     sigmatch_table[DETECT_TCPV4_CSUM].name = "tcpv4-csum";
     sigmatch_table[DETECT_TCPV4_CSUM].Match = DetectTCPV4CsumMatch;
     sigmatch_table[DETECT_TCPV4_CSUM].Setup = DetectTCPV4CsumSetup;
     sigmatch_table[DETECT_TCPV4_CSUM].Free  = DetectTCPV4CsumFree;
-    sigmatch_table[DETECT_TCPV4_CSUM].RegisterTests = NULL;
 
     sigmatch_table[DETECT_TCPV6_CSUM].name = "tcpv6-csum";
     sigmatch_table[DETECT_TCPV6_CSUM].Match = DetectTCPV6CsumMatch;
     sigmatch_table[DETECT_TCPV6_CSUM].Setup = DetectTCPV6CsumSetup;
     sigmatch_table[DETECT_TCPV6_CSUM].Free  = DetectTCPV6CsumFree;
-    sigmatch_table[DETECT_TCPV6_CSUM].RegisterTests = NULL;
 
     sigmatch_table[DETECT_UDPV4_CSUM].name = "udpv4-csum";
     sigmatch_table[DETECT_UDPV4_CSUM].Match = DetectUDPV4CsumMatch;
     sigmatch_table[DETECT_UDPV4_CSUM].Setup = DetectUDPV4CsumSetup;
     sigmatch_table[DETECT_UDPV4_CSUM].Free  = DetectUDPV4CsumFree;
-    sigmatch_table[DETECT_UDPV4_CSUM].RegisterTests = NULL;
 
     sigmatch_table[DETECT_UDPV6_CSUM].name = "udpv6-csum";
     sigmatch_table[DETECT_UDPV6_CSUM].Match = DetectUDPV6CsumMatch;
     sigmatch_table[DETECT_UDPV6_CSUM].Setup = DetectUDPV6CsumSetup;
     sigmatch_table[DETECT_UDPV6_CSUM].Free  = DetectUDPV6CsumFree;
-    sigmatch_table[DETECT_UDPV6_CSUM].RegisterTests = NULL;
 
     sigmatch_table[DETECT_ICMPV4_CSUM].name = "icmpv4-csum";
     sigmatch_table[DETECT_ICMPV4_CSUM].Match = DetectICMPV4CsumMatch;
     sigmatch_table[DETECT_ICMPV4_CSUM].Setup = DetectICMPV4CsumSetup;
     sigmatch_table[DETECT_ICMPV4_CSUM].Free  = DetectICMPV4CsumFree;
-    sigmatch_table[DETECT_ICMPV4_CSUM].RegisterTests = NULL;
 
     sigmatch_table[DETECT_ICMPV6_CSUM].name = "icmpv6-csum";
     sigmatch_table[DETECT_ICMPV6_CSUM].Match = DetectICMPV6CsumMatch;
     sigmatch_table[DETECT_ICMPV6_CSUM].Setup = DetectICMPV6CsumSetup;
     sigmatch_table[DETECT_ICMPV6_CSUM].Free  = DetectICMPV6CsumFree;
-    sigmatch_table[DETECT_ICMPV6_CSUM].RegisterTests = NULL;
-
-    return;
 }
 
 /**
@@ -1056,12 +1052,8 @@ static int DetectCsumICMPV6Test01(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 static void DetectCsumRegisterTests(void)
 {
-#ifdef UNITTESTS
-
     UtRegisterTest("DetectCsumValidArgsTestParse01",
                    DetectCsumValidArgsTestParse01);
     UtRegisterTest("DetectCsumInvalidArgsTestParse02",
@@ -1071,6 +1063,5 @@ static void DetectCsumRegisterTests(void)
 
     UtRegisterTest("DetectCsumICMPV6Test01",
             DetectCsumICMPV6Test01);
-
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 589ca37d54a46cc7445ea18ec4855d9810e4a25f..e3236dfadaf935bb654be953af1bcb68bc05a298 100644 (file)
@@ -58,7 +58,9 @@ static int DetectDceIfaceMatchRust(DetectEngineThreadCtx *det_ctx,
         const Signature *s, const SigMatchCtx *m);
 static int DetectDceIfaceSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectDceIfaceFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectDceIfaceRegisterTests(void);
+#endif
 static int g_dce_generic_list_id = 0;
 
 static int InspectDceGeneric(ThreadVars *tv,
@@ -77,8 +79,9 @@ void DetectDceIfaceRegister(void)
     sigmatch_table[DETECT_DCE_IFACE].AppLayerTxMatch = DetectDceIfaceMatchRust;
     sigmatch_table[DETECT_DCE_IFACE].Setup = DetectDceIfaceSetup;
     sigmatch_table[DETECT_DCE_IFACE].Free  = DetectDceIfaceFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DCE_IFACE].RegisterTests = DetectDceIfaceRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     g_dce_generic_list_id = DetectBufferTypeRegister("dce_generic");
@@ -823,11 +826,8 @@ static int DetectDceIfaceTestParse2(void)
     return result;
 }
 
-#endif
-
 static void DetectDceIfaceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDceIfaceTestParse1", DetectDceIfaceTestParse1);
     /* Disabled because of bug_753.  Would be enabled, once we rewrite
      * dce parser */
@@ -835,5 +835,5 @@ static void DetectDceIfaceRegisterTests(void)
     UtRegisterTest("DetectDceIfaceTestParse13", DetectDceIfaceTestParse13, 1);
 #endif
     UtRegisterTest("DetectDceIfaceTestParse2", DetectDceIfaceTestParse2);
-#endif
 }
+#endif /* UNITTESTS */
index fc64e31670999ded6aed6e17d6bc098eb9f1af02..6344e3aea5f4a485ffec9cc2941d5070ef8d642b 100644 (file)
@@ -59,7 +59,9 @@ static int DetectDceOpnumMatchRust(DetectEngineThreadCtx *det_ctx,
         const Signature *s, const SigMatchCtx *m);
 static int DetectDceOpnumSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectDceOpnumFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectDceOpnumRegisterTests(void);
+#endif
 static int g_dce_generic_list_id = 0;
 
 /**
@@ -72,8 +74,9 @@ void DetectDceOpnumRegister(void)
     sigmatch_table[DETECT_DCE_OPNUM].AppLayerTxMatch = DetectDceOpnumMatchRust;
     sigmatch_table[DETECT_DCE_OPNUM].Setup = DetectDceOpnumSetup;
     sigmatch_table[DETECT_DCE_OPNUM].Free  = DetectDceOpnumFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DCE_OPNUM].RegisterTests = DetectDceOpnumRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     g_dce_generic_list_id = DetectBufferTypeRegister("dce_generic");
@@ -2402,11 +2405,9 @@ static int DetectDceOpnumTestParse13(void)
     return result;
 }
 #endif
-#endif /* UNITTESTS */
 
 static void DetectDceOpnumRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDceOpnumTestParse01", DetectDceOpnumTestParse01);
     UtRegisterTest("DetectDceOpnumTestParse02", DetectDceOpnumTestParse02);
     /* Disabled because of bug_753.  Would be enabled, once we rewrite
@@ -2417,5 +2418,5 @@ static void DetectDceOpnumRegisterTests(void)
     UtRegisterTest("DetectDceOpnumTestParse12", DetectDceOpnumTestParse12, 1);
     UtRegisterTest("DetectDceOpnumTestParse13", DetectDceOpnumTestParse13, 1);
 #endif
-#endif
 }
+#endif /* UNITTESTS */
index 3c7e146fb81a88ab4ba4b3f8980138700724f39c..ace1346d841ebb9a07fea380bdbeba7ae94f664e 100644 (file)
@@ -60,7 +60,9 @@
 #define KEYWORD_NAME "dce_stub_data"
 
 static int DetectDceStubDataSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectDceStubDataRegisterTests(void);
+#endif
 static int g_dce_stub_data_buffer_id = 0;
 
 static InspectionBuffer *GetSMBData(DetectEngineThreadCtx *det_ctx,
@@ -117,7 +119,9 @@ void DetectDceStubDataRegister(void)
     sigmatch_table[DETECT_DCE_STUB_DATA].name = "dcerpc.stub_data";
     sigmatch_table[DETECT_DCE_STUB_DATA].alias = "dce_stub_data";
     sigmatch_table[DETECT_DCE_STUB_DATA].Setup = DetectDceStubDataSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DCE_STUB_DATA].RegisterTests = DetectDceStubDataRegisterTests;
+#endif
     sigmatch_table[DETECT_DCE_STUB_DATA].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerInspectEngineRegister2(BUFFER_NAME,
@@ -1893,12 +1897,8 @@ static int DetectDceStubDataTestParse05(void)
     return result;
 }
 
-
-#endif
-
 static void DetectDceStubDataRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDceStubDataTestParse01",
                    DetectDceStubDataTestParse01);
     UtRegisterTest("DetectDceStubDataTestParse02",
@@ -1909,7 +1909,5 @@ static void DetectDceStubDataRegisterTests(void)
                    DetectDceStubDataTestParse04);
     UtRegisterTest("DetectDceStubDataTestParse05",
                    DetectDceStubDataTestParse05);
-#endif
-
-    return;
 }
+#endif
index 106d96c515b4c173a2fb4c28a98df5562a30886a..1e82aa1c824566033a8e794aa1b6f8768a2bd327 100644 (file)
@@ -53,7 +53,6 @@ void DetectDepthRegister (void)
     sigmatch_table[DETECT_DEPTH].Match = NULL;
     sigmatch_table[DETECT_DEPTH].Setup = DetectDepthSetup;
     sigmatch_table[DETECT_DEPTH].Free  = NULL;
-    sigmatch_table[DETECT_DEPTH].RegisterTests = NULL;
 
     sigmatch_table[DETECT_STARTS_WITH].name = "startswith";
     sigmatch_table[DETECT_STARTS_WITH].desc = "pattern must be at the start of a buffer (same as 'depth:<pattern len>')";
index 85c6439f6fa3f2db3f459157719b52f6b86d1b43..b4f57d1c4ad90f07f32144510605c1723b692aa9 100644 (file)
@@ -53,7 +53,9 @@ static DetectParseRegex parse_regex;
 static int DetectDetectionFilterMatch(DetectEngineThreadCtx *,
         Packet *, const Signature *, const SigMatchCtx *);
 static int DetectDetectionFilterSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectDetectionFilterRegisterTests(void);
+#endif
 static void DetectDetectionFilterFree(DetectEngineCtx *, void *);
 
 /**
@@ -67,7 +69,9 @@ void DetectDetectionFilterRegister (void)
     sigmatch_table[DETECT_DETECTION_FILTER].Match = DetectDetectionFilterMatch;
     sigmatch_table[DETECT_DETECTION_FILTER].Setup = DetectDetectionFilterSetup;
     sigmatch_table[DETECT_DETECTION_FILTER].Free = DetectDetectionFilterFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DETECTION_FILTER].RegisterTests = DetectDetectionFilterRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_DETECTION_FILTER].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -625,11 +629,9 @@ end:
     HostShutdown();
     return result;
 }
-#endif /* UNITTESTS */
 
 static void DetectDetectionFilterRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDetectionFilterTestParse01",
                    DetectDetectionFilterTestParse01);
     UtRegisterTest("DetectDetectionFilterTestParse02",
@@ -648,6 +650,5 @@ static void DetectDetectionFilterRegisterTests(void)
                    DetectDetectionFilterTestSig2);
     UtRegisterTest("DetectDetectionFilterTestSig3",
                    DetectDetectionFilterTestSig3);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index 456ec7ee4d7589de0062e66aacfc0330f12caf0e..11ea8ec30de078425298e31e0f27333d68db6018 100644 (file)
@@ -49,7 +49,9 @@
 #include "util-unittest-helper.h"
 
 static int DetectDistanceSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectDistanceRegisterTests(void);
+#endif
 
 void DetectDistanceRegister(void)
 {
@@ -59,7 +61,9 @@ void DetectDistanceRegister(void)
     sigmatch_table[DETECT_DISTANCE].Match = NULL;
     sigmatch_table[DETECT_DISTANCE].Setup = DetectDistanceSetup;
     sigmatch_table[DETECT_DISTANCE].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DISTANCE].RegisterTests = DetectDistanceRegisterTests;
+#endif
 }
 
 static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
@@ -234,14 +238,11 @@ static int DetectDistanceTestPacket01 (void)
 end:
     return result;
 }
-#endif /* UNITTESTS */
 
 static void DetectDistanceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDistanceTest01 -- distance / within mix",
                    DetectDistanceTest01);
     UtRegisterTest("DetectDistanceTestPacket01", DetectDistanceTestPacket01);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index 4ec6b548846548c9d734f17371e567fd202a82d8..ea1cb1c7f57f043da17c63aba1c581403622167b 100644 (file)
@@ -121,10 +121,12 @@ DNP3Mapping DNP3FunctionNameMap[] = {
     {"authenticate_resp",    131}
 };
 
+#ifdef UNITTESTS
 static void DetectDNP3FuncRegisterTests(void);
 static void DetectDNP3IndRegisterTests(void);
 static void DetectDNP3ObjRegisterTests(void);
 static void DetectDNP3DataRegisterTests(void);
+#endif
 
 /**
  * \brief Utility function to trim leading and trailing whitespace
@@ -498,9 +500,10 @@ static void DetectDNP3FuncRegister(void)
     sigmatch_table[DETECT_AL_DNP3FUNC].AppLayerTxMatch = DetectDNP3FuncMatch;
     sigmatch_table[DETECT_AL_DNP3FUNC].Setup         = DetectDNP3FuncSetup;
     sigmatch_table[DETECT_AL_DNP3FUNC].Free          = DetectDNP3Free;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_DNP3FUNC].RegisterTests =
         DetectDNP3FuncRegisterTests;
-
+#endif
     SCReturn;
 }
 
@@ -516,9 +519,10 @@ static void DetectDNP3IndRegister(void)
     sigmatch_table[DETECT_AL_DNP3IND].AppLayerTxMatch = DetectDNP3IndMatch;
     sigmatch_table[DETECT_AL_DNP3IND].Setup         = DetectDNP3IndSetup;
     sigmatch_table[DETECT_AL_DNP3IND].Free          = DetectDNP3Free;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_DNP3IND].RegisterTests =
         DetectDNP3IndRegisterTests;
-
+#endif
     SCReturn;
 }
 
@@ -534,9 +538,10 @@ static void DetectDNP3ObjRegister(void)
     sigmatch_table[DETECT_AL_DNP3OBJ].AppLayerTxMatch = DetectDNP3ObjMatch;
     sigmatch_table[DETECT_AL_DNP3OBJ].Setup         = DetectDNP3ObjSetup;
     sigmatch_table[DETECT_AL_DNP3OBJ].Free          = DetectDNP3Free;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_DNP3OBJ].RegisterTests =
         DetectDNP3ObjRegisterTests;
-
+#endif
     SCReturn;
 }
 
@@ -561,9 +566,10 @@ static void DetectDNP3DataRegister(void)
     sigmatch_table[DETECT_AL_DNP3DATA].desc          = "make the following content options to match on the re-assembled application buffer";
     sigmatch_table[DETECT_AL_DNP3DATA].url           = "/rules/dnp3-keywords.html#dnp3-data";
     sigmatch_table[DETECT_AL_DNP3DATA].Setup         = DetectDNP3DataSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_DNP3DATA].RegisterTests =
         DetectDNP3DataRegisterTests;
-
+#endif
     sigmatch_table[DETECT_AL_DNP3DATA].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerInspectEngineRegister2("dnp3_data",
@@ -1029,39 +1035,30 @@ static int DetectDNP3DataTest02(void)
     PASS;
 }
 
-#endif
-
 static void DetectDNP3FuncRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDNP3FuncParseFunctionCodeTest",
                    DetectDNP3FuncParseFunctionCodeTest);
     UtRegisterTest("DetectDNP3FuncTest01", DetectDNP3FuncTest01);
-#endif
 }
 
 static void DetectDNP3IndRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDNP3IndTestParseAsInteger",
                    DetectDNP3IndTestParseAsInteger);
     UtRegisterTest("DetectDNP3IndTestParseByName",
                    DetectDNP3IndTestParseByName);
-#endif
 }
 
 static void DetectDNP3ObjRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDNP3ObjParseTest", DetectDNP3ObjParseTest);
     UtRegisterTest("DetectDNP3ObjSetupTest", DetectDNP3ObjSetupTest);
-#endif
 }
 
 void DetectDNP3DataRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDNP3DataTest01", DetectDNP3DataTest01);
     UtRegisterTest("DetectDNP3DataTest02", DetectDNP3DataTest02);
-#endif
 }
+#endif
index 86291ac4fcee749ec81782754b67d6814c51eda0..cdd39c44d8a28711836a5ad67dff3b100ff335b2 100644 (file)
@@ -62,7 +62,9 @@
 #include "rust.h"
 
 static int DetectDnsQuerySetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectDnsQueryRegisterTests(void);
+#endif
 static int g_dns_query_buffer_id = 0;
 
 struct DnsQueryGetDataArgs {
@@ -210,7 +212,9 @@ void DetectDnsQueryRegister (void)
     sigmatch_table[DETECT_AL_DNS_QUERY].desc = "sticky buffer to match DNS query-buffer";
     sigmatch_table[DETECT_AL_DNS_QUERY].url = "/rules/dns-keywords.html#dns-query";
     sigmatch_table[DETECT_AL_DNS_QUERY].Setup = DetectDnsQuerySetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_DNS_QUERY].RegisterTests = DetectDnsQueryRegisterTests;
+#endif
     sigmatch_table[DETECT_AL_DNS_QUERY].flags |= SIGMATCH_NOOPT;
     sigmatch_table[DETECT_AL_DNS_QUERY].flags |= SIGMATCH_INFO_STICKY_BUFFER;
 
@@ -1248,11 +1252,8 @@ static int DetectDnsQueryIsdataatParseTest(void)
     PASS;
 }
 
-#endif
-
 static void DetectDnsQueryRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectDnsQueryTest01", DetectDnsQueryTest01);
     UtRegisterTest("DetectDnsQueryTest02", DetectDnsQueryTest02);
     UtRegisterTest("DetectDnsQueryTest03 -- tcp", DetectDnsQueryTest03);
@@ -1266,5 +1267,5 @@ static void DetectDnsQueryRegisterTests(void)
 
     UtRegisterTest("DetectDnsQueryIsdataatParseTest",
             DetectDnsQueryIsdataatParseTest);
-#endif
 }
+#endif
index 69f0577bbc97a9e2a1e39b5eab6dac6ba2adcee0..164bd05602b5a40158fd00577e68276153703802 100644 (file)
@@ -52,7 +52,9 @@ static DetectParseRegex parse_regex;
 static int DetectDsizeMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectDsizeSetup (DetectEngineCtx *, Signature *s, const char *str);
+#ifdef UNITTESTS
 static void DsizeRegisterTests(void);
+#endif
 static void DetectDsizeFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -69,8 +71,9 @@ void DetectDsizeRegister (void)
     sigmatch_table[DETECT_DSIZE].Match = DetectDsizeMatch;
     sigmatch_table[DETECT_DSIZE].Setup = DetectDsizeSetup;
     sigmatch_table[DETECT_DSIZE].Free  = DetectDsizeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_DSIZE].RegisterTests = DsizeRegisterTests;
-
+#endif
     sigmatch_table[DETECT_DSIZE].SupportsPrefilter = PrefilterDsizeIsPrefilterable;
     sigmatch_table[DETECT_DSIZE].SetupPrefilter = PrefilterSetupDsize;
 
@@ -954,14 +957,12 @@ end:
     return result;
 
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for dsize
  */
 static void DsizeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DsizeTestParse01", DsizeTestParse01);
     UtRegisterTest("DsizeTestParse02", DsizeTestParse02);
     UtRegisterTest("DsizeTestParse03", DsizeTestParse03);
@@ -984,6 +985,5 @@ static void DsizeRegisterTests(void)
     UtRegisterTest("DsizeTestParse20", DsizeTestParse20);
 
     UtRegisterTest("DetectDsizeIcmpv6Test01", DetectDsizeIcmpv6Test01);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index f746a960b22bc07369e7131e74eb064189fd9c41..f81186e825852e26877e7f82eb5b2d62369327bd 100644 (file)
@@ -52,8 +52,9 @@ static int DetectEngineEventSetup (DetectEngineCtx *, Signature *, const char *)
 static int DetectDecodeEventSetup (DetectEngineCtx *, Signature *, const char *);
 static int DetectStreamEventSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectEngineEventFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 void EngineEventRegisterTests(void);
-
+#endif
 
 /**
  * \brief Registration function for decode-event: keyword
@@ -64,7 +65,9 @@ void DetectEngineEventRegister (void)
     sigmatch_table[DETECT_ENGINE_EVENT].Match = DetectEngineEventMatch;
     sigmatch_table[DETECT_ENGINE_EVENT].Setup = DetectEngineEventSetup;
     sigmatch_table[DETECT_ENGINE_EVENT].Free  = DetectEngineEventFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ENGINE_EVENT].RegisterTests = EngineEventRegisterTests;
+#endif
 
     sigmatch_table[DETECT_DECODE_EVENT].name = "decode-event";
     sigmatch_table[DETECT_DECODE_EVENT].Match = DetectEngineEventMatch;
@@ -378,19 +381,17 @@ error:
     SCFree(p);
     return 0;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for EngineEvent
  */
 void EngineEventRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("EngineEventTestParse01", EngineEventTestParse01);
     UtRegisterTest("EngineEventTestParse02", EngineEventTestParse02);
     UtRegisterTest("EngineEventTestParse03", EngineEventTestParse03);
     UtRegisterTest("EngineEventTestParse04", EngineEventTestParse04);
     UtRegisterTest("EngineEventTestParse05", EngineEventTestParse05);
     UtRegisterTest("EngineEventTestParse06", EngineEventTestParse06);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 1a81f0c52eeb7f03bc01d062493e73f7cccbd518..3773b3534de3ffae125a1a0e50bf569a3c0c5062 100644 (file)
@@ -602,11 +602,11 @@ void SigTableSetup(void)
     DetectBufferTypeCloseRegistration();
 }
 
+#ifdef UNITTESTS
 void SigTableRegisterTests(void)
 {
     /* register the tests */
-    int i = 0;
-    for (i = 0; i < DETECT_TBLSIZE; i++) {
+    for (int i = 0; i < DETECT_TBLSIZE; i++) {
         g_ut_modules++;
         if (sigmatch_table[i].RegisterTests != NULL) {
             sigmatch_table[i].RegisterTests();
@@ -621,3 +621,4 @@ void SigTableRegisterTests(void)
         }
     }
 }
+#endif
index b7c60078bc19cea9d9c74fda7167d37f9ff9e758..0a3d0d1fc146516829fdfeeba3943ae51d41f712 100644 (file)
@@ -43,7 +43,9 @@
 static DetectParseRegex parse_regex;
 
 static int DetectFastPatternSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectFastPatternRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectFastPatternRegisterTests(void);
+#endif
 
 /* holds the list of sm match lists that need to be searched for a keyword
  * that has fp support */
@@ -170,8 +172,9 @@ void DetectFastPatternRegister(void)
     sigmatch_table[DETECT_FAST_PATTERN].Match = NULL;
     sigmatch_table[DETECT_FAST_PATTERN].Setup = DetectFastPatternSetup;
     sigmatch_table[DETECT_FAST_PATTERN].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FAST_PATTERN].RegisterTests = DetectFastPatternRegisterTests;
-
+#endif
     sigmatch_table[DETECT_FAST_PATTERN].flags |= SIGMATCH_NOOPT;
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
@@ -18864,11 +18867,8 @@ static int DetectFastPatternTest671(void)
     PASS;
 }
 
-#endif
-
-void DetectFastPatternRegisterTests(void)
+static void DetectFastPatternRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_http_method_buffer_id = DetectBufferTypeGetByName("http_method");
     g_http_uri_buffer_id = DetectBufferTypeGetByName("http_uri");
@@ -19584,7 +19584,5 @@ void DetectFastPatternRegisterTests(void)
      * - if 2 duplicate patterns, with no chop set get unique ids.
      */
     UtRegisterTest("DetectFastPatternTest671", DetectFastPatternTest671);
-#endif
-
-    return;
 }
+#endif
index ae116ec47bf6bbf0be8d4c22f3c88891acc85750..2856bfda4c33076c4c7509647240a8693df07868 100644 (file)
@@ -54,7 +54,9 @@
 static int DetectFileextMatch (DetectEngineThreadCtx *, Flow *,
         uint8_t, File *, const Signature *, const SigMatchCtx *);
 static int DetectFileextSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFileextRegisterTests(void);
+#endif
 static void DetectFileextFree(DetectEngineCtx *, void *);
 static int g_file_match_list_id = 0;
 
@@ -69,7 +71,9 @@ void DetectFileextRegister(void)
     sigmatch_table[DETECT_FILEEXT].FileMatch = DetectFileextMatch;
     sigmatch_table[DETECT_FILEEXT].Setup = DetectFileextSetup;
     sigmatch_table[DETECT_FILEEXT].Free  = DetectFileextFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILEEXT].RegisterTests = DetectFileextRegisterTests;
+#endif
     sigmatch_table[DETECT_FILEEXT].flags = SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_FILEEXT].alternative = DETECT_FILE_NAME;
 
@@ -293,16 +297,13 @@ static int DetectFileextTestParse03 (void)
     return 0;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFileext
  */
 void DetectFileextRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectFileextTestParse01", DetectFileextTestParse01);
     UtRegisterTest("DetectFileextTestParse02", DetectFileextTestParse02);
     UtRegisterTest("DetectFileextTestParse03", DetectFileextTestParse03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 51ab4ba9e69882f8e206aab55feeac3444e2f6d3..6d53c4705a58d0d88ce738737e87883f04fcf1de 100644 (file)
@@ -81,7 +81,9 @@ void DetectFilemagicRegister(void)
 static int DetectFilemagicMatch (DetectEngineThreadCtx *, Flow *,
         uint8_t, File *, const Signature *, const SigMatchCtx *);
 static int DetectFilemagicSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFilemagicRegisterTests(void);
+#endif
 static void DetectFilemagicFree(DetectEngineCtx *, void *);
 static int g_file_match_list_id = 0;
 
@@ -110,7 +112,9 @@ void DetectFilemagicRegister(void)
     sigmatch_table[DETECT_FILEMAGIC].FileMatch = DetectFilemagicMatch;
     sigmatch_table[DETECT_FILEMAGIC].Setup = DetectFilemagicSetup;
     sigmatch_table[DETECT_FILEMAGIC].Free  = DetectFilemagicFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILEMAGIC].RegisterTests = DetectFilemagicRegisterTests;
+#endif
     sigmatch_table[DETECT_FILEMAGIC].flags = SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_FILEMAGIC].alternative = DETECT_FILE_MAGIC;
 
@@ -632,19 +636,15 @@ static int DetectFilemagicTestParse03 (void)
     return 0;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFilemagic
  */
 void DetectFilemagicRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectFilemagicTestParse01", DetectFilemagicTestParse01);
     UtRegisterTest("DetectFilemagicTestParse02", DetectFilemagicTestParse02);
     UtRegisterTest("DetectFilemagicTestParse03", DetectFilemagicTestParse03);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
 #endif /* HAVE_MAGIC */
 
index cd629698a1253125388613697049eaf957f694c4..5ca10ee159bd0b6c7bed92b52f77ebf6faf9b5f7 100644 (file)
@@ -45,10 +45,7 @@ static int DetectFileMd5SetupNoSupport (DetectEngineCtx *a, Signature *b, const
 void DetectFileMd5Register(void)
 {
     sigmatch_table[DETECT_FILEMD5].name = "filemd5";
-    sigmatch_table[DETECT_FILEMD5].FileMatch = NULL;
     sigmatch_table[DETECT_FILEMD5].Setup = DetectFileMd5SetupNoSupport;
-    sigmatch_table[DETECT_FILEMD5].Free  = NULL;
-    sigmatch_table[DETECT_FILEMD5].RegisterTests = NULL;
     sigmatch_table[DETECT_FILEMD5].flags = SIGMATCH_NOT_BUILT;
 
     SCLogDebug("registering filemd5 rule option");
@@ -60,7 +57,9 @@ void DetectFileMd5Register(void)
 static int g_file_match_list_id = 0;
 
 static int DetectFileMd5Setup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFileMd5RegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for keyword: filemd5
@@ -73,8 +72,9 @@ void DetectFileMd5Register(void)
     sigmatch_table[DETECT_FILEMD5].FileMatch = DetectFileHashMatch;
     sigmatch_table[DETECT_FILEMD5].Setup = DetectFileMd5Setup;
     sigmatch_table[DETECT_FILEMD5].Free  = DetectFileHashFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILEMD5].RegisterTests = DetectFileMd5RegisterTests;
-
+#endif
     g_file_match_list_id = DetectBufferTypeRegister("files");
 
     SCLogDebug("registering filemd5 rule option");
@@ -153,14 +153,12 @@ static int MD5MatchTest01(void)
     ROHashFree(hash);
     return 1;
 }
-#endif
 
 void DetectFileMd5RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("MD5MatchTest01", MD5MatchTest01);
-#endif
 }
+#endif
 
 #endif /* HAVE_NSS */
 
index fd2d9a1f73f58e74dfa51b7982e3a47425b6d864..7e6fd36d4d9fe2a20807d8a28b5f94a1ea90acce 100644 (file)
@@ -58,7 +58,9 @@ static int DetectFilenameMatch (DetectEngineThreadCtx *, Flow *,
         uint8_t, File *, const Signature *, const SigMatchCtx *);
 static int DetectFilenameSetup (DetectEngineCtx *, Signature *, const char *);
 static int DetectFilenameSetupSticky(DetectEngineCtx *de_ctx, Signature *s, const char *str);
+#ifdef UNITTESTS
 static void DetectFilenameRegisterTests(void);
+#endif
 static void DetectFilenameFree(DetectEngineCtx *, void *);
 static int g_file_match_list_id = 0;
 static int g_file_name_buffer_id = 0;
@@ -83,7 +85,9 @@ void DetectFilenameRegister(void)
     sigmatch_table[DETECT_FILENAME].FileMatch = DetectFilenameMatch;
     sigmatch_table[DETECT_FILENAME].Setup = DetectFilenameSetup;
     sigmatch_table[DETECT_FILENAME].Free  = DetectFilenameFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILENAME].RegisterTests = DetectFilenameRegisterTests;
+#endif
     sigmatch_table[DETECT_FILENAME].flags = SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_FILENAME].alternative = DETECT_FILE_NAME;
 
@@ -555,18 +559,16 @@ static int DetectFilenameTestParse03 (void)
     return 0;
 }
 
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for DetectFilename
  */
 void DetectFilenameRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectFilenameSignatureParseTest01", DetectFilenameSignatureParseTest01);
 
     UtRegisterTest("DetectFilenameTestParse01", DetectFilenameTestParse01);
     UtRegisterTest("DetectFilenameTestParse02", DetectFilenameTestParse02);
     UtRegisterTest("DetectFilenameTestParse03", DetectFilenameTestParse03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index beac4209e67f0993d2cf42f54655bab772ef9ae0..7de79d3e29896b0c172670444149d87213455a32 100644 (file)
@@ -46,10 +46,7 @@ static int DetectFileSha1SetupNoSupport (DetectEngineCtx *a, Signature *b, const
 void DetectFileSha1Register(void)
 {
     sigmatch_table[DETECT_FILESHA1].name = "filesha1";
-    sigmatch_table[DETECT_FILESHA1].FileMatch = NULL;
     sigmatch_table[DETECT_FILESHA1].Setup = DetectFileSha1SetupNoSupport;
-    sigmatch_table[DETECT_FILESHA1].Free  = NULL;
-    sigmatch_table[DETECT_FILESHA1].RegisterTests = NULL;
     sigmatch_table[DETECT_FILESHA1].flags = SIGMATCH_NOT_BUILT;
 
     SCLogDebug("registering filesha1 rule option");
@@ -59,7 +56,9 @@ void DetectFileSha1Register(void)
 #else /* HAVE_NSS */
 
 static int DetectFileSha1Setup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFileSha1RegisterTests(void);
+#endif
 static int g_file_match_list_id = 0;
 
 /**
@@ -73,8 +72,9 @@ void DetectFileSha1Register(void)
     sigmatch_table[DETECT_FILESHA1].FileMatch = DetectFileHashMatch;
     sigmatch_table[DETECT_FILESHA1].Setup = DetectFileSha1Setup;
     sigmatch_table[DETECT_FILESHA1].Free  = DetectFileHashFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILESHA1].RegisterTests = DetectFileSha1RegisterTests;
-
+#endif
     g_file_match_list_id = DetectBufferTypeRegister("files");
 
     SCLogDebug("registering filesha1 rule option");
@@ -153,13 +153,10 @@ static int SHA1MatchTest01(void)
     ROHashFree(hash);
     return 1;
 }
-#endif
 
-void DetectFileSha1RegisterTests(void)
+static void DetectFileSha1RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("SHA1MatchTest01", SHA1MatchTest01);
-#endif
 }
-
+#endif
 #endif /* HAVE_NSS */
index 1157b8d9ab613458f93c87831b3381b89577dc06..d76e97442c7a4f390f4de287c5d5210165a2e59f 100644 (file)
@@ -46,10 +46,7 @@ static int DetectFileSha256SetupNoSupport (DetectEngineCtx *a, Signature *b, con
 void DetectFileSha256Register(void)
 {
     sigmatch_table[DETECT_FILESHA256].name = "filesha256";
-    sigmatch_table[DETECT_FILESHA256].FileMatch = NULL;
     sigmatch_table[DETECT_FILESHA256].Setup = DetectFileSha256SetupNoSupport;
-    sigmatch_table[DETECT_FILESHA256].Free  = NULL;
-    sigmatch_table[DETECT_FILESHA256].RegisterTests = NULL;
     sigmatch_table[DETECT_FILESHA256].flags = SIGMATCH_NOT_BUILT;
 
     SCLogDebug("registering filesha256 rule option");
@@ -59,7 +56,9 @@ void DetectFileSha256Register(void)
 #else /* HAVE_NSS */
 
 static int DetectFileSha256Setup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFileSha256RegisterTests(void);
+#endif
 static int g_file_match_list_id = 0;
 
 /**
@@ -73,7 +72,9 @@ void DetectFileSha256Register(void)
     sigmatch_table[DETECT_FILESHA256].FileMatch = DetectFileHashMatch;
     sigmatch_table[DETECT_FILESHA256].Setup = DetectFileSha256Setup;
     sigmatch_table[DETECT_FILESHA256].Free  = DetectFileHashFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILESHA256].RegisterTests = DetectFileSha256RegisterTests;
+#endif
 
     g_file_match_list_id = DetectBufferTypeRegister("files");
 
@@ -153,13 +154,10 @@ static int SHA256MatchTest01(void)
     ROHashFree(hash);
     return 1;
 }
-#endif
 
 void DetectFileSha256RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("SHA256MatchTest01", SHA256MatchTest01);
-#endif
 }
-
+#endif
 #endif /* HAVE_NSS */
index 50a9145d46ff07e8123e8e5647e0bd90f4c96f32..999c6b5cfbe3e0618a38e4f00800375d0e226a5f 100644 (file)
@@ -53,7 +53,9 @@ static int DetectFilesizeMatch (DetectEngineThreadCtx *det_ctx, Flow *f,
         uint8_t flags, File *file, const Signature *s, const SigMatchCtx *m);
 static int DetectFilesizeSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectFilesizeFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectFilesizeRegisterTests (void);
+#endif
 static int g_file_match_list_id = 0;
 
 /**
@@ -68,8 +70,9 @@ void DetectFilesizeRegister(void)
     sigmatch_table[DETECT_FILESIZE].FileMatch = DetectFilesizeMatch;
     sigmatch_table[DETECT_FILESIZE].Setup = DetectFilesizeSetup;
     sigmatch_table[DETECT_FILESIZE].Free = DetectFilesizeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILESIZE].RegisterTests = DetectFilesizeRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     g_file_match_list_id = DetectBufferTypeRegister("files");
@@ -481,19 +484,16 @@ end:
     return res;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFilesize
  */
 void DetectFilesizeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectFilesizeParseTest01", DetectFilesizeParseTest01);
     UtRegisterTest("DetectFilesizeParseTest02", DetectFilesizeParseTest02);
     UtRegisterTest("DetectFilesizeParseTest03", DetectFilesizeParseTest03);
     UtRegisterTest("DetectFilesizeParseTest04", DetectFilesizeParseTest04);
     UtRegisterTest("DetectFilesizeParseTest05", DetectFilesizeParseTest05);
     UtRegisterTest("DetectFilesizeSetpTest01", DetectFilesizeSetpTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 47d2ac0b2061d99d8c4463aa490e8f698014a372..9b6c5a1a49e51a598b6087635b9d6fb775e02317 100644 (file)
@@ -67,7 +67,9 @@ static int DetectFilestorePostMatch(DetectEngineThreadCtx *det_ctx,
         Packet *p, const Signature *s, const SigMatchCtx *ctx);
 static int DetectFilestoreSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectFilestoreFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectFilestoreRegisterTests(void);
+#endif
 static int g_file_match_list_id = 0;
 
 /**
@@ -81,7 +83,9 @@ void DetectFilestoreRegister(void)
     sigmatch_table[DETECT_FILESTORE].FileMatch = DetectFilestoreMatch;
     sigmatch_table[DETECT_FILESTORE].Setup = DetectFilestoreSetup;
     sigmatch_table[DETECT_FILESTORE].Free  = DetectFilestoreFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FILESTORE].RegisterTests = DetectFilestoreRegisterTests;
+#endif
     sigmatch_table[DETECT_FILESTORE].flags = SIGMATCH_OPTIONAL_OPT;
 
     sigmatch_table[DETECT_FILESTORE_POSTMATCH].name = "__filestore__postmatch__";
@@ -508,11 +512,9 @@ static int DetectFilestoreTest01(void)
 
     return result;
 }
-#endif /* UNITTESTS */
 
 void DetectFilestoreRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectFilestoreTest01", DetectFilestoreTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 306c8db007a8cd155ef06406e0de1bab12fb489c..e4ad564352550cbc6dde009840193086cc3e246b 100644 (file)
@@ -51,7 +51,9 @@ static DetectParseRegex parse_regex;
 int DetectFlowMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectFlowSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectFlowRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectFlowRegisterTests(void);
+#endif
 void DetectFlowFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -68,8 +70,9 @@ void DetectFlowRegister (void)
     sigmatch_table[DETECT_FLOW].Match = DetectFlowMatch;
     sigmatch_table[DETECT_FLOW].Setup = DetectFlowSetup;
     sigmatch_table[DETECT_FLOW].Free  = DetectFlowFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FLOW].RegisterTests = DetectFlowRegisterTests;
-
+#endif
     sigmatch_table[DETECT_FLOW].SupportsPrefilter = PrefilterFlowIsPrefilterable;
     sigmatch_table[DETECT_FLOW].SetupPrefilter = PrefilterSetupFlow;
 
@@ -1061,14 +1064,11 @@ static int DetectFlowTestOnlyFragMatch(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFlow
  */
-void DetectFlowRegisterTests(void)
+static void DetectFlowRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectFlowTestParse01", DetectFlowTestParse01);
     UtRegisterTest("DetectFlowTestParse02", DetectFlowTestParse02);
     UtRegisterTest("DetectFlowTestParse03", DetectFlowTestParse03);
@@ -1114,5 +1114,5 @@ void DetectFlowRegisterTests(void)
     UtRegisterTest("DetectFlowTestOnlyFragMatch", DetectFlowTestOnlyFragMatch);
 
     UtRegisterTest("DetectFlowSigTest01", DetectFlowSigTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index cbe46784116b9e7ba616fb73951d979602673fb5..d5b1cf4e4b948e50081f105a76dc552f701535a8 100644 (file)
@@ -55,7 +55,9 @@ int DetectFlowbitMatch (DetectEngineThreadCtx *, Packet *,
 static int DetectFlowbitSetup (DetectEngineCtx *, Signature *, const char *);
 static int FlowbitOrAddData(DetectEngineCtx *, DetectFlowbitsData *, char *);
 void DetectFlowbitFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 void FlowBitsRegisterTests(void);
+#endif
 
 void DetectFlowbitsRegister (void)
 {
@@ -65,7 +67,9 @@ void DetectFlowbitsRegister (void)
     sigmatch_table[DETECT_FLOWBITS].Match = DetectFlowbitMatch;
     sigmatch_table[DETECT_FLOWBITS].Setup = DetectFlowbitSetup;
     sigmatch_table[DETECT_FLOWBITS].Free  = DetectFlowbitFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FLOWBITS].RegisterTests = FlowBitsRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_FLOWBITS].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -1395,14 +1399,12 @@ static int FlowBitsTestSig11(void)
     SCFree(p);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for FlowBits
  */
 void FlowBitsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("FlowBitsTestParse01", FlowBitsTestParse01);
     UtRegisterTest("FlowBitsTestSig01", FlowBitsTestSig01);
     UtRegisterTest("FlowBitsTestSig02", FlowBitsTestSig02);
@@ -1415,5 +1417,5 @@ void FlowBitsRegisterTests(void)
     UtRegisterTest("FlowBitsTestSig09", FlowBitsTestSig09);
     UtRegisterTest("FlowBitsTestSig10", FlowBitsTestSig10);
     UtRegisterTest("FlowBitsTestSig11", FlowBitsTestSig11);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 62ec3de151a8043c72c9bf83cfb6eef84a6df65a..db97ee9f49d73c139359cb1e329510133bf4d34f 100644 (file)
@@ -56,7 +56,9 @@ int DetectFlowintMatch(DetectEngineThreadCtx *, Packet *,
                        const Signature *, const SigMatchCtx *);
 static int DetectFlowintSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectFlowintFree(DetectEngineCtx *, void *);
-void DetectFlowintRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectFlowintRegisterTests(void);
+#endif
 
 void DetectFlowintRegister(void)
 {
@@ -66,8 +68,9 @@ void DetectFlowintRegister(void)
     sigmatch_table[DETECT_FLOWINT].Match = DetectFlowintMatch;
     sigmatch_table[DETECT_FLOWINT].Setup = DetectFlowintSetup;
     sigmatch_table[DETECT_FLOWINT].Free = DetectFlowintFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FLOWINT].RegisterTests = DetectFlowintRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -1300,14 +1303,11 @@ static int DetectFlowintTestPacket03Real(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFlowint
  */
 void DetectFlowintRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectFlowintTestParseVal01", DetectFlowintTestParseVal01);
     UtRegisterTest("DetectFlowintTestParseVar01", DetectFlowintTestParseVar01);
     UtRegisterTest("DetectFlowintTestParseVal02", DetectFlowintTestParseVal02);
@@ -1336,5 +1336,5 @@ void DetectFlowintRegisterTests(void)
                    DetectFlowintTestPacket02Real);
     UtRegisterTest("DetectFlowintTestPacket03Real",
                    DetectFlowintTestPacket03Real);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index b7d93ecd228a21b225518c08fae6c941cf3f0471..4e90785e90ba00b7efa292bb70658fe08e5de9ec 100644 (file)
@@ -57,14 +57,12 @@ void DetectFlowvarRegister (void)
     sigmatch_table[DETECT_FLOWVAR].Match = DetectFlowvarMatch;
     sigmatch_table[DETECT_FLOWVAR].Setup = DetectFlowvarSetup;
     sigmatch_table[DETECT_FLOWVAR].Free  = DetectFlowvarDataFree;
-    sigmatch_table[DETECT_FLOWVAR].RegisterTests  = NULL;
 
     /* post-match for flowvar storage */
     sigmatch_table[DETECT_FLOWVAR_POSTMATCH].name = "__flowvar__postmatch__";
     sigmatch_table[DETECT_FLOWVAR_POSTMATCH].Match = DetectFlowvarPostMatch;
     sigmatch_table[DETECT_FLOWVAR_POSTMATCH].Setup = NULL;
     sigmatch_table[DETECT_FLOWVAR_POSTMATCH].Free  = DetectFlowvarDataFree;
-    sigmatch_table[DETECT_FLOWVAR_POSTMATCH].RegisterTests  = NULL;
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
index 632a1298c1bef99c3919b07dc621f64f61dd2ba2..81092a580bb0c26865a6e138ca4c16469a7406b2 100644 (file)
@@ -74,6 +74,9 @@ static void DetectFragBitsFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static bool PrefilterFragBitsIsPrefilterable(const Signature *s);
+#ifdef UNITTESTS
+static void FragBitsRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for fragbits: keyword
@@ -87,8 +90,9 @@ void DetectFragBitsRegister (void)
     sigmatch_table[DETECT_FRAGBITS].Match = DetectFragBitsMatch;
     sigmatch_table[DETECT_FRAGBITS].Setup = DetectFragBitsSetup;
     sigmatch_table[DETECT_FRAGBITS].Free  = DetectFragBitsFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FRAGBITS].RegisterTests = FragBitsRegisterTests;
-
+#endif
     sigmatch_table[DETECT_FRAGBITS].SetupPrefilter = PrefilterSetupFragBits;
     sigmatch_table[DETECT_FRAGBITS].SupportsPrefilter = PrefilterFragBitsIsPrefilterable;
 
@@ -593,17 +597,15 @@ static int FragBitsTestParse04 (void)
     SCFree(p);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for FragBits
  */
-void FragBitsRegisterTests(void)
+static void FragBitsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("FragBitsTestParse01", FragBitsTestParse01);
     UtRegisterTest("FragBitsTestParse02", FragBitsTestParse02);
     UtRegisterTest("FragBitsTestParse03", FragBitsTestParse03);
     UtRegisterTest("FragBitsTestParse04", FragBitsTestParse04);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index d8588667033480cb213de505287ccb854e8c6cd7..e2d77cc29b144ec9963f5356f57c405313eece32 100644 (file)
@@ -49,10 +49,4 @@ typedef struct DetectFragBitsData_ {
 
 void DetectFragBitsRegister (void);
 
-/**
- * This function registers unit tests for FragBits
- */
-
-void FragBitsRegisterTests(void);
-
 #endif /*__DETECT_FRAGBITS_H__ */
index ffb46c88a7e0f2b183e018fbb413f911cf4a13ce..0a793267f6d763a586923b7fdf1fd522766d16da 100644 (file)
@@ -46,7 +46,9 @@ static DetectParseRegex parse_regex;
 static int DetectFragOffsetMatch(DetectEngineThreadCtx *,
         Packet *, const Signature *, const SigMatchCtx *);
 static int DetectFragOffsetSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 void DetectFragOffsetRegisterTests(void);
+#endif
 void DetectFragOffsetFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -63,8 +65,9 @@ void DetectFragOffsetRegister (void)
     sigmatch_table[DETECT_FRAGOFFSET].Match = DetectFragOffsetMatch;
     sigmatch_table[DETECT_FRAGOFFSET].Setup = DetectFragOffsetSetup;
     sigmatch_table[DETECT_FRAGOFFSET].Free = DetectFragOffsetFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FRAGOFFSET].RegisterTests = DetectFragOffsetRegisterTests;
-
+#endif
     sigmatch_table[DETECT_FRAGOFFSET].SupportsPrefilter = PrefilterFragOffsetIsPrefilterable;
     sigmatch_table[DETECT_FRAGOFFSET].SetupPrefilter = PrefilterSetupFragOffset;
 
@@ -446,15 +449,12 @@ end:
     return result;
 
 }
-#endif /* UNITTESTS */
 
 void DetectFragOffsetRegisterTests (void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectFragOffsetParseTest01", DetectFragOffsetParseTest01);
     UtRegisterTest("DetectFragOffsetParseTest02", DetectFragOffsetParseTest02);
     UtRegisterTest("DetectFragOffsetParseTest03", DetectFragOffsetParseTest03);
     UtRegisterTest("DetectFragOffsetMatchTest01", DetectFragOffsetMatchTest01);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index d489580d74ae8c3d2173401ca49e873756cbf056..77ac3e9891b942d90d81cb1a51ede1c55706d227 100644 (file)
@@ -52,7 +52,9 @@ static int DetectFtpbounceALMatch(DetectEngineThreadCtx *,
         const Signature *, const SigMatchCtx *);
 
 static int DetectFtpbounceSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectFtpbounceRegisterTests(void);
+#endif
 static int g_ftp_request_list_id = 0;
 
 static int InspectFtpRequest(ThreadVars *tv,
@@ -71,7 +73,9 @@ void DetectFtpbounceRegister(void)
     sigmatch_table[DETECT_FTPBOUNCE].desc = "detect FTP bounce attacks";
     sigmatch_table[DETECT_FTPBOUNCE].Setup = DetectFtpbounceSetup;
     sigmatch_table[DETECT_FTPBOUNCE].AppLayerTxMatch = DetectFtpbounceALMatch;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FTPBOUNCE].RegisterTests = DetectFtpbounceRegisterTests;
+#endif
     sigmatch_table[DETECT_FTPBOUNCE].url = "/rules/ftp-keywords.html#ftpbounce";
     sigmatch_table[DETECT_FTPBOUNCE].flags = SIGMATCH_NOOPT;
 
@@ -558,18 +562,15 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFtpbounce
  */
-void DetectFtpbounceRegisterTests(void)
+static void DetectFtpbounceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectFtpbounceTestSetup01", DetectFtpbounceTestSetup01);
     UtRegisterTest("DetectFtpbounceTestALMatch02",
                    DetectFtpbounceTestALMatch02);
     UtRegisterTest("DetectFtpbounceTestALMatch03",
                    DetectFtpbounceTestALMatch03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 33834278c0c4be1ab45506e564b4b45ac1c073bb..20c670e21739c22186aa3df27a543e0561ec6eda 100644 (file)
@@ -46,7 +46,9 @@ static int DetectFtpdataMatch(DetectEngineThreadCtx *,
         const Signature *, const SigMatchCtx *);
 static int DetectFtpdataSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectFtpdataFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectFtpdataRegisterTests (void);
+#endif
 static int DetectEngineInspectFtpdataGeneric(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
         const Signature *s, const SigMatchData *smd,
@@ -73,8 +75,9 @@ void DetectFtpdataRegister(void) {
      * shutdown, but also during rule reloads. */
     sigmatch_table[DETECT_FTPDATA].Free = DetectFtpdataFree;
     /* registers unittests into the system */
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FTPDATA].RegisterTests = DetectFtpdataRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("ftpdata_command",
             ALPROTO_FTPDATA, SIG_FLAG_TOSERVER, 0,
             DetectEngineInspectFtpdataGeneric);
@@ -251,15 +254,13 @@ static int DetectFtpdataSignatureTest01(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectFtpdata
  */
-void DetectFtpdataRegisterTests(void) {
-#ifdef UNITTESTS
+static void DetectFtpdataRegisterTests(void)
+{
     UtRegisterTest("DetectFtpdataParseTest01", DetectFtpdataParseTest01);
     UtRegisterTest("DetectFtpdataSignatureTest01",
                    DetectFtpdataSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index b7a1fefea0c07c11640073f27a0d9fff9bfd3cec..b72b87cdba64a9f7ece63494fcfb64d1bff9e063 100644 (file)
@@ -59,7 +59,6 @@ void DetectGeoipRegister(void)
     sigmatch_table[DETECT_GEOIP].url = "/rules/header-keywords.html#geoip";
     sigmatch_table[DETECT_GEOIP].Setup = DetectGeoipSetupNoSupport;
     sigmatch_table[DETECT_GEOIP].Free = NULL;
-    sigmatch_table[DETECT_GEOIP].RegisterTests = NULL;
 }
 
 #else /* HAVE_GEOIP */
@@ -69,7 +68,9 @@ void DetectGeoipRegister(void)
 static int DetectGeoipMatch(DetectEngineThreadCtx *, Packet *,
                             const Signature *, const SigMatchCtx *);
 static int DetectGeoipSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectGeoipRegisterTests(void);
+#endif
 static void DetectGeoipDataFree(DetectEngineCtx *, void *);
 
 /**
@@ -84,7 +85,9 @@ void DetectGeoipRegister(void)
     sigmatch_table[DETECT_GEOIP].Match = DetectGeoipMatch;
     sigmatch_table[DETECT_GEOIP].Setup = DetectGeoipSetup;
     sigmatch_table[DETECT_GEOIP].Free = DetectGeoipDataFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_GEOIP].RegisterTests = DetectGeoipRegisterTests;
+#endif
 }
 
 /**
@@ -533,17 +536,12 @@ static int GeoipParseTest07(void)
                                 GEOIP_MATCH_BOTH_FLAG | GEOIP_MATCH_NEGATED);
 }
 
-
-
-#endif /* UNITTESTS */
-
 /**
  * \internal
  * \brief This function registers unit tests for DetectGeoip
  */
 static void DetectGeoipRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("GeoipParseTest01", GeoipParseTest01);
     UtRegisterTest("GeoipParseTest02", GeoipParseTest02);
     UtRegisterTest("GeoipParseTest03", GeoipParseTest03);
@@ -551,8 +549,6 @@ static void DetectGeoipRegisterTests(void)
     UtRegisterTest("GeoipParseTest05", GeoipParseTest05);
     UtRegisterTest("GeoipParseTest06", GeoipParseTest06);
     UtRegisterTest("GeoipParseTest07", GeoipParseTest07);
-
-#endif /* UNITTESTS */
 }
-
-#endif /* HAVE_GEOIP */
+#endif /* UNITTESTS */
+#endif /* HAVE_GEOIP */
\ No newline at end of file
index 684dfed3c7b0184b9e4917604cd53d4e3f7e0163..313e7b7d38f70d14a2be99e930f9fca8cac96d65 100644 (file)
@@ -37,6 +37,9 @@
 #include "util-debug.h"
 
 static int DetectGidSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
+static void GidRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for gid: keyword
@@ -50,7 +53,9 @@ void DetectGidRegister (void)
     sigmatch_table[DETECT_GID].Match = NULL;
     sigmatch_table[DETECT_GID].Setup = DetectGidSetup;
     sigmatch_table[DETECT_GID].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_GID].RegisterTests = GidRegisterTests;
+#endif
 }
 
 /**
@@ -166,16 +171,14 @@ end:
         DetectEngineCtxFree(de_ctx);
     return result;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for Gid
  */
-void GidRegisterTests(void)
+static void GidRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("GidTestParse01", GidTestParse01);
     UtRegisterTest("GidTestParse02", GidTestParse02);
     UtRegisterTest("GidTestParse03", GidTestParse03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index d98d6edcb485495b9d94d5375859b74370340700..aa9a8f9d1f0f8c5e58e276b473497b71174e69d1 100644 (file)
 
 void DetectGidRegister (void);
 
-/**
- * This function registers unit tests for Gid
- */
-
-void GidRegisterTests(void);
-
-#endif /*__DETECT_GID_H__ */
+#endif /*__DETECT_GID_H__ */
\ No newline at end of file
index fa20c4f74b414902bcd23ca34223f40a6b30f7fe..35574150bbf1b2cc8c6ce1c45743fb08fbd57956 100644 (file)
@@ -71,7 +71,9 @@ static int DetectHostbitMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectHostbitSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectHostbitFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 void HostBitsRegisterTests(void);
+#endif
 
 void DetectHostbitsRegister (void)
 {
@@ -81,7 +83,9 @@ void DetectHostbitsRegister (void)
     sigmatch_table[DETECT_HOSTBITS].Match = DetectHostbitMatch;
     sigmatch_table[DETECT_HOSTBITS].Setup = DetectHostbitSetup;
     sigmatch_table[DETECT_HOSTBITS].Free  = DetectHostbitFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_HOSTBITS].RegisterTests = HostBitsRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_HOSTBITS].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -1223,14 +1227,12 @@ static int HostBitsTestSig08(void)
     SCFree(p);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for HostBits
  */
 void HostBitsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("HostBitsTestParse01", HostBitsTestParse01);
     UtRegisterTest("HostBitsTestSig01", HostBitsTestSig01);
     UtRegisterTest("HostBitsTestSig02", HostBitsTestSig02);
@@ -1244,5 +1246,5 @@ void HostBitsRegisterTests(void)
 #endif
     UtRegisterTest("HostBitsTestSig07", HostBitsTestSig07);
     UtRegisterTest("HostBitsTestSig08", HostBitsTestSig08);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 101aa4a95041bd787d6ea45f68e8050e11981456..963ca3d08fc9e146a31a37675afd66322bf4700a 100644 (file)
@@ -61,7 +61,9 @@
 #include "detect-http-request-line.h"
 
 static int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectHttpRequestLineRegisterTests(void);
+#endif
 static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
         const DetectEngineTransforms *transforms,
         Flow *_f, const uint8_t _flow_flags,
@@ -79,8 +81,9 @@ void DetectHttpRequestLineRegister(void)
     sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].url = "/rules/http-keywords.html#http-request-line";
     sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].Match = NULL;
     sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].Setup = DetectHttpRequestLineSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].RegisterTests = DetectHttpRequestLineRegisterTests;
-
+#endif
     sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerInspectEngineRegister2("http_request_line",
@@ -326,18 +329,13 @@ static int DetectHttpRequestLineTest03(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 static void DetectHttpRequestLineRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectHttpRequestLineTest01", DetectHttpRequestLineTest01);
     UtRegisterTest("DetectHttpRequestLineTest02", DetectHttpRequestLineTest02);
     UtRegisterTest("DetectHttpRequestLineTest03", DetectHttpRequestLineTest03);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
 /**
  * @}
  */
index 4fe43da52c9e5451702532b01e5a4c4d70d0fc33..42d7c9a28325de6d2830c874e586d13b9d5d1f24 100644 (file)
@@ -61,7 +61,9 @@
 #include "detect-http-response-line.h"
 
 static int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectHttpResponseLineRegisterTests(void);
+#endif
 static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
         const DetectEngineTransforms *transforms,
         Flow *_f, const uint8_t _flow_flags,
@@ -78,8 +80,9 @@ void DetectHttpResponseLineRegister(void)
     sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].desc = "content modifier to match only on the HTTP response line";
     sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].url = "/rules/http-keywords.html#http-response-line";
     sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].Setup = DetectHttpResponseLineSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].RegisterTests = DetectHttpResponseLineRegisterTests;
-
+#endif
     sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].flags |= SIGMATCH_NOOPT|SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerInspectEngineRegister2("http_response_line",
@@ -256,17 +259,12 @@ static int DetectHttpResponseLineTest02(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 void DetectHttpResponseLineRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectHttpResponseLineTest01", DetectHttpResponseLineTest01);
     UtRegisterTest("DetectHttpResponseLineTest02", DetectHttpResponseLineTest02);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
 /**
  * @}
  */
index 11ea25483ee6b6add88db8a7b8c92c42f6137c7d..c97be24ae36cf655b9fb0acd6e89e4042f022660 100644 (file)
@@ -45,7 +45,9 @@ static DetectParseRegex parse_regex;
 static int DetectIcmpIdMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectIcmpIdRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectIcmpIdRegisterTests(void);
+#endif
 void DetectIcmpIdFree(DetectEngineCtx *, void *);
 static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
@@ -61,8 +63,9 @@ void DetectIcmpIdRegister (void)
     sigmatch_table[DETECT_ICMP_ID].Match = DetectIcmpIdMatch;
     sigmatch_table[DETECT_ICMP_ID].Setup = DetectIcmpIdSetup;
     sigmatch_table[DETECT_ICMP_ID].Free = DetectIcmpIdFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ICMP_ID].RegisterTests = DetectIcmpIdRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ICMP_ID].SupportsPrefilter = PrefilterIcmpIdIsPrefilterable;
     sigmatch_table[DETECT_ICMP_ID].SetupPrefilter = PrefilterSetupIcmpId;
 
@@ -533,11 +536,9 @@ end:
     SCFree(p);
     return result;
 }
-#endif /* UNITTESTS */
 
-void DetectIcmpIdRegisterTests (void)
+static void DetectIcmpIdRegisterTests (void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectIcmpIdParseTest01", DetectIcmpIdParseTest01);
     UtRegisterTest("DetectIcmpIdParseTest02", DetectIcmpIdParseTest02);
     UtRegisterTest("DetectIcmpIdParseTest03", DetectIcmpIdParseTest03);
@@ -545,6 +546,5 @@ void DetectIcmpIdRegisterTests (void)
     UtRegisterTest("DetectIcmpIdParseTest05", DetectIcmpIdParseTest05);
     UtRegisterTest("DetectIcmpIdMatchTest01", DetectIcmpIdMatchTest01);
     UtRegisterTest("DetectIcmpIdMatchTest02", DetectIcmpIdMatchTest02);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
index 06ae82895314fc486995f1ace1f6fcedf68fc4b4..ad15141db22f67da7b2bcab0ea2876d1b3f6b3bc 100644 (file)
@@ -45,7 +45,9 @@ static DetectParseRegex parse_regex;
 static int DetectIcmpSeqMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectIcmpSeqRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectIcmpSeqRegisterTests(void);
+#endif
 void DetectIcmpSeqFree(DetectEngineCtx *, void *);
 static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
@@ -61,8 +63,9 @@ void DetectIcmpSeqRegister (void)
     sigmatch_table[DETECT_ICMP_SEQ].Match = DetectIcmpSeqMatch;
     sigmatch_table[DETECT_ICMP_SEQ].Setup = DetectIcmpSeqSetup;
     sigmatch_table[DETECT_ICMP_SEQ].Free = DetectIcmpSeqFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ICMP_SEQ].RegisterTests = DetectIcmpSeqRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ICMP_SEQ].SupportsPrefilter = PrefilterIcmpSeqIsPrefilterable;
     sigmatch_table[DETECT_ICMP_SEQ].SetupPrefilter = PrefilterSetupIcmpSeq;
 
@@ -427,17 +430,13 @@ cleanup:
     UTHFreePackets(&p, 1);
 end:
     return result;
-
 }
-#endif /* UNITTESTS */
 
-void DetectIcmpSeqRegisterTests (void)
+static void DetectIcmpSeqRegisterTests (void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectIcmpSeqParseTest01", DetectIcmpSeqParseTest01);
     UtRegisterTest("DetectIcmpSeqParseTest02", DetectIcmpSeqParseTest02);
     UtRegisterTest("DetectIcmpSeqParseTest03", DetectIcmpSeqParseTest03);
     UtRegisterTest("DetectIcmpSeqMatchTest01", DetectIcmpSeqMatchTest01);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index f174997a30626d9c9764619eb28919d47ae614ee..a0cadbdacf7c60b0eef7b0a7eddfdfe03601a5d1 100644 (file)
@@ -48,7 +48,9 @@ static DetectParseRegex parse_regex;
 static int DetectICodeMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectICodeSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectICodeRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectICodeRegisterTests(void);
+#endif
 void DetectICodeFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -65,8 +67,9 @@ void DetectICodeRegister (void)
     sigmatch_table[DETECT_ICODE].Match = DetectICodeMatch;
     sigmatch_table[DETECT_ICODE].Setup = DetectICodeSetup;
     sigmatch_table[DETECT_ICODE].Free = DetectICodeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ICODE].RegisterTests = DetectICodeRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ICODE].SupportsPrefilter = PrefilterICodeIsPrefilterable;
     sigmatch_table[DETECT_ICODE].SetupPrefilter = PrefilterSetupICode;
 
@@ -572,14 +575,11 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectICode
  */
 void DetectICodeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectICodeParseTest01", DetectICodeParseTest01);
     UtRegisterTest("DetectICodeParseTest02", DetectICodeParseTest02);
     UtRegisterTest("DetectICodeParseTest03", DetectICodeParseTest03);
@@ -589,5 +589,5 @@ void DetectICodeRegisterTests(void)
     UtRegisterTest("DetectICodeParseTest07", DetectICodeParseTest07);
     UtRegisterTest("DetectICodeParseTest08", DetectICodeParseTest08);
     UtRegisterTest("DetectICodeMatchTest01", DetectICodeMatchTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index a9d2d1ce1b2e463c117bd8903b783f2654c89721..d5d3eebf0fc68f665e5d320951ec8e24ce18674c 100644 (file)
@@ -52,7 +52,9 @@ static DetectParseRegex parse_regex;
 static int DetectIdMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectIdSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectIdRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectIdRegisterTests(void);
+#endif
 void DetectIdFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -69,8 +71,9 @@ void DetectIdRegister (void)
     sigmatch_table[DETECT_ID].Match = DetectIdMatch;
     sigmatch_table[DETECT_ID].Setup = DetectIdSetup;
     sigmatch_table[DETECT_ID].Free  = DetectIdFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ID].RegisterTests = DetectIdRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ID].SupportsPrefilter = PrefilterIdIsPrefilterable;
     sigmatch_table[DETECT_ID].SetupPrefilter = PrefilterSetupId;
 
@@ -388,19 +391,17 @@ static int DetectIdTestMatch01(void)
 end:
     return result;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for DetectId
  */
 void DetectIdRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectIdTestParse01", DetectIdTestParse01);
     UtRegisterTest("DetectIdTestParse02", DetectIdTestParse02);
     UtRegisterTest("DetectIdTestParse03", DetectIdTestParse03);
     UtRegisterTest("DetectIdTestParse04", DetectIdTestParse04);
     UtRegisterTest("DetectIdTestMatch01", DetectIdTestMatch01);
 
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 7d0282f83e0a3ed55f10b9d4ce49a6f70cd21e63..3867e568942535175a0f7c4101db4e5baf97d3fc 100644 (file)
@@ -45,7 +45,9 @@ static DetectParseRegex parse_regex;
 static int DetectIpOptsMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectIpOptsSetup (DetectEngineCtx *, Signature *, const char *);
-void IpOptsRegisterTests(void);
+#ifdef UNITTESTS
+static void IpOptsRegisterTests(void);
+#endif
 void DetectIpOptsFree(DetectEngineCtx *, void *);
 
 /**
@@ -59,8 +61,9 @@ void DetectIpOptsRegister (void)
     sigmatch_table[DETECT_IPOPTS].Match = DetectIpOptsMatch;
     sigmatch_table[DETECT_IPOPTS].Setup = DetectIpOptsSetup;
     sigmatch_table[DETECT_IPOPTS].Free  = DetectIpOptsFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_IPOPTS].RegisterTests = IpOptsRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -349,17 +352,15 @@ error:
     SCFree(p);
     return 1;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for IpOpts
  */
 void IpOptsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("IpOptsTestParse01", IpOptsTestParse01);
     UtRegisterTest("IpOptsTestParse02", IpOptsTestParse02);
     UtRegisterTest("IpOptsTestParse03", IpOptsTestParse03);
     UtRegisterTest("IpOptsTestParse04", IpOptsTestParse04);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 023aa02c845c458ed2c59b6bf505bca41afce661..eefed9845fe084189b6d508acb583e3493a7e868 100644 (file)
@@ -51,7 +51,9 @@
 static DetectParseRegex parse_regex;
 
 static int DetectIPProtoSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectIPProtoRegisterTests(void);
+#endif
 static void DetectIPProtoFree(DetectEngineCtx *, void *);
 
 void DetectIPProtoRegister(void)
@@ -62,7 +64,9 @@ void DetectIPProtoRegister(void)
     sigmatch_table[DETECT_IPPROTO].Match = NULL;
     sigmatch_table[DETECT_IPPROTO].Setup = DetectIPProtoSetup;
     sigmatch_table[DETECT_IPPROTO].Free  = DetectIPProtoFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_IPPROTO].RegisterTests = DetectIPProtoRegisterTests;
+#endif
     sigmatch_table[DETECT_IPPROTO].flags = SIGMATCH_QUOTES_OPTIONAL;
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
@@ -2066,15 +2070,12 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \internal
  * \brief Register ip_proto tests.
  */
 static void DetectIPProtoRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectIPProtoTestParse01", DetectIPProtoTestParse01);
     UtRegisterTest("DetectIPProtoTestParse02", DetectIPProtoTestParse02);
     UtRegisterTest("DetectIPProtoTestSetup01", DetectIPProtoTestSetup01);
@@ -2119,5 +2120,5 @@ static void DetectIPProtoRegisterTests(void)
     UtRegisterTest("DetectIPProtoTestSig1", DetectIPProtoTestSig1);
     UtRegisterTest("DetectIPProtoTestSig2", DetectIPProtoTestSig2);
     UtRegisterTest("DetectIPProtoTestSig3", DetectIPProtoTestSig3);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index e418fb2fd637e92716ae6ddb214ca4b40d72c70a..9904b5a1cd53fbeaa08884bb3d13ddb6f95fb3f1 100644 (file)
@@ -56,7 +56,9 @@ static int DetectIPRepMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectIPRepSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectIPRepFree (DetectEngineCtx *, void *);
-void IPRepRegisterTests(void);
+#ifdef UNITTESTS
+static void IPRepRegisterTests(void);
+#endif
 
 void DetectIPRepRegister (void)
 {
@@ -66,7 +68,9 @@ void DetectIPRepRegister (void)
     sigmatch_table[DETECT_IPREP].Match = DetectIPRepMatch;
     sigmatch_table[DETECT_IPREP].Setup = DetectIPRepSetup;
     sigmatch_table[DETECT_IPREP].Free  = DetectIPRepFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_IPREP].RegisterTests = IPRepRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_IPREP].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -997,14 +1001,12 @@ end:
     HostShutdown();
     return result;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for IPRep
  */
 void IPRepRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectIPRepTest01", DetectIPRepTest01);
     UtRegisterTest("DetectIPRepTest02", DetectIPRepTest02);
     UtRegisterTest("DetectIPRepTest03", DetectIPRepTest03);
@@ -1014,5 +1016,5 @@ void IPRepRegisterTests(void)
     UtRegisterTest("DetectIPRepTest07", DetectIPRepTest07);
     UtRegisterTest("DetectIPRepTest08", DetectIPRepTest08);
     UtRegisterTest("DetectIPRepTest09", DetectIPRepTest09);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index c75ae91354ac4a7f61277f7cc1bc8920182a2e44..e5817721151313ad33740cfc8cc7be9c2e710f07 100644 (file)
@@ -54,7 +54,9 @@
 static DetectParseRegex parse_regex;
 
 int DetectIsdataatSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectIsdataatRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectIsdataatRegisterTests(void);
+#endif
 void DetectIsdataatFree(DetectEngineCtx *, void *);
 
 static int DetectEndsWithSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr);
@@ -71,8 +73,9 @@ void DetectIsdataatRegister(void)
     sigmatch_table[DETECT_ISDATAAT].Match = NULL;
     sigmatch_table[DETECT_ISDATAAT].Setup = DetectIsdataatSetup;
     sigmatch_table[DETECT_ISDATAAT].Free  = DetectIsdataatFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ISDATAAT].RegisterTests = DetectIsdataatRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ENDS_WITH].name = "endswith";
     sigmatch_table[DETECT_ENDS_WITH].desc = "make sure the previous content matches exactly at the end of the buffer";
     sigmatch_table[DETECT_ENDS_WITH].url = "/rules/payload-keywords.html#endswith";
@@ -667,14 +670,12 @@ static int DetectIsdataatTestPacket03 (void)
 end:
     return result;
 }
-#endif
 
 /**
  * \brief this function registers unit tests for DetectIsdataat
  */
 void DetectIsdataatRegisterTests(void)
 {
-#ifdef UNITTESTS
     g_dce_stub_data_buffer_id = DetectBufferTypeGetByName("dce_stub_data");
 
     UtRegisterTest("DetectIsdataatTestParse01", DetectIsdataatTestParse01);
@@ -687,5 +688,5 @@ void DetectIsdataatRegisterTests(void)
     UtRegisterTest("DetectIsdataatTestPacket01", DetectIsdataatTestPacket01);
     UtRegisterTest("DetectIsdataatTestPacket02", DetectIsdataatTestPacket02);
     UtRegisterTest("DetectIsdataatTestPacket03", DetectIsdataatTestPacket03);
-#endif
 }
+#endif
\ No newline at end of file
index 4e059cc18ea98822052ec4b1f98777865abeabfe..ba0f2f1397c6ce3165eccd269f7095aecdf6cb75 100644 (file)
@@ -48,7 +48,9 @@ static DetectParseRegex parse_regex;
 static int DetectITypeMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectITypeSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectITypeRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectITypeRegisterTests(void);
+#endif
 void DetectITypeFree(DetectEngineCtx *, void *);
 
 static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
@@ -65,8 +67,9 @@ void DetectITypeRegister (void)
     sigmatch_table[DETECT_ITYPE].Match = DetectITypeMatch;
     sigmatch_table[DETECT_ITYPE].Setup = DetectITypeSetup;
     sigmatch_table[DETECT_ITYPE].Free = DetectITypeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ITYPE].RegisterTests = DetectITypeRegisterTests;
-
+#endif
     sigmatch_table[DETECT_ITYPE].SupportsPrefilter = PrefilterITypeIsPrefilterable;
     sigmatch_table[DETECT_ITYPE].SetupPrefilter = PrefilterSetupIType;
 
@@ -577,15 +580,11 @@ end:
     return result;
 }
 
-
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectIType
  */
 void DetectITypeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectITypeParseTest01", DetectITypeParseTest01);
     UtRegisterTest("DetectITypeParseTest02", DetectITypeParseTest02);
     UtRegisterTest("DetectITypeParseTest03", DetectITypeParseTest03);
@@ -595,5 +594,5 @@ void DetectITypeRegisterTests(void)
     UtRegisterTest("DetectITypeParseTest07", DetectITypeParseTest07);
     UtRegisterTest("DetectITypeParseTest08", DetectITypeParseTest08);
     UtRegisterTest("DetectITypeMatchTest01", DetectITypeMatchTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 1b7de6f214cdd0186ca90e4c61dcbae15dd97240..8272e6d3731fad9e8e16e917579320bae952f8c3 100644 (file)
@@ -45,7 +45,9 @@ static int DetectKrb5ErrCodeMatch (DetectEngineThreadCtx *, Flow *,
                                    const SigMatchCtx *);
 static int DetectKrb5ErrCodeSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectKrb5ErrCodeFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectKrb5ErrCodeRegisterTests (void);
+#endif
 
 static int DetectEngineInspectKRB5Generic(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
@@ -60,7 +62,8 @@ static int g_krb5_err_code_list_id = 0;
  *
  * This function is called once in the 'lifetime' of the engine.
  */
-void DetectKrb5ErrCodeRegister(void) {
+void DetectKrb5ErrCodeRegister(void)
+{
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].name = "krb5_err_code";
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].desc = "match Kerberos 5 error code";
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].url = "/rules/kerberos-keywords.html#krb5-err-code";
@@ -68,8 +71,9 @@ void DetectKrb5ErrCodeRegister(void) {
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].AppLayerTxMatch = DetectKrb5ErrCodeMatch;
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].Setup = DetectKrb5ErrCodeSetup;
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].Free = DetectKrb5ErrCodeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_KRB5_ERRCODE].RegisterTests = DetectKrb5ErrCodeRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("krb5_err_code",
             ALPROTO_KRB5, SIG_FLAG_TOSERVER, 0,
             DetectEngineInspectKRB5Generic);
@@ -223,7 +227,6 @@ static void DetectKrb5ErrCodeFree(DetectEngineCtx *de_ctx, void *ptr) {
 }
 
 #ifdef UNITTESTS
-
 /**
  * \test description of the test
  */
@@ -249,15 +252,13 @@ static int DetectKrb5ErrCodeSignatureTest01 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectKrb5ErrCode
  */
-static void DetectKrb5ErrCodeRegisterTests(void) {
-#ifdef UNITTESTS
+static void DetectKrb5ErrCodeRegisterTests(void)
+{
     UtRegisterTest("DetectKrb5ErrCodeParseTest01", DetectKrb5ErrCodeParseTest01);
     UtRegisterTest("DetectKrb5ErrCodeSignatureTest01",
                    DetectKrb5ErrCodeSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index a7b71a829a6aa0de6941826cfa8a614e05d8c09c..fa730d88ed3d6792526b3e94597a66709fb8a98e 100644 (file)
@@ -45,7 +45,9 @@ static int DetectKrb5MsgTypeMatch (DetectEngineThreadCtx *, Flow *,
                                    const SigMatchCtx *);
 static int DetectKrb5MsgTypeSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectKrb5MsgTypeFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectKrb5MsgTypeRegisterTests (void);
+#endif
 
 static int DetectEngineInspectKRB5Generic(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
@@ -60,7 +62,8 @@ static int g_krb5_msg_type_list_id = 0;
  *
  * This function is called once in the 'lifetime' of the engine.
  */
-void DetectKrb5MsgTypeRegister(void) {
+void DetectKrb5MsgTypeRegister(void)
+{
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].name = "krb5_msg_type";
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].desc = "match Kerberos 5 message type";
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].url = "/rules/kerberos-keywords.html#krb5-msg-type";
@@ -68,8 +71,9 @@ void DetectKrb5MsgTypeRegister(void) {
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].AppLayerTxMatch = DetectKrb5MsgTypeMatch;
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].Setup = DetectKrb5MsgTypeSetup;
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].Free = DetectKrb5MsgTypeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_KRB5_MSGTYPE].RegisterTests = DetectKrb5MsgTypeRegisterTests;
-
+#endif
     DetectAppLayerInspectEngineRegister("krb5_msg_type",
             ALPROTO_KRB5, SIG_FLAG_TOSERVER, 0,
             DetectEngineInspectKRB5Generic);
@@ -246,15 +250,13 @@ static int DetectKrb5MsgTypeSignatureTest01 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectKrb5MsgType
  */
-static void DetectKrb5MsgTypeRegisterTests(void) {
-#ifdef UNITTESTS
+static void DetectKrb5MsgTypeRegisterTests(void)
+{
     UtRegisterTest("DetectKrb5MsgTypeParseTest01", DetectKrb5MsgTypeParseTest01);
     UtRegisterTest("DetectKrb5MsgTypeSignatureTest01",
                    DetectKrb5MsgTypeSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 7766231fd994f3a8cb64b2ab6bfbf0c580925ef3..87ef8b6cf8f2fdc3009a4b0a358ad55e45d2498a 100644 (file)
@@ -47,8 +47,9 @@
 #include "util-debug.h"
 
 static int DetectL3ProtoSetup(DetectEngineCtx *, Signature *, const char *);
-
-void DetectL3protoRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectL3protoRegisterTests(void);
+#endif
 
 void DetectL3ProtoRegister(void)
 {
@@ -56,9 +57,9 @@ void DetectL3ProtoRegister(void)
     sigmatch_table[DETECT_L3PROTO].Match = NULL;
     sigmatch_table[DETECT_L3PROTO].Setup = DetectL3ProtoSetup;
     sigmatch_table[DETECT_L3PROTO].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_L3PROTO].RegisterTests = DetectL3protoRegisterTests;
-
-    return;
+#endif
 }
 /**
  * \internal
@@ -359,17 +360,13 @@ end:
     return result;
 }
 
-
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectL3proto
  */
-void DetectL3protoRegisterTests(void)
+static void DetectL3protoRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectL3protoTestSig1", DetectL3protoTestSig1);
     UtRegisterTest("DetectL3protoTestSig2", DetectL3protoTestSig2);
     UtRegisterTest("DetectL3protoTestSig3", DetectL3protoTestSig3);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 2db5e68c946da5cca2d84073e5a3b14b63db689e..337dcefd9092a4551252d7ff68041f0141003736 100644 (file)
@@ -80,7 +80,6 @@ void DetectLuaRegister(void)
     sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html";
     sigmatch_table[DETECT_LUA].Setup = DetectLuaSetupNoSupport;
     sigmatch_table[DETECT_LUA].Free  = NULL;
-    sigmatch_table[DETECT_LUA].RegisterTests = NULL;
     sigmatch_table[DETECT_LUA].flags = SIGMATCH_NOT_BUILT;
 
        SCLogDebug("registering lua rule option");
@@ -98,7 +97,9 @@ static int DetectLuaAppTxMatch (DetectEngineThreadCtx *det_ctx,
                                 void *state, void *txv, const Signature *s,
                                 const SigMatchCtx *ctx);
 static int DetectLuaSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectLuaRegisterTests(void);
+#endif
 static void DetectLuaFree(DetectEngineCtx *, void *);
 static int g_smtp_generic_list_id = 0;
 
@@ -121,8 +122,9 @@ void DetectLuaRegister(void)
     sigmatch_table[DETECT_LUA].AppLayerTxMatch = DetectLuaAppTxMatch;
     sigmatch_table[DETECT_LUA].Setup = DetectLuaSetup;
     sigmatch_table[DETECT_LUA].Free  = DetectLuaFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_LUA].RegisterTests = DetectLuaRegisterTests;
-
+#endif
     g_smtp_generic_list_id = DetectBufferTypeRegister("smtp_generic");
 
     DetectAppLayerInspectEngineRegister("smtp_generic",
@@ -2051,18 +2053,14 @@ end:
     return result;
 }
 
-#endif
-
 void DetectLuaRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("LuaMatchTest01", LuaMatchTest01);
     UtRegisterTest("LuaMatchTest02", LuaMatchTest02);
     UtRegisterTest("LuaMatchTest03", LuaMatchTest03);
     UtRegisterTest("LuaMatchTest04", LuaMatchTest04);
     UtRegisterTest("LuaMatchTest05", LuaMatchTest05);
     UtRegisterTest("LuaMatchTest06", LuaMatchTest06);
-#endif
 }
-
-#endif /* HAVE_LUAJIT */
+#endif
+#endif /* HAVE_LUAJIT */
\ No newline at end of file
index 0fd5be2557786271504d09e9000299e2ec6ab159..081f42dc9bd74c1e2b6830db622496439a5d5d95 100644 (file)
@@ -45,6 +45,9 @@ static int DetectMarkSetup (DetectEngineCtx *, Signature *, const char *);
 static int DetectMarkPacket(DetectEngineThreadCtx *det_ctx, Packet *p,
         const Signature *s, const SigMatchCtx *ctx);
 void DetectMarkDataFree(DetectEngineCtx *, void *ptr);
+#if defined UNITTESTS && defined NFQ
+static void MarkRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for nfq_set_mark: keyword
@@ -56,8 +59,9 @@ void DetectMarkRegister (void)
     sigmatch_table[DETECT_MARK].Match = DetectMarkPacket;
     sigmatch_table[DETECT_MARK].Setup = DetectMarkSetup;
     sigmatch_table[DETECT_MARK].Free  = DetectMarkDataFree;
+#if defined UNITTESTS && defined NFQ
     sigmatch_table[DETECT_MARK].RegisterTests = MarkRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -326,19 +330,14 @@ static int MarkTestParse04 (void)
     return 0;
 }
 
-
-
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for Mark
  */
-void MarkRegisterTests(void)
+static void MarkRegisterTests(void)
 {
-#if defined UNITTESTS && defined NFQ
     UtRegisterTest("MarkTestParse01", MarkTestParse01);
     UtRegisterTest("MarkTestParse02", MarkTestParse02);
     UtRegisterTest("MarkTestParse03", MarkTestParse03);
     UtRegisterTest("MarkTestParse04", MarkTestParse04);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 3c3b8593d5165a7e910fa1b76f5ba798b2f9c0f4..1c456a4843679c9d5e7ee1839194658f7aee2386 100644 (file)
@@ -52,10 +52,4 @@ typedef struct DetectMarkData_ {
 
 void DetectMarkRegister (void);
 
-/**
- * This function registers unit tests for Mark
- */
-
-void MarkRegisterTests(void);
-
 #endif /*__DETECT_MARK_H__ */
index cceff6163bf6c32bab8a7450165097d8ca35e468..0195521c63c842c89398880effb3278ebd2aaa36 100644 (file)
@@ -35,7 +35,9 @@
 #include "util-unittest.h"
 
 static int DetectMetadataSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectMetadataRegisterTests(void);
+#endif
 
 void DetectMetadataRegister (void)
 {
@@ -45,7 +47,9 @@ void DetectMetadataRegister (void)
     sigmatch_table[DETECT_METADATA].Match = NULL;
     sigmatch_table[DETECT_METADATA].Setup = DetectMetadataSetup;
     sigmatch_table[DETECT_METADATA].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_METADATA].RegisterTests = DetectMetadataRegisterTests;
+#endif
 }
 
 /**
@@ -209,16 +213,12 @@ static int DetectMetadataParseTest02(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectCipService
  */
 static void DetectMetadataRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectMetadataParseTest01", DetectMetadataParseTest01);
     UtRegisterTest("DetectMetadataParseTest02", DetectMetadataParseTest02);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index f064d67308cdaad38ce411812ac6092bf6103063..3fb52819d4f139efae5e4c0a463bc665981d740d 100644 (file)
@@ -77,8 +77,9 @@ static DetectParseRegex access_parse_regex;
 
 static int g_modbus_buffer_id = 0;
 
-
+#ifdef UNITTESTS
 void DetectModbusRegisterTests(void);
+#endif
 
 /** \internal
  *
@@ -555,8 +556,9 @@ void DetectModbusRegister(void)
     sigmatch_table[DETECT_AL_MODBUS].Match         = NULL;
     sigmatch_table[DETECT_AL_MODBUS].Setup         = DetectModbusSetup;
     sigmatch_table[DETECT_AL_MODBUS].Free          = DetectModbusFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_MODBUS].RegisterTests = DetectModbusRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX_UNIT_ID, &unit_id_parse_regex);
     DetectSetupParseRegexes(PARSE_REGEX_FUNCTION, &function_parse_regex);
     DetectSetupParseRegexes(PARSE_REGEX_ACCESS, &access_parse_regex);
@@ -974,14 +976,12 @@ static int DetectModbusTest13(void)
     DetectEngineCtxFree(de_ctx);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for DetectModbus
  */
 void DetectModbusRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectModbusTest01 - Testing function",
                    DetectModbusTest01);
     UtRegisterTest("DetectModbusTest02 - Testing function and subfunction",
@@ -1008,5 +1008,5 @@ void DetectModbusRegisterTests(void)
                    DetectModbusTest12);
     UtRegisterTest("DetectModbusTest13 - Testing a range of unit_id",
                    DetectModbusTest13);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index a8b9ac1174debeb468c7c5ccf5f55d0c789704ff..cf8cb7f3789898e2baca31954300a254fa8c21b3 100644 (file)
@@ -35,7 +35,9 @@
 #include "detect-msg.h"
 
 static int DetectMsgSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectMsgRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectMsgRegisterTests(void);
+#endif
 
 void DetectMsgRegister (void)
 {
@@ -45,7 +47,9 @@ void DetectMsgRegister (void)
     sigmatch_table[DETECT_MSG].Match = NULL;
     sigmatch_table[DETECT_MSG].Setup = DetectMsgSetup;
     sigmatch_table[DETECT_MSG].Free = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_MSG].RegisterTests = DetectMsgRegisterTests;
+#endif
     sigmatch_table[DETECT_MSG].flags = SIGMATCH_QUOTES_MANDATORY;
 }
 
@@ -206,17 +210,13 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectMsg
  */
 void DetectMsgRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectMsgParseTest01", DetectMsgParseTest01);
     UtRegisterTest("DetectMsgParseTest02", DetectMsgParseTest02);
     UtRegisterTest("DetectMsgParseTest03", DetectMsgParseTest03);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index 81c5476b1396efc92ab10aad82e44f380cb61cce..b73c331238c58a82279b0bd365aab23f2c344ac8 100644 (file)
@@ -71,7 +71,9 @@ typedef struct DetectNfsProcedureData_ {
 static DetectNfsProcedureData *DetectNfsProcedureParse (const char *);
 static int DetectNfsProcedureSetup (DetectEngineCtx *, Signature *s, const char *str);
 static void DetectNfsProcedureFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectNfsProcedureRegisterTests(void);
+#endif
 static int g_nfs_request_buffer_id = 0;
 
 static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv,
@@ -96,8 +98,9 @@ void DetectNfsProcedureRegister (void)
     sigmatch_table[DETECT_AL_NFS_PROCEDURE].AppLayerTxMatch = DetectNfsProcedureMatch;
     sigmatch_table[DETECT_AL_NFS_PROCEDURE].Setup = DetectNfsProcedureSetup;
     sigmatch_table[DETECT_AL_NFS_PROCEDURE].Free = DetectNfsProcedureFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_NFS_PROCEDURE].RegisterTests = DetectNfsProcedureRegisterTests;
-
+#endif
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
@@ -608,14 +611,11 @@ static int ValidityTestParse15 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief Register unit tests for nfs_procedure.
  */
 void DetectNfsProcedureRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("ValidityTestParse01", ValidityTestParse01);
     UtRegisterTest("ValidityTestParse02", ValidityTestParse02);
     UtRegisterTest("ValidityTestParse03", ValidityTestParse03);
@@ -631,5 +631,5 @@ void DetectNfsProcedureRegisterTests(void)
     UtRegisterTest("ValidityTestParse13", ValidityTestParse13);
     UtRegisterTest("ValidityTestParse14", ValidityTestParse14);
     UtRegisterTest("ValidityTestParse15", ValidityTestParse15);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 570cbabd7e11daf5b6ee5a8afe9f683debaafcce..2f8ef69575b85f8302ae0b662450b764c4524aa9 100644 (file)
@@ -71,7 +71,9 @@ typedef struct DetectNfsVersionData_ {
 static DetectNfsVersionData *DetectNfsVersionParse (const char *);
 static int DetectNfsVersionSetup (DetectEngineCtx *, Signature *s, const char *str);
 static void DetectNfsVersionFree(DetectEngineCtx *de_ctx, void *);
+#ifdef UNITTESTS
 static void DetectNfsVersionRegisterTests(void);
+#endif
 static int g_nfs_request_buffer_id = 0;
 
 static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv,
@@ -96,8 +98,9 @@ void DetectNfsVersionRegister (void)
     sigmatch_table[DETECT_AL_NFS_VERSION].AppLayerTxMatch = DetectNfsVersionMatch;
     sigmatch_table[DETECT_AL_NFS_VERSION].Setup = DetectNfsVersionSetup;
     sigmatch_table[DETECT_AL_NFS_VERSION].Free = DetectNfsVersionFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_NFS_VERSION].RegisterTests = DetectNfsVersionRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     DetectAppLayerInspectEngineRegister("nfs_request",
@@ -595,14 +598,11 @@ static int ValidityTestParse15 (void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief Register unit tests for nfs_procedure.
  */
 void DetectNfsVersionRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("ValidityTestParse01", ValidityTestParse01);
     UtRegisterTest("ValidityTestParse02", ValidityTestParse02);
     UtRegisterTest("ValidityTestParse03", ValidityTestParse03);
@@ -618,5 +618,5 @@ void DetectNfsVersionRegisterTests(void)
     UtRegisterTest("ValidityTestParse13", ValidityTestParse13);
     UtRegisterTest("ValidityTestParse14", ValidityTestParse14);
     UtRegisterTest("ValidityTestParse15", ValidityTestParse15);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 5625af79ab3ccafd11df1c11d99fa34266a70d02..0a89163e45d04a49aa6c42a6163b9ef7bd421318 100644 (file)
@@ -35,11 +35,7 @@ void DetectNoalertRegister (void)
     sigmatch_table[DETECT_NOALERT].name = "noalert";
     sigmatch_table[DETECT_NOALERT].desc = "no alert will be generated by the rule";
     sigmatch_table[DETECT_NOALERT].url = "/rules/flow-keywords.html";
-    sigmatch_table[DETECT_NOALERT].Match = NULL;
     sigmatch_table[DETECT_NOALERT].Setup = DetectNoalertSetup;
-    sigmatch_table[DETECT_NOALERT].Free  = NULL;
-    sigmatch_table[DETECT_NOALERT].RegisterTests = NULL;
-
     sigmatch_table[DETECT_NOALERT].flags |= SIGMATCH_NOOPT;
 }
 
index fe094c0f5b6c4f28d5afa199229ee21bfba646b0..60f7330597aaf17ca41b8e95a57f0418d439f5e1 100644 (file)
@@ -40,11 +40,7 @@ void DetectNocaseRegister(void)
     sigmatch_table[DETECT_NOCASE].name = "nocase";
     sigmatch_table[DETECT_NOCASE].desc = "modify content match to be case insensitive";
     sigmatch_table[DETECT_NOCASE].url = "/rules/payload-keywords.html#nocase";
-    sigmatch_table[DETECT_NOCASE].Match = NULL;
     sigmatch_table[DETECT_NOCASE].Setup = DetectNocaseSetup;
-    sigmatch_table[DETECT_NOCASE].Free  = NULL;
-    sigmatch_table[DETECT_NOCASE].RegisterTests = NULL;
-
     sigmatch_table[DETECT_NOCASE].flags |= SIGMATCH_NOOPT;
 }
 
index acf0913d56d7c72d650d715f0ab8e33a4e69250c..67dbb5ec963ce2f8b58076bd90c53be508805e3d 100644 (file)
@@ -48,10 +48,7 @@ void DetectOffsetRegister (void)
     sigmatch_table[DETECT_OFFSET].name = "offset";
     sigmatch_table[DETECT_OFFSET].desc = "designate from which byte in the payload will be checked to find a match";
     sigmatch_table[DETECT_OFFSET].url = "/rules/payload-keywords.html#offset";
-    sigmatch_table[DETECT_OFFSET].Match = NULL;
     sigmatch_table[DETECT_OFFSET].Setup = DetectOffsetSetup;
-    sigmatch_table[DETECT_OFFSET].Free  = NULL;
-    sigmatch_table[DETECT_OFFSET].RegisterTests = NULL;
 }
 
 int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *offsetstr)
index 0668814b809475acc40f396209527cfceacab725..c6588ba6ab171f7bde2a92703cace6a9f20cb5fb 100644 (file)
@@ -108,7 +108,9 @@ static inline int DetectPcreExec(DetectEngineThreadCtx *det_ctx, DetectPcreData
 
 static int DetectPcreSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectPcreFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
 static void DetectPcreRegisterTests(void);
+#endif
 
 void DetectPcreRegister (void)
 {
@@ -118,7 +120,9 @@ void DetectPcreRegister (void)
     sigmatch_table[DETECT_PCRE].Match = NULL;
     sigmatch_table[DETECT_PCRE].Setup = DetectPcreSetup;
     sigmatch_table[DETECT_PCRE].Free  = DetectPcreFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_PCRE].RegisterTests  = DetectPcreRegisterTests;
+#endif
     sigmatch_table[DETECT_PCRE].flags = (SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_HANDLE_NEGATION);
 
     intmax_t val = 0;
@@ -3560,14 +3564,11 @@ static int DetectPcreParseCaptureTest(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectPcre
  */
 static void DetectPcreRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
     g_http_header_buffer_id = DetectBufferTypeGetByName("http_header");
     g_dce_stub_data_buffer_id = DetectBufferTypeGetByName("dce_stub_data");
@@ -3649,6 +3650,5 @@ static void DetectPcreRegisterTests(void)
     UtRegisterTest("DetectPcreParseHttpHost", DetectPcreParseHttpHost);
     UtRegisterTest("DetectPcreParseCaptureTest", DetectPcreParseCaptureTest);
 
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index 792597e9d895e5dcd70271722efd62e0cd86e9ac..730d59d2f9974f6e9e1658893482d605e4b2e375 100644 (file)
@@ -44,7 +44,9 @@
 #include "util-unittest-helper.h"
 
 static int DetectPktDataSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectPktDataTestRegister(void);
+#endif
 
 /**
  * \brief Registration function for keyword: file_data
@@ -53,7 +55,9 @@ void DetectPktDataRegister(void)
 {
     sigmatch_table[DETECT_PKT_DATA].name = "pkt_data";
     sigmatch_table[DETECT_PKT_DATA].Setup = DetectPktDataSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_PKT_DATA].RegisterTests = DetectPktDataTestRegister;
+#endif
     sigmatch_table[DETECT_PKT_DATA].flags = SIGMATCH_NOOPT;
 }
 
@@ -123,15 +127,11 @@ static int DetectPktDataTest02(void)
     DetectEngineCtxFree(de_ctx);
     PASS;
 }
-#endif
 
 static void DetectPktDataTestRegister(void)
 {
-#ifdef UNITTESTS
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
-
     UtRegisterTest("DetectPktDataTest01", DetectPktDataTest01);
     UtRegisterTest("DetectPktDataTest02", DetectPktDataTest02);
-#endif
 }
-
+#endif
\ No newline at end of file
index c5e28665f220ad1692dadf873cd2c4ead317e34e..7ddf6938e333aab55444291576c1a4577341e1ef 100644 (file)
@@ -50,7 +50,6 @@ void DetectPktvarRegister (void)
     sigmatch_table[DETECT_PKTVAR].Match = DetectPktvarMatch;
     sigmatch_table[DETECT_PKTVAR].Setup = DetectPktvarSetup;
     sigmatch_table[DETECT_PKTVAR].Free  = DetectPktvarFree;
-    sigmatch_table[DETECT_PKTVAR].RegisterTests  = NULL;
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
index b311b19153d76b3414a99334b2f1880fc2b09ec8..4aab7c16551665ce704ecf52305fd6384efa6317 100644 (file)
@@ -39,11 +39,7 @@ void DetectPrefilterRegister(void)
     sigmatch_table[DETECT_PREFILTER].name = "prefilter";
     sigmatch_table[DETECT_PREFILTER].desc = "force a condition to be used as prefilter";
     sigmatch_table[DETECT_PREFILTER].url = "/rules/prefilter-keywords.html#prefilter";
-    sigmatch_table[DETECT_PREFILTER].Match = NULL;
     sigmatch_table[DETECT_PREFILTER].Setup = DetectPrefilterSetup;
-    sigmatch_table[DETECT_PREFILTER].Free  = NULL;
-    sigmatch_table[DETECT_PREFILTER].RegisterTests = NULL;
-
     sigmatch_table[DETECT_PREFILTER].flags |= SIGMATCH_NOOPT;
 }
 
index c39b880e1182b7da897fff630d1f8d724ba9838e..6860b4ea978b5a65a5341cabd85cd4005fec903e 100644 (file)
@@ -39,7 +39,9 @@
 static DetectParseRegex parse_regex;
 
 static int DetectPrioritySetup (DetectEngineCtx *, Signature *, const char *);
-void SCPriorityRegisterTests(void);
+#ifdef UNITTESTS
+static void PriorityRegisterTests(void);
+#endif
 
 /**
  * \brief Registers the handler functions for the "priority" keyword
@@ -50,8 +52,9 @@ void DetectPriorityRegister (void)
     sigmatch_table[DETECT_PRIORITY].desc = "rules with a higher priority will be examined first";
     sigmatch_table[DETECT_PRIORITY].url = "/rules/meta.html#priority";
     sigmatch_table[DETECT_PRIORITY].Setup = DetectPrioritySetup;
-    sigmatch_table[DETECT_PRIORITY].RegisterTests = SCPriorityRegisterTests;
-
+#ifdef UNITTESTS
+    sigmatch_table[DETECT_PRIORITY].RegisterTests = PriorityRegisterTests;
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -163,15 +166,13 @@ static int DetectPriorityTest02(void)
     DetectEngineCtxFree(de_ctx);
     PASS;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief This function registers unit tests for Classification Config API.
  */
-void SCPriorityRegisterTests(void)
+static void PriorityRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectPriorityTest01", DetectPriorityTest01);
     UtRegisterTest("DetectPriorityTest02", DetectPriorityTest02);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 3e36fee6882fc4fb756f6032ca55f427777790f8..a7384475a0e80491a68041b1bed22942387a65b8 100644 (file)
@@ -60,8 +60,9 @@ extern int run_mode;
 #include "util-profiling.h"
 
 static int DetectReplaceSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectReplaceRegisterTests(void);
-
+#ifdef UNITTESTS
+static void DetectReplaceRegisterTests(void);
+#endif
 static int DetectReplacePostMatch(DetectEngineThreadCtx *det_ctx,
         Packet *p, const Signature *s, const SigMatchCtx *ctx);
 
@@ -72,8 +73,9 @@ void DetectReplaceRegister (void)
     sigmatch_table[DETECT_REPLACE].url = "/rules/payload-keywords.html#replace";
     sigmatch_table[DETECT_REPLACE].Match = DetectReplacePostMatch;
     sigmatch_table[DETECT_REPLACE].Setup = DetectReplaceSetup;
-    sigmatch_table[DETECT_REPLACE].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_REPLACE].RegisterTests = DetectReplaceRegisterTests;
+#endif
     sigmatch_table[DETECT_REPLACE].flags = (SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION);
 }
 
@@ -830,16 +832,11 @@ static int DetectReplaceParseTest07(void)
     return result;
 }
 
-
-
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectContent
  */
 void DetectReplaceRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
 /* matching */
     UtRegisterTest("DetectReplaceMatchTest01", DetectReplaceMatchTest01);
     UtRegisterTest("DetectReplaceMatchTest02", DetectReplaceMatchTest02);
@@ -864,5 +861,5 @@ void DetectReplaceRegisterTests(void)
     UtRegisterTest("DetectReplaceParseTest05", DetectReplaceParseTest05);
     UtRegisterTest("DetectReplaceParseTest06", DetectReplaceParseTest06);
     UtRegisterTest("DetectReplaceParseTest07", DetectReplaceParseTest07);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 8f5da5cf41b5277606f5672ea874c49c8274c96e..fb3def8d102886110d6677d9ba6e95984f1cef31 100644 (file)
@@ -36,10 +36,7 @@ void DetectRevRegister (void)
     sigmatch_table[DETECT_REV].name = "rev";
     sigmatch_table[DETECT_REV].desc = "set version of the rule";
     sigmatch_table[DETECT_REV].url = "/rules/meta.html#rev-revision";
-    sigmatch_table[DETECT_REV].Match = NULL;
     sigmatch_table[DETECT_REV].Setup = DetectRevSetup;
-    sigmatch_table[DETECT_REV].Free  = NULL;
-    sigmatch_table[DETECT_REV].RegisterTests = NULL;
 }
 
 static int DetectRevSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawstr)
@@ -71,5 +68,4 @@ static int DetectRevSetup (DetectEngineCtx *de_ctx, Signature *s, const char *ra
 
  error:
     return -1;
-}
-
+}
\ No newline at end of file
index fcf2857427147385f05aafc234b44a996909c69c..611e5ecca5e297d4100ca62d2272a4dc3ad2611d 100644 (file)
@@ -42,7 +42,9 @@ static int DetectRfbSecresultMatch(DetectEngineThreadCtx *det_ctx,
                                    void *txv, const Signature *s,
                                    const SigMatchCtx *ctx);
 static int DetectRfbSecresultSetup (DetectEngineCtx *, Signature *, const char *);
-void RfbSecresultRegisterTests(void);
+#ifdef UNITTESTS
+static void RfbSecresultRegisterTests(void);
+#endif
 void DetectRfbSecresultFree(DetectEngineCtx *, void *);
 
 static int DetectEngineInspectRfbSecresultGeneric(ThreadVars *tv,
@@ -66,8 +68,9 @@ void DetectRfbSecresultRegister (void)
     sigmatch_table[DETECT_AL_RFB_SECRESULT].AppLayerTxMatch = DetectRfbSecresultMatch;
     sigmatch_table[DETECT_AL_RFB_SECRESULT].Setup = DetectRfbSecresultSetup;
     sigmatch_table[DETECT_AL_RFB_SECRESULT].Free  = DetectRfbSecresultFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_RFB_SECRESULT].RegisterTests = RfbSecresultRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     DetectAppLayerInspectEngineRegister("rfb.secresult",
@@ -300,15 +303,12 @@ static int RfbSecresultTestParse02 (void)
     return 1;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for RfbSecresult
  */
 void RfbSecresultRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("RfbSecresultTestParse01", RfbSecresultTestParse01);
     UtRegisterTest("RfbSecresultTestParse02", RfbSecresultTestParse02);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 5d1226c89504a97dbb1f555444a0e953115fccfc..35e83ca7d277bb1d54f8d783560866a573e75732 100644 (file)
@@ -50,7 +50,9 @@ static DetectParseRegex parse_regex;
 static int DetectRpcMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectRpcSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectRpcRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectRpcRegisterTests(void);
+#endif
 void DetectRpcFree(DetectEngineCtx *, void *);
 
 /**
@@ -64,8 +66,9 @@ void DetectRpcRegister (void)
     sigmatch_table[DETECT_RPC].Match = DetectRpcMatch;
     sigmatch_table[DETECT_RPC].Setup = DetectRpcSetup;
     sigmatch_table[DETECT_RPC].Free  = DetectRpcFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_RPC].RegisterTests = DetectRpcRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -569,19 +572,17 @@ cleanup:
 end:
     return result;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for DetectRpc
  */
-void DetectRpcRegisterTests(void)
+static void DetectRpcRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectRpcTestParse01", DetectRpcTestParse01);
     UtRegisterTest("DetectRpcTestParse02", DetectRpcTestParse02);
     UtRegisterTest("DetectRpcTestParse03", DetectRpcTestParse03);
     UtRegisterTest("DetectRpcTestParse04", DetectRpcTestParse04);
     UtRegisterTest("DetectRpcTestParse05", DetectRpcTestParse05);
     UtRegisterTest("DetectRpcTestSig01", DetectRpcTestSig01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index ca83429933b40f25d72f047cb7307abf96cadcff..71aab90a205b63f3d3523e199dde3e937a20260e 100644 (file)
@@ -40,7 +40,9 @@
 static int DetectSameipMatch(DetectEngineThreadCtx *, Packet *,
                              const Signature *, const SigMatchCtx *);
 static int DetectSameipSetup(DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectSameipRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for sameip: keyword
@@ -53,8 +55,9 @@ void DetectSameipRegister(void)
     sigmatch_table[DETECT_SAMEIP].url = "/rules/header-keywords.html#sameip";
     sigmatch_table[DETECT_SAMEIP].Match = DetectSameipMatch;
     sigmatch_table[DETECT_SAMEIP].Setup = DetectSameipSetup;
-    sigmatch_table[DETECT_SAMEIP].Free = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_SAMEIP].RegisterTests = DetectSameipRegisterTests;
+#endif
     sigmatch_table[DETECT_SAMEIP].flags = SIGMATCH_NOOPT;
 }
 
@@ -181,15 +184,12 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \internal
  * \brief This function registers unit tests for DetectSameip
  */
 static void DetectSameipRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectSameipSigTest01", DetectSameipSigTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 94dedc8f0a6bfb8e4888a0fcd7693b9a93b930a2..2c0323b594e80bbcf7857ae4a0d8a15bfdd78780 100644 (file)
@@ -33,7 +33,9 @@
 #include "util-unittest.h"
 
 static int DetectSidSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectSidRegisterTests(void);
+#endif
 
 void DetectSidRegister (void)
 {
@@ -42,8 +44,9 @@ void DetectSidRegister (void)
     sigmatch_table[DETECT_SID].url = "/rules/meta.html#sid-signature-id";
     sigmatch_table[DETECT_SID].Match = NULL;
     sigmatch_table[DETECT_SID].Setup = DetectSidSetup;
-    sigmatch_table[DETECT_SID].Free = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_SID].RegisterTests = DetectSidRegisterTests;
+#endif
 }
 
 static int DetectSidSetup (DetectEngineCtx *de_ctx, Signature *s, const char *sidstr)
@@ -139,16 +142,13 @@ end:
     return result;
 }
 
-#endif
-
 /**
  * \brief Register DetectSid unit tests.
  */
 static void DetectSidRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("SidTestParse01", SidTestParse01);
     UtRegisterTest("SidTestParse02", SidTestParse02);
     UtRegisterTest("SidTestParse03", SidTestParse03);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 583d08b90c5183dabdb409b768ab2c6d71e7eb29..6c6b0b10eee5ff77696b96d775ca9f2a5a67437c 100644 (file)
@@ -126,7 +126,6 @@ void DetectSshHasshServerStringRegister(void)
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].name = KEYWORD_NAME;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].alias = KEYWORD_ALIAS;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].desc = BUFFER_NAME " sticky buffer";
-    sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].url = "/rules/" KEYWORD_DOC;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].Setup = DetectSshHasshServerStringSetup;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER_STRING].flags |= SIGMATCH_INFO_STICKY_BUFFER | SIGMATCH_NOOPT;
index 07d171e7770117c55d20e8b8bf4b4992ed63676a..3978dc3a0f7e564ea0d550146ed0a95d2ed1ec57 100644 (file)
@@ -193,7 +193,6 @@ void DetectSshHasshServerRegister(void)
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].name = KEYWORD_NAME;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].alias = KEYWORD_ALIAS;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].desc = BUFFER_NAME " sticky buffer";
-    sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].url = "/rules/" KEYWORD_DOC;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].Setup = DetectSshHasshServerSetup;
     sigmatch_table[DETECT_AL_SSH_HASSH_SERVER].flags |= SIGMATCH_INFO_STICKY_BUFFER | SIGMATCH_NOOPT;
index 5ab6605d824ee6abc322b77cb15cc264f058f694..5c3437169331df5e62122026521baadecff3f17a 100644 (file)
@@ -126,7 +126,6 @@ void DetectSshHasshStringRegister(void)
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].name = KEYWORD_NAME;
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].alias = KEYWORD_ALIAS;
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].desc = BUFFER_NAME " sticky buffer";
-    sigmatch_table[DETECT_AL_SSH_HASSH_STRING].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].url = "/rules/" KEYWORD_DOC;
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].Setup = DetectSshHasshStringSetup;
     sigmatch_table[DETECT_AL_SSH_HASSH_STRING].flags |= SIGMATCH_INFO_STICKY_BUFFER | SIGMATCH_NOOPT;
index 8d482e7543be90f953bab7ca0ccb47274efa7fe8..8cd4b5749ddd4551a02550ff99a1b254e050856c 100644 (file)
@@ -193,7 +193,6 @@ void DetectSshHasshRegister(void)
     sigmatch_table[DETECT_AL_SSH_HASSH].name = KEYWORD_NAME;
     sigmatch_table[DETECT_AL_SSH_HASSH].alias = KEYWORD_ALIAS;
     sigmatch_table[DETECT_AL_SSH_HASSH].desc = BUFFER_NAME " sticky buffer";
-    sigmatch_table[DETECT_AL_SSH_HASSH].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_SSH_HASSH].url = "/rules/" KEYWORD_DOC;
     sigmatch_table[DETECT_AL_SSH_HASSH].Setup = DetectSshHasshSetup;
     sigmatch_table[DETECT_AL_SSH_HASSH].flags |= SIGMATCH_INFO_STICKY_BUFFER | SIGMATCH_NOOPT;
index 30a503ff2c747abff4c2ee8e21c3f8eeda36212a..23c6b87e4d8b35e0c2469736d69b0484d59b5bb5 100644 (file)
@@ -66,7 +66,9 @@ static int DetectSshVersionMatch (DetectEngineThreadCtx *,
         Flow *, uint8_t, void *, void *,
         const Signature *, const SigMatchCtx *);
 static int DetectSshVersionSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectSshVersionRegisterTests(void);
+#endif
 static void DetectSshVersionFree(DetectEngineCtx *, void *);
 static int g_ssh_banner_list_id = 0;
 
@@ -81,7 +83,9 @@ void DetectSshVersionRegister(void)
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].AppLayerTxMatch = DetectSshVersionMatch;
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].Setup = DetectSshVersionSetup;
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].Free  = DetectSshVersionFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].RegisterTests = DetectSshVersionRegisterTests;
+#endif
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].flags = SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_INFO_DEPRECATED;
     sigmatch_table[DETECT_AL_SSH_PROTOVERSION].alternative = DETECT_AL_SSH_PROTOCOL;
 
@@ -566,14 +570,11 @@ static int DetectSshVersionTestDetect03(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectSshVersion
  */
-void DetectSshVersionRegisterTests(void)
+static void DetectSshVersionRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectSshVersionTestParse01", DetectSshVersionTestParse01);
     UtRegisterTest("DetectSshVersionTestParse02", DetectSshVersionTestParse02);
     UtRegisterTest("DetectSshVersionTestParse03", DetectSshVersionTestParse03);
@@ -583,6 +584,5 @@ void DetectSshVersionRegisterTests(void)
                    DetectSshVersionTestDetect02);
     UtRegisterTest("DetectSshVersionTestDetect03",
                    DetectSshVersionTestDetect03);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index e24a241910db057b8aa0e555626ea993c95a271e..bebe2b8b98ceed74a096cba751f3990ffeaf076d 100644 (file)
@@ -70,7 +70,9 @@ static int DetectSshSoftwareVersionMatch (DetectEngineThreadCtx *,
         Flow *, uint8_t, void *, void *,
         const Signature *, const SigMatchCtx *);
 static int DetectSshSoftwareVersionSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectSshSoftwareVersionRegisterTests(void);
+#endif
 static void DetectSshSoftwareVersionFree(DetectEngineCtx *de_ctx, void *);
 static int g_ssh_banner_list_id = 0;
 
@@ -95,7 +97,9 @@ void DetectSshSoftwareVersionRegister(void)
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].AppLayerTxMatch = DetectSshSoftwareVersionMatch;
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].Setup = DetectSshSoftwareVersionSetup;
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].Free  = DetectSshSoftwareVersionFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].RegisterTests = DetectSshSoftwareVersionRegisterTests;
+#endif
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].flags = SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_INFO_DEPRECATED;
     sigmatch_table[DETECT_AL_SSH_SOFTWAREVERSION].alternative = DETECT_AL_SSH_SOFTWARE;
 
@@ -551,14 +555,11 @@ static int DetectSshSoftwareVersionTestDetect03(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectSshSoftwareVersion
  */
 static void DetectSshSoftwareVersionRegisterTests(void)
 {
-#ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectSshSoftwareVersionTestParse01",
                    DetectSshSoftwareVersionTestParse01);
     UtRegisterTest("DetectSshSoftwareVersionTestParse02",
@@ -571,6 +572,5 @@ static void DetectSshSoftwareVersionRegisterTests(void)
                    DetectSshSoftwareVersionTestDetect02);
     UtRegisterTest("DetectSshSoftwareVersionTestDetect03",
                    DetectSshSoftwareVersionTestDetect03);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index f8b46c44500d7708ab9414c437dae04228e3a5a1..68e7561008ebbb89b7d604e4102459ab18aaa5b9 100644 (file)
@@ -48,7 +48,9 @@ static int DetectStreamSizeMatch (DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectStreamSizeSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectStreamSizeFree(DetectEngineCtx *de_ctx, void *);
-void DetectStreamSizeRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectStreamSizeRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for stream_size: keyword
@@ -62,8 +64,9 @@ void DetectStreamSizeRegister(void)
     sigmatch_table[DETECT_STREAM_SIZE].Match = DetectStreamSizeMatch;
     sigmatch_table[DETECT_STREAM_SIZE].Setup = DetectStreamSizeSetup;
     sigmatch_table[DETECT_STREAM_SIZE].Free = DetectStreamSizeFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_STREAM_SIZE].RegisterTests = DetectStreamSizeRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -489,18 +492,15 @@ static int DetectStreamSizeParseTest04 (void)
     SCFree(p);
     return result;
 }
-#endif /* UNITTESTS */
 
 /**
  * \brief this function registers unit tests for DetectStreamSize
  */
 void DetectStreamSizeRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectStreamSizeParseTest01", DetectStreamSizeParseTest01);
     UtRegisterTest("DetectStreamSizeParseTest02", DetectStreamSizeParseTest02);
     UtRegisterTest("DetectStreamSizeParseTest03", DetectStreamSizeParseTest03);
     UtRegisterTest("DetectStreamSizeParseTest04", DetectStreamSizeParseTest04);
-#endif /* UNITTESTS */
 }
-
+#endif /* UNITTESTS */
\ No newline at end of file
index 633b70d9b988208c75968fd8866b4ce9d24a3ddc..225fa567cee231b273cf738e4f76b858834e930b 100644 (file)
@@ -59,7 +59,9 @@ static DetectParseRegex parse_regex;
 static int DetectTagMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectTagSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectTagRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectTagRegisterTests(void);
+#endif
 void DetectTagDataFree(DetectEngineCtx *, void *);
 
 /**
@@ -71,7 +73,9 @@ void DetectTagRegister(void)
     sigmatch_table[DETECT_TAG].Match = DetectTagMatch;
     sigmatch_table[DETECT_TAG].Setup = DetectTagSetup;
     sigmatch_table[DETECT_TAG].Free  = DetectTagDataFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TAG].RegisterTests = DetectTagRegisterTests;
+#endif
     sigmatch_table[DETECT_TAG].flags |= SIGMATCH_IPONLY_COMPAT;
 
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
@@ -441,14 +445,11 @@ static int DetectTagTestParse05(void)
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectTag
  */
 void DetectTagRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTagTestParse01", DetectTagTestParse01);
     UtRegisterTest("DetectTagTestParse02", DetectTagTestParse02);
     UtRegisterTest("DetectTagTestParse03", DetectTagTestParse03);
@@ -456,5 +457,5 @@ void DetectTagRegisterTests(void)
     UtRegisterTest("DetectTagTestParse05", DetectTagTestParse05);
 
     DetectEngineTagRegisterTests();
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 52680a351b802fe5b2e6c586b39e8a06c918d71c..62be7fb1b621fe2c7ccf929de016e615c3140c73 100644 (file)
@@ -40,7 +40,9 @@ static DetectParseRegex parse_regex;
 
 /* Prototypes of functions registered in DetectTargetRegister below */
 static int DetectTargetSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectTargetRegisterTests (void);
+#endif
 
 /**
  * \brief Registration function for target keyword
@@ -62,8 +64,9 @@ void DetectTargetRegister(void) {
      * shutdown, but also during rule reloads. */
     sigmatch_table[DETECT_TARGET].Free = NULL;
     /* registers unittests into the system */
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TARGET].RegisterTests = DetectTargetRegisterTests;
-
+#endif
     /* set up the PCRE for keyword parsing */
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
@@ -151,14 +154,12 @@ static int DetectTargetSignatureTest01(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectTarget
  */
-void DetectTargetRegisterTests(void) {
-#ifdef UNITTESTS
+static void DetectTargetRegisterTests(void)
+{
     UtRegisterTest("DetectTargetSignatureTest01",
                    DetectTargetSignatureTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 31680b154380d5f889216b165a74cf40aa9eaac1..ebfbdad5f5c2ebeeff0dbada5801a80ac3a7c8e0 100644 (file)
@@ -46,7 +46,9 @@
 static int DetectAckSetup(DetectEngineCtx *, Signature *, const char *);
 static int DetectAckMatch(DetectEngineThreadCtx *,
                           Packet *, const Signature *, const SigMatchCtx *);
+#ifdef UNITTESTS
 static void DetectAckRegisterTests(void);
+#endif
 static void DetectAckFree(DetectEngineCtx *, void *);
 static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static bool PrefilterTcpAckIsPrefilterable(const Signature *s);
@@ -63,8 +65,9 @@ void DetectAckRegister(void)
 
     sigmatch_table[DETECT_ACK].SupportsPrefilter = PrefilterTcpAckIsPrefilterable;
     sigmatch_table[DETECT_ACK].SetupPrefilter = PrefilterSetupTcpAck;
-
+#ifdef UNITTESTS
     sigmatch_table[DETECT_ACK].RegisterTests = DetectAckRegisterTests;
+#endif
 }
 
 /**
@@ -323,15 +326,12 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \internal
  * \brief This function registers unit tests for DetectAck
  */
 static void DetectAckRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectAckSigTest01", DetectAckSigTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index c35d1c79a2ab8d7756350ce2ae2010fdf947eab2..62decaaa46864f927f4f71d3142d7b2aee89d5b5 100644 (file)
@@ -64,6 +64,9 @@ static void DetectFlagsFree(DetectEngineCtx *, void *);
 
 static bool PrefilterTcpFlagsIsPrefilterable(const Signature *s);
 static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
+#ifdef UNITTESTS
+static void FlagsRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for flags: keyword
@@ -78,8 +81,9 @@ void DetectFlagsRegister (void)
     sigmatch_table[DETECT_FLAGS].Match = DetectFlagsMatch;
     sigmatch_table[DETECT_FLAGS].Setup = DetectFlagsSetup;
     sigmatch_table[DETECT_FLAGS].Free  = DetectFlagsFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_FLAGS].RegisterTests = FlagsRegisterTests;
-
+#endif
     sigmatch_table[DETECT_FLAGS].SupportsPrefilter = PrefilterTcpFlagsIsPrefilterable;
     sigmatch_table[DETECT_FLAGS].SetupPrefilter = PrefilterSetupTcpFlags;
 
@@ -1395,14 +1399,11 @@ error:
     return 0;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for Flags
  */
-void FlagsRegisterTests(void)
+static void FlagsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("FlagsTestParse01", FlagsTestParse01);
     UtRegisterTest("FlagsTestParse02", FlagsTestParse02);
     UtRegisterTest("FlagsTestParse03", FlagsTestParse03);
@@ -1420,5 +1421,5 @@ void FlagsRegisterTests(void)
     UtRegisterTest("FlagsTestParse15", FlagsTestParse15);
     UtRegisterTest("FlagsTestParse16", FlagsTestParse16);
     UtRegisterTest("FlagsTestParse17", FlagsTestParse17);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 333ed910215c5e1a3498a33ef52d64016970c353..9b6b24021fc99adb644c6c0a7441ef6c39ef4885 100644 (file)
@@ -50,12 +50,6 @@ typedef struct DetectFlagsData_ {
 
 void DetectFlagsRegister (void);
 
-/**
- * This function registers unit tests for Flags
- */
-
-void FlagsRegisterTests(void);
-
 int DetectFlagsSignatureNeedsSynPackets(const Signature *s);
 int DetectFlagsSignatureNeedsSynOnlyPackets(const Signature *s);
 
index f364afd99c5ab7e710b7874c029895dc93e7d6d8..09d075b644c71e8f49fbad3d4850f626d0a0cc4c 100644 (file)
@@ -43,7 +43,9 @@
 static int DetectSeqSetup(DetectEngineCtx *, Signature *, const char *);
 static int DetectSeqMatch(DetectEngineThreadCtx *,
                           Packet *, const Signature *, const SigMatchCtx *);
+#ifdef UNITTESTS
 static void DetectSeqRegisterTests(void);
+#endif
 static void DetectSeqFree(DetectEngineCtx *, void *);
 static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static bool PrefilterTcpSeqIsPrefilterable(const Signature *s);
@@ -57,8 +59,9 @@ void DetectSeqRegister(void)
     sigmatch_table[DETECT_SEQ].Match = DetectSeqMatch;
     sigmatch_table[DETECT_SEQ].Setup = DetectSeqSetup;
     sigmatch_table[DETECT_SEQ].Free = DetectSeqFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_SEQ].RegisterTests = DetectSeqRegisterTests;
-
+#endif
     sigmatch_table[DETECT_SEQ].SupportsPrefilter = PrefilterTcpSeqIsPrefilterable;
     sigmatch_table[DETECT_SEQ].SetupPrefilter = PrefilterSetupTcpSeq;
 }
@@ -287,16 +290,13 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \internal
  * \brief This function registers unit tests for DetectSeq
  */
 static void DetectSeqRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectSeqSigTest01", DetectSeqSigTest01);
     UtRegisterTest("DetectSeqSigTest02", DetectSeqSigTest02);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index f45bdb83443737b27ff53f69b874bd23ac0e405a..da2693fc8eab0907539ba01afdb15840e79a93cf 100644 (file)
@@ -49,7 +49,9 @@ static DetectParseRegex parse_regex;
 static int DetectWindowMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectWindowSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectWindowRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectWindowRegisterTests(void);
+#endif
 void DetectWindowFree(DetectEngineCtx *, void *);
 
 /**
@@ -64,8 +66,9 @@ void DetectWindowRegister (void)
     sigmatch_table[DETECT_WINDOW].Match = DetectWindowMatch;
     sigmatch_table[DETECT_WINDOW].Setup = DetectWindowSetup;
     sigmatch_table[DETECT_WINDOW].Free  = DetectWindowFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_WINDOW].RegisterTests = DetectWindowRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 }
 
@@ -327,18 +330,15 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectWindow
  */
 void DetectWindowRegisterTests(void)
 {
-    #ifdef UNITTESTS /* UNITTESTS */
     UtRegisterTest("DetectWindowTestParse01", DetectWindowTestParse01);
     UtRegisterTest("DetectWindowTestParse02", DetectWindowTestParse02);
     UtRegisterTest("DetectWindowTestParse03", DetectWindowTestParse03);
     UtRegisterTest("DetectWindowTestParse04", DetectWindowTestParse04);
     UtRegisterTest("DetectWindowTestPacket01", DetectWindowTestPacket01);
-    #endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 2979530421946d6b376819afbdc0be24e118d667..d2615dea336fa868d440ecfb925786b609b7316a 100644 (file)
@@ -47,7 +47,9 @@ static int DetectEngineInspectTemplateRustBuffer(ThreadVars *tv,
     DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
     const Signature *s, const SigMatchData *smd,
     Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
+#ifdef UNITTESTS
 static void DetectTemplateRustBufferRegisterTests(void);
+#endif
 static int g_template_rust_id = 0;
 
 void DetectTemplateRustBufferRegister(void)
@@ -63,9 +65,10 @@ void DetectTemplateRustBufferRegister(void)
         "Template content modififier to match on the template buffers";
     sigmatch_table[DETECT_AL_TEMPLATE_RUST_BUFFER].Setup =
         DetectTemplateRustBufferSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_TEMPLATE_RUST_BUFFER].RegisterTests =
         DetectTemplateRustBufferRegisterTests;
-
+#endif
     sigmatch_table[DETECT_AL_TEMPLATE_RUST_BUFFER].flags |= SIGMATCH_NOOPT;
 
     /* register inspect engines */
@@ -205,12 +208,9 @@ static int DetectTemplateRustBufferTest(void)
     PASS;
 }
 
-#endif
-
 static void DetectTemplateRustBufferRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTemplateRustBufferTest",
         DetectTemplateRustBufferTest);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
index 1398fb7d01cd34e40f6207f41bd3279d94e74b11..612fb56e45d909c82f45808089447fa6766da69f 100644 (file)
@@ -67,6 +67,9 @@ static int DetectThresholdMatch(DetectEngineThreadCtx *, Packet *,
         const Signature *, const SigMatchCtx *);
 static int DetectThresholdSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectThresholdFree(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
+static void ThresholdRegisterTests(void);
+#endif
 
 /**
  * \brief Registration function for threshold: keyword
@@ -80,7 +83,9 @@ void DetectThresholdRegister(void)
     sigmatch_table[DETECT_THRESHOLD].Match = DetectThresholdMatch;
     sigmatch_table[DETECT_THRESHOLD].Setup = DetectThresholdSetup;
     sigmatch_table[DETECT_THRESHOLD].Free  = DetectThresholdFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_THRESHOLD].RegisterTests = ThresholdRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_THRESHOLD].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -1673,11 +1678,8 @@ static int DetectThresholdTestSig14(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
-void ThresholdRegisterTests(void)
+static void ThresholdRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("ThresholdTestParse01", ThresholdTestParse01);
     UtRegisterTest("ThresholdTestParse02", ThresholdTestParse02);
     UtRegisterTest("ThresholdTestParse03", ThresholdTestParse03);
@@ -1700,8 +1702,8 @@ void ThresholdRegisterTests(void)
     UtRegisterTest("DetectThresholdTestSig12", DetectThresholdTestSig12);
     UtRegisterTest("DetectThresholdTestSig13", DetectThresholdTestSig13);
     UtRegisterTest("DetectThresholdTestSig14", DetectThresholdTestSig14);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
 
 /**
  * @}
index 05ebe2e76ac5a9f38a8e869fec65061a10a4962b..616e48ab2c76e783ad19f043f4db2a71273f39e2 100644 (file)
@@ -86,10 +86,4 @@ typedef struct DetectThresholdEntry_ {
 
 void DetectThresholdRegister(void);
 
-/**
- * This function registers unit tests for Threshold
- */
-
-void ThresholdRegisterTests(void);
-
 #endif /*__DETECT_THRESHOLD_H__ */
index 0ce262f89b06598d181c9c5216615eeb4fe65031..3465ca07d446776d03c4870a17dd09c4c501abb8 100644 (file)
@@ -75,14 +75,12 @@ static int DetectTlsSubjectMatch (DetectEngineThreadCtx *,
         Flow *, uint8_t, void *, void *,
         const Signature *, const SigMatchCtx *);
 static int DetectTlsSubjectSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectTlsSubjectRegisterTests(void);
 static void DetectTlsSubjectFree(DetectEngineCtx *, void *);
 
 static int DetectTlsIssuerDNMatch (DetectEngineThreadCtx *,
         Flow *, uint8_t, void *, void *,
         const Signature *, const SigMatchCtx *);
 static int DetectTlsIssuerDNSetup (DetectEngineCtx *, Signature *, const char *);
-static void DetectTlsIssuerDNRegisterTests(void);
 static void DetectTlsIssuerDNFree(DetectEngineCtx *, void *);
 
 static int DetectTlsFingerprintMatch (DetectEngineThreadCtx *,
@@ -118,7 +116,6 @@ void DetectTlsRegister (void)
     sigmatch_table[DETECT_AL_TLS_SUBJECT].AppLayerTxMatch = DetectTlsSubjectMatch;
     sigmatch_table[DETECT_AL_TLS_SUBJECT].Setup = DetectTlsSubjectSetup;
     sigmatch_table[DETECT_AL_TLS_SUBJECT].Free  = DetectTlsSubjectFree;
-    sigmatch_table[DETECT_AL_TLS_SUBJECT].RegisterTests = DetectTlsSubjectRegisterTests;
     sigmatch_table[DETECT_AL_TLS_SUBJECT].flags = SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_AL_TLS_SUBJECT].alternative = DETECT_AL_TLS_CERT_SUBJECT;
 
@@ -128,7 +125,6 @@ void DetectTlsRegister (void)
     sigmatch_table[DETECT_AL_TLS_ISSUERDN].AppLayerTxMatch = DetectTlsIssuerDNMatch;
     sigmatch_table[DETECT_AL_TLS_ISSUERDN].Setup = DetectTlsIssuerDNSetup;
     sigmatch_table[DETECT_AL_TLS_ISSUERDN].Free  = DetectTlsIssuerDNFree;
-    sigmatch_table[DETECT_AL_TLS_ISSUERDN].RegisterTests = DetectTlsIssuerDNRegisterTests;
     sigmatch_table[DETECT_AL_TLS_ISSUERDN].flags = SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_AL_TLS_ISSUERDN].alternative = DETECT_AL_TLS_CERT_ISSUER;
 
@@ -138,7 +134,6 @@ void DetectTlsRegister (void)
     sigmatch_table[DETECT_AL_TLS_FINGERPRINT].AppLayerTxMatch = DetectTlsFingerprintMatch;
     sigmatch_table[DETECT_AL_TLS_FINGERPRINT].Setup = DetectTlsFingerprintSetup;
     sigmatch_table[DETECT_AL_TLS_FINGERPRINT].Free  = DetectTlsFingerprintFree;
-    sigmatch_table[DETECT_AL_TLS_FINGERPRINT].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_TLS_FINGERPRINT].flags = SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION;
     sigmatch_table[DETECT_AL_TLS_FINGERPRINT].alternative = DETECT_AL_TLS_CERT_FINGERPRINT;
 
@@ -148,8 +143,6 @@ void DetectTlsRegister (void)
     sigmatch_table[DETECT_AL_TLS_STORE].url = "/rules/tls-keywords.html#tls-store";
     sigmatch_table[DETECT_AL_TLS_STORE].Match = DetectTlsStorePostMatch;
     sigmatch_table[DETECT_AL_TLS_STORE].Setup = DetectTlsStoreSetup;
-    sigmatch_table[DETECT_AL_TLS_STORE].Free  = NULL;
-    sigmatch_table[DETECT_AL_TLS_STORE].RegisterTests = NULL;
     sigmatch_table[DETECT_AL_TLS_STORE].flags |= SIGMATCH_NOOPT;
 
     DetectSetupParseRegexes(PARSE_REGEX, &subject_parse_regex);
@@ -354,13 +347,6 @@ static void DetectTlsSubjectFree(DetectEngineCtx *de_ctx, void *ptr)
     SCFree(id_d);
 }
 
-/**
- * \brief this function registers unit tests for DetectTlsSubject
- */
-static void DetectTlsSubjectRegisterTests(void)
-{
-}
-
 /**
  * \brief match the specified IssuerDN on a tls session
  *
@@ -786,12 +772,4 @@ static int DetectTlsStorePostMatch (DetectEngineThreadCtx *det_ctx,
 
     ssl_state->server_connp.cert_log_flag |= SSL_TLS_LOG_PEM;
     SCReturnInt(1);
-}
-
-
-/**
- * \brief this function registers unit tests for DetectTlsIssuerDN
- */
-static void DetectTlsIssuerDNRegisterTests(void)
-{
-}
+}
\ No newline at end of file
index 746c6cce63db734ce98e8dc1fd72c5e5c7ce394e..fe37b1977ab206bc9b5eddc0e48d0711e3159c4d 100644 (file)
@@ -50,7 +50,9 @@ static DetectParseRegex parse_regex;
 static int DetectTosSetup(DetectEngineCtx *, Signature *, const char *);
 static int DetectTosMatch(DetectEngineThreadCtx *, Packet *,
                           const Signature *, const SigMatchCtx *);
+#ifdef UNITTESTS
 static void DetectTosRegisterTests(void);
+#endif
 static void DetectTosFree(DetectEngineCtx *, void *);
 
 #define DETECT_IPTOS_MIN 0
@@ -66,7 +68,9 @@ void DetectTosRegister(void)
     sigmatch_table[DETECT_TOS].Match = DetectTosMatch;
     sigmatch_table[DETECT_TOS].Setup = DetectTosSetup;
     sigmatch_table[DETECT_TOS].Free = DetectTosFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TOS].RegisterTests = DetectTosRegisterTests;
+#endif
     sigmatch_table[DETECT_TOS].flags =
         (SIGMATCH_QUOTES_OPTIONAL|SIGMATCH_HANDLE_NEGATION);
     sigmatch_table[DETECT_TOS].url =
@@ -346,11 +350,8 @@ end:
     return result;
 }
 
-#endif
-
 void DetectTosRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTosTest01", DetectTosTest01);
     UtRegisterTest("DetectTosTest02", DetectTosTest02);
     UtRegisterTest("DetectTosTest04", DetectTosTest04);
@@ -361,6 +362,6 @@ void DetectTosRegisterTests(void)
     UtRegisterTest("DetectTosTest09", DetectTosTest09);
     UtRegisterTest("DetectTosTest10", DetectTosTest10);
     UtRegisterTest("DetectTosTest12", DetectTosTest12);
-#endif
     return;
 }
+#endif
\ No newline at end of file
index 4087b1211169d459274095729cbe3d5c2f087ddc..e03f918c1086d5b3588b0622a2019e754863db32 100644 (file)
@@ -35,8 +35,9 @@
 #include "util-print.h"
 
 static int DetectTransformCompressWhitespaceSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectTransformCompressWhitespaceRegisterTests(void);
-
+#endif
 static void TransformCompressWhitespace(InspectionBuffer *buffer, void *options);
 
 void DetectTransformCompressWhitespaceRegister(void)
@@ -51,9 +52,10 @@ void DetectTransformCompressWhitespaceRegister(void)
         TransformCompressWhitespace;
     sigmatch_table[DETECT_TRANSFORM_COMPRESS_WHITESPACE].Setup =
         DetectTransformCompressWhitespaceSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_COMPRESS_WHITESPACE].RegisterTests =
         DetectTransformCompressWhitespaceRegisterTests;
-
+#endif
     sigmatch_table[DETECT_TRANSFORM_COMPRESS_WHITESPACE].flags |= SIGMATCH_NOOPT;
 }
 
@@ -158,14 +160,11 @@ static int DetectTransformCompressWhitespaceTest02(void)
     PASS;
 }
 
-#endif
-
 static void DetectTransformCompressWhitespaceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformCompressWhitespaceTest01",
             DetectTransformCompressWhitespaceTest01);
     UtRegisterTest("DetectTransformCompressWhitespaceTest02",
             DetectTransformCompressWhitespaceTest02);
-#endif
 }
+#endif
\ No newline at end of file
index b0fa5c6835c4d28d505c819e0d6c5d2224ece58e..22fe0ff5ee82651da20090af8953dad912e8715d 100644 (file)
@@ -37,8 +37,9 @@
 #include "util-memcpy.h"
 
 static int DetectTransformDotPrefixSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectTransformDotPrefixRegisterTests(void);
-
+#endif
 static void TransformDotPrefix(InspectionBuffer *buffer, void *options);
 
 void DetectTransformDotPrefixRegister(void)
@@ -50,9 +51,10 @@ void DetectTransformDotPrefixRegister(void)
         "/rules/transforms.html#dotprefix";
     sigmatch_table[DETECT_TRANSFORM_DOTPREFIX].Transform = TransformDotPrefix;
     sigmatch_table[DETECT_TRANSFORM_DOTPREFIX].Setup = DetectTransformDotPrefixSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_DOTPREFIX].RegisterTests =
         DetectTransformDotPrefixRegisterTests;
-
+#endif
     sigmatch_table[DETECT_TRANSFORM_DOTPREFIX].flags |= SIGMATCH_NOOPT;
 }
 
@@ -173,13 +175,11 @@ static int DetectTransformDotPrefixTest03(void)
     DetectEngineCtxFree(de_ctx);
     PASS;
 }
-#endif
 
 static void DetectTransformDotPrefixRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformDotPrefixTest01", DetectTransformDotPrefixTest01);
     UtRegisterTest("DetectTransformDotPrefixTest02", DetectTransformDotPrefixTest02);
     UtRegisterTest("DetectTransformDotPrefixTest03", DetectTransformDotPrefixTest03);
-#endif
 }
+#endif
\ No newline at end of file
index a2af21efdd2ab2c7d8e4c16d9aa0b860622f7ebb..d8817252dd956a274c47be53ddc313ba7105d8fb 100644 (file)
@@ -36,7 +36,9 @@
 
 static int DetectTransformToMd5Setup (DetectEngineCtx *, Signature *, const char *);
 #ifdef HAVE_NSS
+#ifdef UNITTESTS
 static void DetectTransformToMd5RegisterTests(void);
+#endif
 static void TransformToMd5(InspectionBuffer *buffer, void *options);
 #endif
 
@@ -52,8 +54,10 @@ void DetectTransformMd5Register(void)
 #ifdef HAVE_NSS
     sigmatch_table[DETECT_TRANSFORM_MD5].Transform =
         TransformToMd5;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_MD5].RegisterTests =
         DetectTransformToMd5RegisterTests;
+#endif
 #endif
     sigmatch_table[DETECT_TRANSFORM_MD5].flags |= SIGMATCH_NOOPT;
 }
@@ -118,13 +122,10 @@ static int DetectTransformToMd5Test01(void)
     PASS;
 }
 
-#endif
-
 static void DetectTransformToMd5RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformToMd5Test01",
             DetectTransformToMd5Test01);
-#endif
 }
 #endif
+#endif
\ No newline at end of file
index cd42151733832a477cae596b3f99310d4b5488c6..33df794d2ca7cbdf6460788c3c02a537641c5e3b 100644 (file)
@@ -36,7 +36,9 @@
 
 static int DetectTransformToSha1Setup (DetectEngineCtx *, Signature *, const char *);
 #ifdef HAVE_NSS
+#ifdef UNITTESTS
 static void DetectTransformToSha1RegisterTests(void);
+#endif
 static void TransformToSha1(InspectionBuffer *buffer, void *options);
 #endif
 
@@ -52,8 +54,10 @@ void DetectTransformSha1Register(void)
 #ifdef HAVE_NSS
     sigmatch_table[DETECT_TRANSFORM_SHA1].Transform =
         TransformToSha1;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_SHA1].RegisterTests =
         DetectTransformToSha1RegisterTests;
+#endif
 #endif
     sigmatch_table[DETECT_TRANSFORM_SHA1].flags |= SIGMATCH_NOOPT;
 }
@@ -118,13 +122,10 @@ static int DetectTransformToSha1Test01(void)
     PASS;
 }
 
-#endif
-
 static void DetectTransformToSha1RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformToSha1Test01",
             DetectTransformToSha1Test01);
-#endif
 }
 #endif
+#endif
\ No newline at end of file
index b28b5492df43090b517d6fdb4ad08d10fb0b6e88..f7088746a12e1168c003e03154f1c553f64fadf0 100644 (file)
@@ -36,7 +36,9 @@
 
 static int DetectTransformToSha256Setup (DetectEngineCtx *, Signature *, const char *);
 #ifdef HAVE_NSS
+#ifdef UNITTESTS
 static void DetectTransformToSha256RegisterTests(void);
+#endif
 static void TransformToSha256(InspectionBuffer *buffer, void *options);
 #endif
 
@@ -52,8 +54,10 @@ void DetectTransformSha256Register(void)
 #ifdef HAVE_NSS
     sigmatch_table[DETECT_TRANSFORM_SHA256].Transform =
         TransformToSha256;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_SHA256].RegisterTests =
         DetectTransformToSha256RegisterTests;
+#endif
 #endif
     sigmatch_table[DETECT_TRANSFORM_SHA256].flags |= SIGMATCH_NOOPT;
 }
@@ -118,13 +122,10 @@ static int DetectTransformToSha256Test01(void)
     PASS;
 }
 
-#endif
-
 static void DetectTransformToSha256RegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformToSha256Test01",
             DetectTransformToSha256Test01);
-#endif
 }
 #endif
+#endif
\ No newline at end of file
index 96f8234cb9df1c9dc0bd2df3ed91c38717c2178c..6757941f8c1557d4402f0e08fc25beda3084996a 100644 (file)
@@ -35,8 +35,9 @@
 #include "util-print.h"
 
 static int DetectTransformStripWhitespaceSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectTransformStripWhitespaceRegisterTests(void);
-
+#endif
 static void TransformStripWhitespace(InspectionBuffer *buffer, void *options);
 static bool TransformStripWhitespaceValidate(const uint8_t *content, uint16_t content_len, void *options);
 
@@ -53,9 +54,10 @@ void DetectTransformStripWhitespaceRegister(void)
         TransformStripWhitespaceValidate;
     sigmatch_table[DETECT_TRANSFORM_STRIP_WHITESPACE].Setup =
         DetectTransformStripWhitespaceSetup;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_TRANSFORM_STRIP_WHITESPACE].RegisterTests =
         DetectTransformStripWhitespaceRegisterTests;
-
+#endif
     sigmatch_table[DETECT_TRANSFORM_STRIP_WHITESPACE].flags |= SIGMATCH_NOOPT;
 }
 
@@ -191,16 +193,13 @@ static int DetectTransformStripWhitespaceTest03(void)
     PASS;
 }
 
-#endif
-
 static void DetectTransformStripWhitespaceRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectTransformStripWhitespaceTest01",
             DetectTransformStripWhitespaceTest01);
     UtRegisterTest("DetectTransformStripWhitespaceTest02",
             DetectTransformStripWhitespaceTest02);
     UtRegisterTest("DetectTransformStripWhitespaceTest03",
             DetectTransformStripWhitespaceTest03);
-#endif
 }
+#endif
\ No newline at end of file
index 26ff2370c8522284b0f39ace505d4407553a5d23..df1c882091a377d1f71346c8c9111a2a6af708fd 100644 (file)
@@ -57,7 +57,9 @@
 
 /* prototypes */
 static int DetectUricontentSetup (DetectEngineCtx *, Signature *, const char *);
+#ifdef UNITTESTS
 static void DetectUricontentRegisterTests(void);
+#endif
 static void DetectUricontentFree(DetectEngineCtx *de_ctx, void *);
 
 static int g_http_uri_buffer_id = 0;
@@ -73,7 +75,9 @@ void DetectUricontentRegister (void)
     sigmatch_table[DETECT_URICONTENT].Match = NULL;
     sigmatch_table[DETECT_URICONTENT].Setup = DetectUricontentSetup;
     sigmatch_table[DETECT_URICONTENT].Free  = DetectUricontentFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_URICONTENT].RegisterTests = DetectUricontentRegisterTests;
+#endif
     sigmatch_table[DETECT_URICONTENT].flags = (SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION);
     sigmatch_table[DETECT_URICONTENT].alternative = DETECT_HTTP_URI;
 
@@ -1746,11 +1750,8 @@ static int DetectUricontentIsdataatParseTest(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 static void DetectUricontentRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("HTTPUriTest01", HTTPUriTest01);
     UtRegisterTest("HTTPUriTest02", HTTPUriTest02);
     UtRegisterTest("HTTPUriTest03", HTTPUriTest03);
@@ -1784,5 +1785,5 @@ static void DetectUricontentRegisterTests(void)
 
     UtRegisterTest("DetectUricontentIsdataatParseTest",
             DetectUricontentIsdataatParseTest);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 1e6bc05568c82ed04da953d60e0d091c8df272d0..3ba4322c0f61a47e84602e6cf547dd4827233b54 100644 (file)
@@ -51,9 +51,10 @@ static DetectParseRegex parse_regex;
 
 /*prototypes*/
 static int DetectUrilenSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectUrilenFree (DetectEngineCtx *, void *);
-void DetectUrilenRegisterTests (void);
-
+static void DetectUrilenFree (DetectEngineCtx *, void *);
+#ifdef UNITTESTS
+static void DetectUrilenRegisterTests (void);
+#endif
 static int g_http_uri_buffer_id = 0;
 static int g_http_raw_uri_buffer_id = 0;
 
@@ -69,8 +70,9 @@ void DetectUrilenRegister(void)
     sigmatch_table[DETECT_AL_URILEN].Match = NULL;
     sigmatch_table[DETECT_AL_URILEN].Setup = DetectUrilenSetup;
     sigmatch_table[DETECT_AL_URILEN].Free = DetectUrilenFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_AL_URILEN].RegisterTests = DetectUrilenRegisterTests;
-
+#endif
     DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
 
     g_http_uri_buffer_id = DetectBufferTypeRegister("http_uri");
@@ -88,7 +90,6 @@ void DetectUrilenRegister(void)
 
 static DetectUrilenData *DetectUrilenParse (const char *urilenstr)
 {
-
     DetectUrilenData *urilend = NULL;
     char *arg1 = NULL;
     char *arg2 = NULL;
@@ -274,7 +275,7 @@ error:
  *
  * \param ptr pointer to DetectUrilenData
  */
-void DetectUrilenFree(DetectEngineCtx *de_ctx, void *ptr)
+static void DetectUrilenFree(DetectEngineCtx *de_ctx, void *ptr)
 {
     if (ptr == NULL)
         return;
@@ -726,14 +727,11 @@ end:
     return result;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for DetectUrilen
  */
 void DetectUrilenRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("DetectUrilenParseTest01", DetectUrilenParseTest01);
     UtRegisterTest("DetectUrilenParseTest02", DetectUrilenParseTest02);
     UtRegisterTest("DetectUrilenParseTest03", DetectUrilenParseTest03);
@@ -746,5 +744,5 @@ void DetectUrilenRegisterTests(void)
     UtRegisterTest("DetectUrilenParseTest10", DetectUrilenParseTest10);
     UtRegisterTest("DetectUrilenSetpTest01", DetectUrilenSetpTest01);
     UtRegisterTest("DetectUrilenSigTest01", DetectUrilenSigTest01);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index b45db2a7c509c0bdaafc1f3a956343db517df7ad..5bb89a1b2a1c75e83a519e6bf8b91dd8b52f1e8c 100644 (file)
@@ -45,7 +45,9 @@
 #include "util-unittest.h"
 
 static int DetectWithinSetup(DetectEngineCtx *, Signature *, const char *);
-void DetectWithinRegisterTests(void);
+#ifdef UNITTESTS
+static void DetectWithinRegisterTests(void);
+#endif
 
 void DetectWithinRegister(void)
 {
@@ -54,8 +56,9 @@ void DetectWithinRegister(void)
     sigmatch_table[DETECT_WITHIN].url = "/rules/payload-keywords.html#within";
     sigmatch_table[DETECT_WITHIN].Match = NULL;
     sigmatch_table[DETECT_WITHIN].Setup = DetectWithinSetup;
-    sigmatch_table[DETECT_WITHIN].Free  = NULL;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_WITHIN].RegisterTests = DetectWithinRegisterTests;
+#endif
 }
 
 /** \brief Setup within pattern (content/uricontent) modifier.
@@ -229,13 +232,10 @@ static int DetectWithinTestVarSetup(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 void DetectWithinRegisterTests(void)
 {
-    #ifdef UNITTESTS
     UtRegisterTest("DetectWithinTestPacket01", DetectWithinTestPacket01);
     UtRegisterTest("DetectWithinTestPacket02", DetectWithinTestPacket02);
     UtRegisterTest("DetectWithinTestVarSetup", DetectWithinTestVarSetup);
-    #endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index 31b0a6b69764c120d8cc8a4bbae4ee178e104a82..5645fdcdafc32fae2eec1a85fa091b62ec5a7311 100644 (file)
@@ -59,8 +59,10 @@ static DetectParseRegex parse_regex;
 
 static int DetectXbitMatch (DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *);
 static int DetectXbitSetup (DetectEngineCtx *, Signature *, const char *);
-void DetectXbitFree (DetectEngineCtx *, void *);
-void XBitsRegisterTests(void);
+#ifdef UNITTESTS
+static void XBitsRegisterTests(void);
+#endif
+static void DetectXbitFree (DetectEngineCtx *, void *);
 
 void DetectXbitsRegister (void)
 {
@@ -70,7 +72,9 @@ void DetectXbitsRegister (void)
     sigmatch_table[DETECT_XBITS].Match = DetectXbitMatch;
     sigmatch_table[DETECT_XBITS].Setup = DetectXbitSetup;
     sigmatch_table[DETECT_XBITS].Free  = DetectXbitFree;
+#ifdef UNITTESTS
     sigmatch_table[DETECT_XBITS].RegisterTests = XBitsRegisterTests;
+#endif
     /* this is compatible to ip-only signatures */
     sigmatch_table[DETECT_XBITS].flags |= SIGMATCH_IPONLY_COMPAT;
 
@@ -363,7 +367,7 @@ error:
     return -1;
 }
 
-void DetectXbitFree (DetectEngineCtx *de_ctx, void *ptr)
+static void DetectXbitFree (DetectEngineCtx *de_ctx, void *ptr)
 {
     DetectXbitsData *fd = (DetectXbitsData *)ptr;
 
@@ -534,16 +538,13 @@ static int XBitsTestSig02(void)
     PASS;
 }
 
-#endif /* UNITTESTS */
-
 /**
  * \brief this function registers unit tests for XBits
  */
-void XBitsRegisterTests(void)
+static void XBitsRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("XBitsTestParse01", XBitsTestParse01);
     UtRegisterTest("XBitsTestSig01", XBitsTestSig01);
     UtRegisterTest("XBitsTestSig02", XBitsTestSig02);
-#endif /* UNITTESTS */
 }
+#endif /* UNITTESTS */
\ No newline at end of file
index eab188d9ddba8e1c72e86d0a8a375a135e4ff9fa..2499552ef1ad81a5681b1fbe5ae4b090f02daf16 100644 (file)
@@ -1198,8 +1198,9 @@ typedef struct SigTableElmt_ {
     int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh);
 
     void (*Free)(DetectEngineCtx *, void *);
+#ifdef UNITTESTS
     void (*RegisterTests)(void);
-
+#endif
     uint16_t flags;
     /* coccinelle: SigTableElmt:flags:SIGMATCH_ */