*
*/
-#include <config.h>
-#include <libtest/test.hpp>
+#include "mem_config.h"
+#include "libtest/test.hpp"
using namespace libtest;
#include <semaphore.h>
-#include <libmemcached-1.0/memcached.h>
-#include <libmemcachedutil-1.0/util.h>
-#include <libmemcached/is.h>
-#include <tests/pool.h>
+#include "libmemcached-1.0/memcached.h"
+#include "libmemcachedutil-1.0/util.h"
+#include "libmemcached/is.h"
+#include "tests/pool.h"
#include <pthread.h>
#include <poll.h>
-#include "libmemcached/instance.h"
+#include "libmemcached/instance.hpp"
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
test_compare(MEMCACHED_SUCCESS, rc);
}
- test_compare(UINT64_C(9999), memcached_behavior_get(mmc[1], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
+ test_compare(uint64_t(9999), memcached_behavior_get(mmc[1], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
test_compare(MEMCACHED_SUCCESS, memcached_pool_release(pool, mmc[1]));
test_compare(MEMCACHED_SUCCESS, memcached_pool_release(pool, mmc[0]));
test_compare(MEMCACHED_SUCCESS, rc);
}
- test_compare(UINT64_C(9999), memcached_behavior_get(mmc[0], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
+ test_compare(uint64_t(9999), memcached_behavior_get(mmc[0], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
test_compare(MEMCACHED_SUCCESS, memcached_pool_release(pool, mmc[0]));
test_true(memcached_pool_destroy(pool) == memc);
static __attribute__((noreturn)) void* connection_release(void *arg)
{
test_pool_context_st *resource= static_cast<test_pool_context_st *>(arg);
- if (resource == NULL)
- {
- fatal_message("resource == NULL");
- }
+ FATAL_IF(resource == NULL);
// Release all of the memc we are holding
resource->rc= memcached_pool_release(resource->pool, resource->mmc);
* I only want to hit _one_ server so I know the number of requests I'm
* sending in the pipeline.
*/
- memcached_server_instance_st instance= memcached_server_instance_by_position(original_memc, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(original_memc, 0);
char server_string[1024];
int server_string_length;
static void set_running(const bool arg)
{
int error;
- if ((error= pthread_mutex_lock(&mutex)) != 0)
- {
- fatal_message(strerror(error));
- }
+ FATAL_IF_((error= pthread_mutex_lock(&mutex)) != 0, strerror(error));
_running= arg;
- if ((error= pthread_mutex_unlock(&mutex)) != 0)
- {
- fatal_message(strerror(error));
- }
+ FATAL_IF_((error= pthread_mutex_unlock(&mutex)) != 0, strerror(error));
}
static bool running()
int error;
bool ret;
- if ((error= pthread_mutex_lock(&mutex)) != 0)
- {
- fatal_message(strerror(error));
- }
+ FATAL_IF_((error= pthread_mutex_lock(&mutex)) != 0, strerror(error));
ret= _running;
- if ((error= pthread_mutex_unlock(&mutex)) != 0)
- {
- fatal_message(strerror(error));
- }
+ FATAL_IF_((error= pthread_mutex_unlock(&mutex)) != 0, strerror(error));
return ret;
}
test_compare(0, pthread_join(pid[x], NULL));
}
- if (pool)
- {
- memcached_pool_destroy(pool);
- }
+ memcached_pool_destroy(pool);
- if (master)
- {
- memcached_free(master);
- }
+ memcached_free(master);
return TEST_SUCCESS;
}