detect/threshold: fix unittests for storage based cache

pull/15499/head
Victor Julien 2 months ago
parent c27868a8c5
commit f67dadc3d8

@ -625,15 +625,25 @@ static void ThresholdCacheThreadFree(void *ptr)
static void ThresholdCacheInit(void)
{
/* Register thread storage. */
thread_storage_id = SCThreadStorageRegister("threshold_cache", ThresholdCacheThreadFree);
if (thread_storage_id.id < 0) {
FatalError("Failed to register threshold_cache thread storage");
#ifdef UNITTESTS
/* many tests don't manage the thread storage correctly, so skip the cache in unittests */
if (!(RunmodeIsUnittests())) {
#endif
/* Register thread storage. */
thread_storage_id = SCThreadStorageRegister("threshold_cache", ThresholdCacheThreadFree);
if (thread_storage_id.id < 0) {
FatalError("Failed to register threshold_cache thread storage");
}
#ifdef UNITTESTS
}
#endif
}
int ThresholdCacheThreadInit(DetectEngineThreadCtx *det_ctx)
{
if (thread_storage_id.id < 0)
return 0;
struct ThresholdCacheThreadCtx *tctx = SCCalloc(1, sizeof(*tctx));
if (tctx == NULL)
return -1;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save