tests/testudp
tests/var/
unittests/unittests
+out
+*.orig
# includes append to these:
SUFFIXES =
+.PHONY =
PHONY =
TESTS =
CLEANFILES =
*/
#include <libmemcached/common.h>
-#include <cassert>
#define MAX_ERROR_LENGTH 2048
struct memcached_error_t
memcached_return_t memcached_set_error(memcached_st& memc, memcached_return_t rc, const char *at, const char *str, size_t length)
{
- assert(rc != MEMCACHED_ERRNO);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
memcached_string_t tmp= { str, length };
return memcached_set_error(memc, rc, at, tmp);
}
memcached_return_t memcached_set_error(memcached_server_st& self, memcached_return_t rc, const char *at, const char *str, size_t length)
{
- assert(rc != MEMCACHED_ERRNO);
- assert(rc != MEMCACHED_SOME_ERRORS);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
+ assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_server_st");
memcached_string_t tmp= { str, length };
return memcached_set_error(self, rc, at, tmp);
}
memcached_return_t memcached_set_error(memcached_st& memc, memcached_return_t rc, const char *at, memcached_string_t& str)
{
- assert(rc != MEMCACHED_ERRNO);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
if (memcached_success(rc))
return MEMCACHED_SUCCESS;
memcached_return_t memcached_set_error(memcached_server_st& self, memcached_return_t rc, const char *at, memcached_string_t& str)
{
- assert(rc != MEMCACHED_ERRNO);
- assert(rc != MEMCACHED_SOME_ERRORS);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
+ assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_server_st");
if (memcached_success(rc))
return MEMCACHED_SUCCESS;
memcached_return_t memcached_set_error(memcached_server_st& self, memcached_return_t rc, const char *at)
{
- assert(rc != MEMCACHED_ERRNO);
- assert(rc != MEMCACHED_SOME_ERRORS);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
+ assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_server_st");
if (memcached_success(rc))
return MEMCACHED_SUCCESS;
memcached_return_t memcached_set_error(memcached_st& self, memcached_return_t rc, const char *at)
{
- assert(rc != MEMCACHED_ERRNO);
+ assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
if (memcached_success(rc))
return MEMCACHED_SUCCESS;
*/
#include <libmemcached/common.h>
-#include <cassert>
/*
What happens if no servers exist?
*error= memcached_mget_by_key_real(ptr, group_key, group_key_length,
(const char * const *)&key, &key_length,
1, false);
- assert(ptr->query_id == query_id +1);
+ assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented.");
if (memcached_failed(*error))
char *value= memcached_fetch(ptr, NULL, NULL,
value_length, flags, error);
- assert(ptr->query_id == query_id +1);
+ assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented.");
/* This is for historical reasons */
if (*error == MEMCACHED_END)
}
}
}
- assert(ptr->query_id == query_id +1);
+ assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented.");
return NULL;
}
&dummy_error);
WATCHPOINT_ASSERT(dummy_length == 0);
WATCHPOINT_ASSERT(dummy_value == 0);
- assert(ptr->query_id == query_id +1);
+ assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented.");
return value;
}
#include <libmemcached/common.h>
-#include <cassert>
enum memc_read_or_write {
MEM_READ,
memcached_return_t memcached_io_read(memcached_server_write_instance_st ptr,
void *buffer, size_t length, ssize_t *nread)
{
- assert(ptr); // Programmer error
+ assert_msg(ptr, "Programmer error, memcached_io_read() recieved an invalid memcached_server_write_instance_st"); // Programmer error
char *buffer_ptr= static_cast<char *>(buffer);
if (ptr->fd == INVALID_SOCKET)
{
- assert(int(ptr->state) <= int(MEMCACHED_SERVER_STATE_ADDRINFO));
+ assert_msg(int(ptr->state) <= int(MEMCACHED_SERVER_STATE_ADDRINFO), "Programmer error, invalid socket state");
return MEMCACHED_CONNECTION_FAILURE;
}
case ENOTSOCK:
WATCHPOINT_ASSERT(0);
case EBADF:
- assert(ptr->fd != INVALID_SOCKET);
+ assert_msg(ptr->fd != INVALID_SOCKET, "Programmer error, invalid socket");
case EINVAL:
case EFAULT:
case ECONNREFUSED:
it will return EGAIN if data is not immediatly available.
*/
WATCHPOINT_STRING("We had a zero length recv()");
- assert(0);
memcached_quit_server(ptr, true);
*nread= -1;
return memcached_set_error(*ptr, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT);
memcached_return_t memcached_io_slurp(memcached_server_write_instance_st ptr)
{
- assert(ptr); // Programmer error
+ assert_msg(ptr, "Programmer error, invalid memcached_server_write_instance_st");
if (ptr->fd == INVALID_SOCKET)
{
- assert(int(ptr->state) <= int(MEMCACHED_SERVER_STATE_ADDRINFO));
+ assert_msg(int(ptr->state) <= int(MEMCACHED_SERVER_STATE_ADDRINFO), "Invalid socket state");
return MEMCACHED_CONNECTION_FAILURE;
}
case ENOTSOCK:
WATCHPOINT_ASSERT(0);
case EBADF:
- assert(ptr->fd != INVALID_SOCKET);
+ assert_msg(ptr->fd != INVALID_SOCKET, "Invalid socket state");
case EINVAL:
case EFAULT:
case ECONNREFUSED:
#include <libmemcached/common.h>
#include <libmemcached/options.hpp>
-#include <cassert>
-
#include <libmemcached/options/context.h>
const char *memcached_parse_filename(memcached_st *memc)
{
- assert(memc);
+ assert_msg(memc, "Invalid memcached_st");
return memcached_array_string(memc->configure.filename);
}
bool has_filename= memcached_behavior_get(memc_ptr, MEMCACHED_BEHAVIOR_LOAD_FROM_FILE);
if (memcached_success(rc) and has_filename)
{
- assert(memcached_parse_filename(memc_ptr));
- assert(memcached_parse_filename_length(memc_ptr));
- memcached_string_t filename= memcached_array_to_string(memc_ptr->configure.filename);
+ assert_msg(memcached_parse_filename(memc_ptr), "Invalid configuration file");
+ assert_msg(memcached_parse_filename_length(memc_ptr), "Invalid configuration file");
rc= _parse_file_options(*memc_ptr, memc_ptr->configure.filename);
if (memcached_failed(rc) and error_buffer && error_buffer_size)
void memcached_set_configuration_file(memcached_st *self, const char *filename, size_t filename_length)
{
- assert(filename);
- assert(filename_length);
+ assert_msg(filename, "Invalid filename");
+ assert_msg(filename_length, "Invalid filename_length");
memcached_array_free(self->configure.filename);
self->configure.filename= memcached_strcpy(self, filename, filename_length);
}
This is a partial implementation for fetching/creating memcached_server_st objects.
*/
#include <libmemcached/common.h>
-#include <cassert>
static inline void _server_init(memcached_server_st *self, memcached_st *root,
const char *hostname, in_port_t port,
#include <libmemcached/common.h>
-#include <libmemcached/assert.hpp>
memcached_server_list_st
memcached_server_list_append_with_weight(memcached_server_list_st ptr,
#include <libmemcached/common.h>
-#include <cassert>
inline static memcached_return_t _string_check(memcached_string_st *string, size_t need)
{
char *memcached_string_take_value(memcached_string_st *self)
{
- assert(self);
+ assert_msg(self, "Invalid memcached_string_st");
// If we fail at adding the null, we copy and move on
if (memcached_success(memcached_string_append_null(self)))
{
LIBUTEST_TMP = ${abs_top_builddir}/tests/var/tmp/
VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
-HELGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1
+HELGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 -v
DRD_COMMAND= $(LIBTOOL) --mode=execute valgrind --tool=drd
-GDB_COMMAND= $(LIBTOOL) --mode=execute gdb
+GDB_COMMAND= $(LIBTOOL) --mode=execute gdb -f -x libtest/run.gdb
+
+EXTRA_DIST+= libtest/run.gdb
CLEANFILES+= \
tests/var/log/* \
--- /dev/null
+set environment LIBTEST_IN_GDB=1
+run
return false;
}
+ if (is_valgrind() or is_helgrind())
+ {
+ _running+= " &";
+ }
+
if (system(_running.c_str()) == -1)
{
Error << "system() failed:" << strerror(errno);
return false;
}
+ if (is_helgrind())
+ {
+ sleep(4);
+ }
+
if (pid_file_option() and not pid_file().empty())
{
Wait wait(pid_file());
}
}
- int count= 5;
+ int count= is_helgrind() ? 20 : 5;
while (not ping() and --count)
{
nap();
}
else if (is_valgrind())
{
- _base_command+= "valgrind --log-file=tests/var/tmp/valgrind.out --leak-check=full --show-reachable=yes ";
+ _base_command+= "valgrind --log-file=tests/var/tmp/valgrind.out --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE ";
+
+ }
+ else if (is_helgrind())
+ {
+ _base_command+= "valgrind --log-file=tests/var/tmp/helgrind.out --tool=helgrind --read-var-info=yes --error-exitcode=1 -v ";
}
_base_command+= executable();
}
assert(daemon_file_option());
- if (daemon_file_option())
+ if (daemon_file_option() and not is_valgrind() and not is_helgrind())
{
arg_buffer << " " << daemon_file_option();
}
return bool(getenv("LIBTEST_MANUAL_VALGRIND"));
}
+bool Server::is_helgrind() const
+{
+ return bool(getenv("LIBTEST_MANUAL_HELGRIND"));
+}
+
bool Server::kill(pid_t pid_arg)
{
if (check_pid(pid_arg) and kill_pid(pid_arg)) // If we kill it, reset
return bool(getenv("LIBTEST_MANUAL_VALGRIND"));
}
+bool server_startup_st::is_helgrind() const
+{
+ return bool(getenv("LIBTEST_MANUAL_HELGRIND"));
+}
+
+
bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[])
{
Outn();
void nap();
private:
+ bool is_helgrind() const;
bool is_valgrind() const;
bool is_debug() const;
bool set_log_file();
}
bool is_debug() const;
+ bool is_helgrind() const;
bool is_valgrind() const;
void shutdown(bool remove= false);
#include <libtest/common.h>
-#include <pthread.h>
-#include <semaphore.h>
#include <csignal>
#include <libtest/signal.h>
using namespace libtest;
-struct context_st {
- sigset_t set;
- sem_t lock;
+#define MAGIC_MEMORY 123569
- context_st()
- {
- sigemptyset(&set);
- sigaddset(&set, SIGQUIT);
- sigaddset(&set, SIGINT);
-
- sem_init(&lock, 0, 0);
- }
-
- void test()
- {
- assert(sigismember(&set, SIGQUIT));
- assert(sigismember(&set, SIGINT));
- }
-
- int wait(int& sig)
- {
- return sigwait(&set, &sig);
- }
-
- ~context_st()
- {
- sem_destroy(&lock);
- }
-};
-
-static volatile shutdown_t __shutdown;
-static pthread_mutex_t shutdown_mutex;
-static pthread_t thread;
-
-bool is_shutdown()
+bool SignalThread::is_shutdown()
{
bool ret;
pthread_mutex_lock(&shutdown_mutex);
return ret;
}
-void set_shutdown(shutdown_t arg)
+void SignalThread::set_shutdown(shutdown_t arg)
{
pthread_mutex_lock(&shutdown_mutex);
__shutdown= arg;
if (arg == SHUTDOWN_GRACEFUL)
{
- pthread_kill(thread, SIGQUIT);
+ pthread_kill(thread, SIGUSR2);
void *retval;
pthread_join(thread, &retval);
}
}
-shutdown_t get_shutdown()
+shutdown_t SignalThread::get_shutdown()
{
shutdown_t local;
pthread_mutex_lock(&shutdown_mutex);
return local;
}
+void SignalThread::post()
+{
+ sem_post(&lock);
+}
+
+void SignalThread::test()
+{
+ assert(magic_memory == MAGIC_MEMORY);
+ if (not getenv("LIBTEST_IN_GDB"))
+ {
+ assert(sigismember(&set, SIGABRT));
+ assert(sigismember(&set, SIGQUIT));
+ assert(sigismember(&set, SIGINT));
+ }
+ assert(sigismember(&set, SIGUSR2));
+}
+
extern "C" {
static void *sig_thread(void *arg)
{
- context_st *context= (context_st*)arg;
- assert(context);
+ SignalThread *context= (SignalThread*)arg;
context->test();
- sem_post(&context->lock);
+ context->post();
- while (get_shutdown() == SHUTDOWN_RUNNING)
+ while (context->get_shutdown() == SHUTDOWN_RUNNING)
{
int sig;
switch (sig)
{
+ case SIGABRT:
+ case SIGUSR2:
case SIGINT:
case SIGQUIT:
- if (is_shutdown() == false)
+ if (context->is_shutdown() == false)
{
Error << "Signal handling thread got signal " << strsignal(sig);
- set_shutdown(SHUTDOWN_FORCED);
+ context->set_shutdown(SHUTDOWN_FORCED);
}
break;
}
}
- delete context;
-
return NULL;
}
}
-void setup_signals()
+SignalThread::SignalThread() :
+ magic_memory(MAGIC_MEMORY)
{
pthread_mutex_init(&shutdown_mutex, NULL);
- set_shutdown(SHUTDOWN_RUNNING);
+ sigemptyset(&set);
+ if (not getenv("LIBTEST_IN_GDB"))
+ {
+ sigaddset(&set, SIGABRT);
+ sigaddset(&set, SIGQUIT);
+ sigaddset(&set, SIGINT);
+ }
+
+ sigaddset(&set, SIGUSR2);
+
+ sem_init(&lock, 0, 0);
+}
- context_st *context= new context_st;
- assert(context);
+bool SignalThread::setup()
+{
+ set_shutdown(SHUTDOWN_RUNNING);
sigset_t old_set;
sigemptyset(&old_set);
{
Error << strsignal(SIGINT) << " has been previously set.";
}
+ if (sigismember(&old_set, SIGUSR2))
+ {
+ Error << strsignal(SIGUSR2) << " has been previously set.";
+ }
int error;
- if ((error= pthread_sigmask(SIG_BLOCK, &context->set, NULL)) != 0)
+ if ((error= pthread_sigmask(SIG_BLOCK, &set, NULL)) != 0)
{
Error << "pthread_sigmask() died during pthread_sigmask(" << strerror(error) << ")";
- exit(EXIT_FAILURE);
+ return false;
}
- if ((error= pthread_create(&thread, NULL, &sig_thread, (void *) &context->set)) != 0)
+ if ((error= pthread_create(&thread, NULL, &sig_thread, this)) != 0)
{
Error << "pthread_create() died during pthread_create(" << strerror(error) << ")";
- exit(EXIT_FAILURE);
+ return false;
}
- sem_wait(&context->lock);
+ sem_wait(&lock);
+
+ return true;
}
#pragma once
+#include <pthread.h>
+#include <semaphore.h>
+
enum shutdown_t {
SHUTDOWN_RUNNING,
SHUTDOWN_GRACEFUL,
SHUTDOWN_FORCED
};
-LIBTEST_INTERNAL_API
-bool is_shutdown();
+namespace libtest {
+
+class SignalThread {
+ sigset_t set;
+ sem_t lock;
+ uint64_t magic_memory;
+ volatile shutdown_t __shutdown;
+ pthread_mutex_t shutdown_mutex;
+ pthread_t thread;
+
+public:
+
+ SignalThread();
-LIBTEST_INTERNAL_API
-shutdown_t get_shutdown();
+ void test();
+ void post();
+ bool setup();
-LIBTEST_INTERNAL_API
-void set_shutdown(shutdown_t arg);
+ int wait(int& sig)
+ {
+ return sigwait(&set, &sig);
+ }
+
+ ~SignalThread()
+ {
+ sem_destroy(&lock);
+ }
+
+ void set_shutdown(shutdown_t arg);
+ bool is_shutdown();
+ shutdown_t get_shutdown();
+};
-LIBTEST_INTERNAL_API
-void setup_signals(void);
+} // namespace libtest
return EXIT_FAILURE;
}
- setup_signals();
+ libtest::SignalThread signal;
+ if (not signal.setup())
+ {
+ return EXIT_FAILURE;
+ }
Stats stats;
wildcard= argv[2];
}
- for (collection_st *next= world->collections; next->name and (not is_shutdown()); next++)
+ for (collection_st *next= world->collections; next->name and (not signal.is_shutdown()); next++)
{
test_return_t collection_rc= TEST_SUCCESS;
bool failed= false;
case TEST_FAILURE:
Out << next->name << " [ failed ]";
failed= true;
- set_shutdown(SHUTDOWN_GRACEFUL);
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
goto cleanup;
case TEST_SKIPPED:
else if (return_code == TEST_FAILURE)
{
Error << " item.flush(failure)";
- set_shutdown(SHUTDOWN_GRACEFUL);
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
}
}
else if (return_code == TEST_SKIPPED)
else if (return_code == TEST_FAILURE)
{
Error << " item.startup(failure)";
- set_shutdown(SHUTDOWN_GRACEFUL);
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
}
stats.total++;
if (test_failed(world->on_error(return_code, creators_ptr)))
{
Error << "Failed while running on_error()";
- set_shutdown(SHUTDOWN_GRACEFUL);
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
break;
}
}
Outn();
}
- if (not is_shutdown())
+ if (not signal.is_shutdown())
{
- set_shutdown(SHUTDOWN_GRACEFUL);
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
}
int exit_code= EXIT_SUCCESS;
- shutdown_t status= get_shutdown();
+ shutdown_t status= signal.get_shutdown();
if (status == SHUTDOWN_FORCED)
{
Out << "Tests were aborted.";
rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
- test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+ test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_strerror(NULL, rc));
memcached_quit(memc);
rc= memcached_add(memc, key, strlen(key),
value, strlen(value),
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
if (setting_value)
{
- test_true(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_STORED);
+ test_true(rc == MEMCACHED_NOTSTORED or rc == MEMCACHED_STORED);
}
else
{
- test_true(rc == MEMCACHED_NOTSTORED);
+ test_compare_got(MEMCACHED_NOTSTORED, rc, memcached_strerror(NULL, rc));
}
return TEST_SUCCESS;
return TEST_SUCCESS;
}
-static test_return_t digest_test(void *obj)
+static test_return_t digest_test(void *)
{
Hashkit hashk;
- uint32_t value;
- (void)obj;
-
- value= hashk.digest("Foo", sizeof("Foo"));
+ test_true(hashk.digest("Foo", sizeof("Foo")));
return TEST_SUCCESS;
}
static test_return_t hashkit_digest_test(hashkit_st *hashk)
{
- uint32_t value;
- value= hashkit_digest(hashk, "a", sizeof("a"));
+ test_true(hashkit_digest(hashk, "a", sizeof("a")));
return TEST_SUCCESS;
}
HASH_COMMAND= tests/testhashkit
test-mem: tests/var tests/testapp
- $(MEM_COMMAND)
+ @tests/testapp
test-udp: tests/var tests/testudp
$(UDP_COMMAND)
$(CYCLE_COMMAND)
pahole-mem: tests/testapp
- $(PAHOLE_COMMAND) $(MEM_COMMAND)
+ @$(PAHOLE_COMMAND) tests/testapp
gdb-mem: tests/testapp
- $(DEBUG_COMMAND) $(MEM_COMMAND)
+ @$(DEBUG_COMMAND) tests/testapp
gdb-atom: tests/atomsmasher
$(DEBUG_COMMAND) $(UDP_COMMAND)
$(VALGRIND_COMMAND) $(CYCLE_COMMAND)
valgrind-mem: tests/testapp
- $(VALGRIND_COMMAND) $(MEM_COMMAND)
+ @$(VALGRIND_COMMAND) tests/testapp
valgrind-atom: tests/atomsmasher
$(VALGRIND_COMMAND) $(ATOM_COMMAND)
valgrind-hashplus: tests/hashplus
$(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
-valgrind-memslap: clients/memslap
- $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
-
PHONY += valgrind
-valgrind: valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
+valgrind: valgrind-cycle valgrind-mem valgrind-atom valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
helgrind-cycle: tests/cycle
$(HELGRIND_COMMAND) $(CYCLE_COMMAND)
helgrind-mem: tests/testapp
- $(HELGRIND_COMMAND) $(MEM_COMMAND)
+ @$(HELGRIND_COMMAND) tests/testapp
helgrind-atom: tests/atomsmasher
$(HELGRIND_COMMAND) $(ATOM_COMMAND)
helgrind-hashplus: tests/hashplus
$(HELGRIND_COMMAND) $(HASHPLUS_COMMAND)
-helgrind-memslap: clients/memslap
- $(HELGRIND_COMMAND) $(MEMSLAP_COMMAND)
-
-PHONY += helgrind
-helgrind: helgrind-mem helgrind-hash helgrind-memcat helgrind-memcp helgrind-memrm helgrind-memerror helgrind-memdump helgrind-memflush helgrind-memstat
+.PHONY += helgrind
+helgrind: helgrind-cycle helgrind-mem helgrind-atom helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
PHONY += cachegrind
CLEANFILES += tests/cachegrind.out
$(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
-PHONY += helgrind
-CLEANFILES+= helgrind.out.*
-helgrind:
- rm -f helgrind.out.*
- $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
-
-PHONY += helgrind-slap
-helgrind-slap:
- $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
-
test-no-outputdiff: test
hudson-valgrind: tests/testapp
/* Do not copy the style of this code, I just access hosts to testthis function */
static test_return_t stats_servername_test(memcached_st *memc)
{
- memcached_return_t rc;
memcached_stat_st memc_stat;
memcached_server_instance_st instance=
memcached_server_instance_by_position(memc, 0);
if (memcached_get_sasl_callbacks(memc) != NULL)
return TEST_SKIPPED;
#endif
- rc= memcached_stat_servername(&memc_stat, NULL,
- memcached_server_name(instance),
- memcached_server_port(instance));
+ test_compare(MEMCACHED_SUCCESS, memcached_stat_servername(&memc_stat, NULL,
+ memcached_server_name(instance),
+ memcached_server_port(instance)));
return TEST_SUCCESS;
}
{
_error_message+= "Could not write pid to file: ";
_error_message+= _filename;
+ close(file);
return false;
}
- if (close(file < 0))
+ if (close(file) < 0)
{
_error_message+= "Could not close() file after writing pid to it: ";
_error_message+= _filename;