]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittests: wrap unittest registration in guards
authorVictor Julien <vjulien@oisf.net>
Wed, 27 Apr 2022 14:54:49 +0000 (16:54 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 9 May 2022 14:06:39 +0000 (16:06 +0200)
src/util-action.c
src/util-action.h
src/util-misc.c
src/util-misc.h
src/util-spm.c
src/util-spm.h

index 96991b5c2c2938540520c455b30fbeb44a64aca3..cf052e5270ab650b41f8dceb9f35adf44cfeccae 100644 (file)
@@ -1590,12 +1590,9 @@ done:
     return res;
 }
 
-#endif
-
 /* Register unittests */
 void UtilActionRegisterTests(void)
 {
-#ifdef UNITTESTS
     /* Generic tests */
     UtRegisterTest("UtilActionTest01", UtilActionTest01);
     UtRegisterTest("UtilActionTest02", UtilActionTest02);
@@ -1622,5 +1619,5 @@ void UtilActionRegisterTests(void)
     UtRegisterTest("UtilActionTest22", UtilActionTest22);
     UtRegisterTest("UtilActionTest23", UtilActionTest23);
     UtRegisterTest("UtilActionTest24", UtilActionTest24);
-#endif
 }
+#endif
index 0413067609728fd0086a94a4a8b1d1a695227080..6c96ba08b6ff2d5e5fb6ca0214a750fcc6b0517e 100644 (file)
@@ -28,6 +28,7 @@
 
 int ActionInitConfig(void);
 uint8_t ActionOrderVal(uint8_t);
+#ifdef UNITTESTS
 void UtilActionRegisterTests(void);
-
+#endif
 #endif /* __ACTION_ORDER_H__ */
index e5feb1be02d77e0b3756cb84d83bd3b44a353d57..32816f8e3335345a1490b8149678a54aac0c83d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -1166,14 +1166,9 @@ static int UtilMiscParseSizeStringTest01(void)
     return 0;
 }
 
-#endif /* UNITTESTS */
-
 void UtilMiscRegisterTests(void)
 {
-#ifdef UNITTESTS
     UtRegisterTest("UtilMiscParseSizeStringTest01",
                    UtilMiscParseSizeStringTest01);
-#endif /* UNITTESTS */
-
-    return;
 }
+#endif /* UNITTESTS */
index e39e48795289ac6bea1a4adafb1578f95c8d9770..8ae730931af770e3946c92e06baaf4b3358c6540 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -47,7 +47,10 @@ int ParseSizeStringU8(const char *, uint8_t *);
 int ParseSizeStringU16(const char *, uint16_t *);
 int ParseSizeStringU32(const char *, uint32_t *);
 int ParseSizeStringU64(const char *, uint64_t *);
+
+#ifdef UNITTESTS
 void UtilMiscRegisterTests(void);
+#endif /* UNITTESTS */
 
 void ParseSizeInit(void);
 void ParseSizeDeinit(void);
index 0652758e707f14d3446d722f08fb5a755e46153b..b3b14d7f71385c961bc6c7c33b5727d276de68f6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2014 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -2671,12 +2671,9 @@ static int SpmSearchTest02(void) {
     return ret;
 }
 
-#endif
-
 /* Register unittests */
 void UtilSpmSearchRegistertests(void)
 {
-#ifdef UNITTESTS
     /* Generic tests */
     UtRegisterTest("UtilSpmBasicSearchTest01", UtilSpmBasicSearchTest01);
     UtRegisterTest("UtilSpmBasicSearchNocaseTest01",
@@ -2743,6 +2740,6 @@ void UtilSpmSearchRegistertests(void)
     UtRegisterTest("UtilSpmNocaseSearchStatsTest07",
                    UtilSpmNocaseSearchStatsTest07);
 
-#endif
 #endif
 }
+#endif
index dbffb2bf30469070856c4a5de3d40445e9684857..6e4372f40a39ef34e5adfbd3b2a568e2cd0c7c0f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2022 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -120,5 +120,7 @@ uint8_t *BoyerMooreNocaseSearch(const uint8_t *text, uint32_t textlen, uint8_t *
     mfound; \
     })
 
+#ifdef UNITTESTS
 void UtilSpmSearchRegistertests(void);
+#endif
 #endif /* __UTIL_SPM_H__ */