tm/queuehandlers: hide unittest registration

Use unittest guards.
pull/15053/head
Victor Julien 10 months ago
parent 6587e363a3
commit f4668b7132

@ -40,7 +40,9 @@ typedef struct Tmqh_ {
void (*OutHandler)(ThreadVars *, Packet *); void (*OutHandler)(ThreadVars *, Packet *);
void *(*OutHandlerCtxSetup)(const char *); void *(*OutHandlerCtxSetup)(const char *);
void (*OutHandlerCtxFree)(void *); void (*OutHandlerCtxFree)(void *);
#ifdef UNITTESTS
void (*RegisterTests)(void); void (*RegisterTests)(void);
#endif
} Tmqh; } Tmqh;
extern Tmqh tmqh_table[TMQH_SIZE]; extern Tmqh tmqh_table[TMQH_SIZE];

@ -46,7 +46,9 @@ void TmqhOutputFlowIPPair(ThreadVars *t, Packet *p);
static void TmqhOutputFlowFTPHash(ThreadVars *t, Packet *p); static void TmqhOutputFlowFTPHash(ThreadVars *t, Packet *p);
void *TmqhOutputFlowSetupCtx(const char *queue_str); void *TmqhOutputFlowSetupCtx(const char *queue_str);
void TmqhOutputFlowFreeCtx(void *ctx); void TmqhOutputFlowFreeCtx(void *ctx);
#ifdef UNITTESTS
void TmqhFlowRegisterTests(void); void TmqhFlowRegisterTests(void);
#endif
void TmqhFlowRegister(void) void TmqhFlowRegister(void)
{ {
@ -54,8 +56,9 @@ void TmqhFlowRegister(void)
tmqh_table[TMQH_FLOW].InHandler = TmqhInputFlow; tmqh_table[TMQH_FLOW].InHandler = TmqhInputFlow;
tmqh_table[TMQH_FLOW].OutHandlerCtxSetup = TmqhOutputFlowSetupCtx; tmqh_table[TMQH_FLOW].OutHandlerCtxSetup = TmqhOutputFlowSetupCtx;
tmqh_table[TMQH_FLOW].OutHandlerCtxFree = TmqhOutputFlowFreeCtx; tmqh_table[TMQH_FLOW].OutHandlerCtxFree = TmqhOutputFlowFreeCtx;
#ifdef UNITTESTS
tmqh_table[TMQH_FLOW].RegisterTests = TmqhFlowRegisterTests; tmqh_table[TMQH_FLOW].RegisterTests = TmqhFlowRegisterTests;
#endif
const char *scheduler = NULL; const char *scheduler = NULL;
if (SCConfGet("autofp-scheduler", &scheduler) == 1) { if (SCConfGet("autofp-scheduler", &scheduler) == 1) {
if (strcasecmp(scheduler, "round-robin") == 0) { if (strcasecmp(scheduler, "round-robin") == 0) {
@ -391,16 +394,12 @@ static int TmqhOutputFlowSetupCtxTest03(void)
PASS; PASS;
} }
#endif /* UNITTESTS */
void TmqhFlowRegisterTests(void) void TmqhFlowRegisterTests(void)
{ {
#ifdef UNITTESTS
UtRegisterTest("TmqhOutputFlowSetupCtxTest01", UtRegisterTest("TmqhOutputFlowSetupCtxTest01",
TmqhOutputFlowSetupCtxTest01); TmqhOutputFlowSetupCtxTest01);
UtRegisterTest("TmqhOutputFlowSetupCtxTest02", UtRegisterTest("TmqhOutputFlowSetupCtxTest02",
TmqhOutputFlowSetupCtxTest02); TmqhOutputFlowSetupCtxTest02);
UtRegisterTest("TmqhOutputFlowSetupCtxTest03", UtRegisterTest("TmqhOutputFlowSetupCtxTest03", TmqhOutputFlowSetupCtxTest03);
TmqhOutputFlowSetupCtxTest03);
#endif
} }
#endif /* UNITTESTS */

Loading…
Cancel
Save