From 45c5ffb0c0840d7c7cd6489e42708ec79df9ab2e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 7 Jan 2016 11:27:41 +0000 Subject: [PATCH] Fix tests --- src/libcryptobox/siphash/ref.c | 8 -------- src/libutil/util.c | 15 ++++++++------- test/CMakeLists.txt | 4 ++++ test/rspamd_mem_pool_test.c | 14 -------------- 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/libcryptobox/siphash/ref.c b/src/libcryptobox/siphash/ref.c index 1a09f2066..cbd244f5f 100644 --- a/src/libcryptobox/siphash/ref.c +++ b/src/libcryptobox/siphash/ref.c @@ -31,14 +31,6 @@ #define ROTL(x,b) (uint64_t)( ((x) << (b)) | ( (x) >> (64 - (b))) ) -#define U32TO8_LE(p, v) \ - (p)[0] = (uint8_t)((v) ); (p)[1] = (uint8_t)((v) >> 8); \ - (p)[2] = (uint8_t)((v) >> 16); (p)[3] = (uint8_t)((v) >> 24); - -#define U64TO8_LE(p, v) \ - U32TO8_LE((p), (uint32_t)((v) )); \ - U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); - #if BYTE_ORDER != LITTLE_ENDIAN #define U8TO64_LE(p) \ (((uint64_t)((p)[0]) << 0) | \ diff --git a/src/libutil/util.c b/src/libutil/util.c index 994f475b9..dc9e03201 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1990,15 +1990,16 @@ void rspamd_config_libs (struct rspamd_external_libs_ctx *ctx, struct rspamd_config *cfg) { - g_assert (ctx != NULL); g_assert (cfg != NULL); - if (cfg->local_addrs) { - if (!rspamd_map_add (cfg, cfg->local_addrs, - "Local addresses", rspamd_radix_read, rspamd_radix_fin, - (void **) ctx->local_addrs)) { - radix_add_generic_iplist (cfg->local_addrs, - (radix_compressed_t **)ctx->local_addrs); + if (ctx != NULL) { + if (cfg->local_addrs) { + if (!rspamd_map_add (cfg, cfg->local_addrs, + "Local addresses", rspamd_radix_read, rspamd_radix_fin, + (void **) ctx->local_addrs)) { + radix_add_generic_iplist (cfg->local_addrs, + (radix_compressed_t **)ctx->local_addrs); + } } } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 241565b19..a2096c128 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -28,6 +28,10 @@ TARGET_LINK_LIBRARIES(rspamd-test ${RSPAMD_REQUIRED_LIBRARIES}) IF (ENABLE_SNOWBALL MATCHES "ON") TARGET_LINK_LIBRARIES(rspamd-test stemmer) ENDIF() +IF (ENABLE_HYPERSCAN MATCHES "ON") + TARGET_LINK_LIBRARIES(rspamd-test hs) + SET_TARGET_PROPERTIES(rspamd-test PROPERTIES LINKER_LANGUAGE CXX) +ENDIF() TARGET_LINK_LIBRARIES(rspamd-test rspamd-actrie) ADD_CUSTOM_TARGET(rspamd-func-test COMMAND diff --git a/test/rspamd_mem_pool_test.c b/test/rspamd_mem_pool_test.c index e8813f574..61b9a7a94 100644 --- a/test/rspamd_mem_pool_test.c +++ b/test/rspamd_mem_pool_test.c @@ -32,20 +32,6 @@ rspamd_mem_pool_test_func () g_assert (strncmp (tmp, TEST_BUF, sizeof (TEST_BUF)) == 0); g_assert (strncmp (tmp2, TEST2_BUF, sizeof (TEST2_BUF)) == 0); g_assert (strncmp (tmp3, TEST_BUF, sizeof (TEST_BUF)) == 0); - rspamd_mempool_lock_shared (pool, tmp3); - if ((pid = fork ()) == 0) { - rspamd_mempool_lock_shared (pool, tmp3); - g_assert (*tmp3 == 's'); - *tmp3 = 't'; - rspamd_mempool_unlock_shared (pool, tmp3); - exit (EXIT_SUCCESS); - } - else { - *tmp3 = 's'; - rspamd_mempool_unlock_shared (pool, tmp3); - } - wait (&ret); - g_assert (*tmp3 == 't'); rspamd_mempool_delete (pool); rspamd_mempool_stat (&st); -- 2.39.5