PrefilterRuleStore *pmq, const uint8_t *buf,
uint32_t buflen);
void SCACTilePrintInfo(MpmCtx *mpm_ctx);
-void SCACTileRegisterTests(void);
+#ifdef UNITTESTS
+static void SCACTileRegisterTests(void);
+#endif
uint32_t SCACTileSearchLarge(const SCACTileSearchCtx *ctx, MpmThreadCtx *mpm_thread_ctx,
PrefilterRuleStore *pmq,
mpm_table[MPM_AC_KS].Prepare = SCACTilePreparePatterns;
mpm_table[MPM_AC_KS].Search = SCACTileSearch;
mpm_table[MPM_AC_KS].PrintCtx = SCACTilePrintInfo;
+#ifdef UNITTESTS
mpm_table[MPM_AC_KS].RegisterUnittests = SCACTileRegisterTests;
+#endif
}
return result;
}
-#endif /* UNITTESTS */
-
void SCACTileRegisterTests(void)
{
-
-#ifdef UNITTESTS
UtRegisterTest("SCACTileTest01", SCACTileTest01);
UtRegisterTest("SCACTileTest02", SCACTileTest02);
UtRegisterTest("SCACTileTest03", SCACTileTest03);
UtRegisterTest("SCACTileTest27", SCACTileTest27);
UtRegisterTest("SCACTileTest28", SCACTileTest28);
UtRegisterTest("SCACTileTest29", SCACTileTest29);
-#endif
}
+#endif
#else /* we're big endian */
uint32_t SCACSearch(const MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx,
PrefilterRuleStore *pmq, const uint8_t *buf, uint32_t buflen);
void SCACPrintInfo(MpmCtx *mpm_ctx);
-void SCACRegisterTests(void);
+#ifdef UNITTESTS
+static void SCACRegisterTests(void);
+#endif
/* a placeholder to denote a failure transition in the goto table */
#define SC_AC_FAIL (-1)
mpm_table[MPM_AC].Prepare = SCACPreparePatterns;
mpm_table[MPM_AC].Search = SCACSearch;
mpm_table[MPM_AC].PrintCtx = SCACPrintInfo;
+#ifdef UNITTESTS
mpm_table[MPM_AC].RegisterUnittests = SCACRegisterTests;
-
+#endif
return;
}
return result;
}
-#endif /* UNITTESTS */
-
void SCACRegisterTests(void)
{
-
-#ifdef UNITTESTS
UtRegisterTest("SCACTest01", SCACTest01);
UtRegisterTest("SCACTest02", SCACTest02);
UtRegisterTest("SCACTest03", SCACTest03);
UtRegisterTest("SCACTest27", SCACTest27);
UtRegisterTest("SCACTest28", SCACTest28);
UtRegisterTest("SCACTest29", SCACTest29);
-#endif
-
- return;
}
+#endif /* UNITTESTS */
PrefilterRuleStore *pmq, const uint8_t *buf, const uint32_t buflen);
void SCHSPrintInfo(MpmCtx *mpm_ctx);
void SCHSPrintSearchStats(MpmThreadCtx *mpm_thread_ctx);
-void SCHSRegisterTests(void);
+#ifdef UNITTESTS
+static void SCHSRegisterTests(void);
+#endif
/* size of the hash table used to speed up pattern insertions initially */
#define INIT_HASH_SIZE 65536
mpm_table[MPM_HS].Search = SCHSSearch;
mpm_table[MPM_HS].PrintCtx = SCHSPrintInfo;
mpm_table[MPM_HS].PrintThreadCtx = SCHSPrintSearchStats;
+#ifdef UNITTESTS
mpm_table[MPM_HS].RegisterUnittests = SCHSRegisterTests;
-
+#endif
/* Set Hyperscan memory allocators */
SCHSSetAllocators();
}
return result;
}
-#endif /* UNITTESTS */
-
-void SCHSRegisterTests(void)
+static void SCHSRegisterTests(void)
{
-#ifdef UNITTESTS
UtRegisterTest("SCHSTest01", SCHSTest01);
UtRegisterTest("SCHSTest02", SCHSTest02);
UtRegisterTest("SCHSTest03", SCHSTest03);
UtRegisterTest("SCHSTest27", SCHSTest27);
UtRegisterTest("SCHSTest28", SCHSTest28);
UtRegisterTest("SCHSTest29", SCHSTest29);
-#endif
-
- return;
}
-
+#endif /* UNITTESTS */
#endif /* BUILD_HYPERSCAN */
uint32_t (*Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t);
void (*PrintCtx)(struct MpmCtx_ *);
void (*PrintThreadCtx)(struct MpmThreadCtx_ *);
+#ifdef UNITTESTS
void (*RegisterUnittests)(void);
+#endif
} MpmTableElmt;
extern MpmTableElmt mpm_table[MPM_TABLE_SIZE];