include_HEADERS =
nobase_include_HEADERS =
check_PROGRAMS =
+check_LTLIBRARIES=
EXTRA_HEADERS =
BUILT_SOURCES=
EXTRA_DIST=
if (error != 0)
{
if (error != EAI_SYSTEM)
+ {
fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(error));
+ }
else
+ {
perror("getaddrinfo()");
+ }
}
return ai;
{
if (verbose)
{
- fprintf(stderr, "\n%s:%d: %s", file, line, expression);
+ fprintf(stdout, "\n%s:%d: %s", file, line, expression);
}
if (do_core)
ssize_t nr= timeout_io_op(sock, POLLIN, ((char*) buf) + offset, len - offset);
switch (nr) {
case -1 :
- fprintf(stderr, "Errno: %d %s\n", get_socket_errno(), strerror(errno));
+ fprintf(stderr, "Errno: %d %s\n", get_socket_errno(), strerror(errno));
verify(get_socket_errno() == EINTR || get_socket_errno() == EAGAIN);
break;
reconnect= true;
++failed;
if (verbose)
+ {
fprintf(stderr, "\n");
+ }
}
else if (ret == TEST_PASS_RECONNECT)
+ {
reconnect= true;
+ }
+
+ if (ret == TEST_FAIL)
+ {
+ fprintf(stderr, "%s\n", status_msg[ret]);
+ }
+ else
+ {
+ fprintf(stdout, "%s\n", status_msg[ret]);
+ }
- fprintf(stderr, "%s\n", status_msg[ret]);
if (reconnect)
{
closesocket(sock);
try
{
_timer.reset();
+ assert(frame);
+ assert(frame->runner());
+ assert(run->test_fn);
return_code= frame->runner()->main(run->test_fn, frame->creators_ptr());
}
// Special case where check for the testing of the exception
bool lookup(const char* host)
{
bool success= false;
- if (host)
+ assert(host and host[0]);
+ if (host and host[0])
{
- assert(host);
struct addrinfo *addrinfo= NULL;
+ struct addrinfo hints;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype= SOCK_STREAM;
+ hints.ai_protocol= IPPROTO_TCP;
int limit= 5;
while (--limit and success == false)
}
int ret;
- if ((ret= getaddrinfo(host, NULL, NULL, &addrinfo)) == 0)
+ if ((ret= getaddrinfo(host, "echo", &hints, &addrinfo)) == 0)
{
success= true;
break;
bool check_dns()
{
+ if (valgrind_is_caller())
+ {
+ return false;
+ }
+
if (lookup("exist.gearman.info") == false)
{
return false;
iter != _collection.end() and (_signal.is_shutdown() == false);
++iter)
{
- if (_only_run.empty() == false and
- fnmatch(_only_run.c_str(), (*iter)->name(), 0))
+ if (*iter)
{
- continue;
- }
-
- _total++;
+ if (_only_run.empty() == false and
+ fnmatch(_only_run.c_str(), (*iter)->name(), 0))
+ {
+ continue;
+ }
- try {
- switch ((*iter)->exec())
+ _total++;
+
+ try {
+ switch ((*iter)->exec())
+ {
+ case TEST_FAILURE:
+ _failed++;
+ break;
+
+ case TEST_SKIPPED:
+ _skipped++;
+ break;
+
+ // exec() can return SUCCESS, but that doesn't mean that some tests did
+ // not fail or get skipped.
+ case TEST_SUCCESS:
+ _success++;
+ break;
+ }
+ }
+ catch (const libtest::fatal& e)
{
- case TEST_FAILURE:
_failed++;
- break;
-
- case TEST_SKIPPED:
- _skipped++;
- break;
-
- // exec() can return SUCCESS, but that doesn't mean that some tests did
- // not fail or get skipped.
- case TEST_SUCCESS:
- _success++;
- break;
+ stream::cerr(e.file(), e.line(), e.func()) << e.what();
+ }
+ catch (const libtest::disconnected& e)
+ {
+ _failed++;
+ Error << "Unhandled disconnection occurred:" << e.what();
+ throw;
+ }
+ catch (...)
+ {
+ _failed++;
+ throw;
}
- }
- catch (const libtest::fatal& e)
- {
- _failed++;
- stream::cerr(e.file(), e.line(), e.func()) << e.what();
- }
- catch (const libtest::disconnected& e)
- {
- _failed++;
- Error << "Unhandled disconnection occurred:" << e.what();
- throw;
- }
- catch (...)
- {
- _failed++;
- throw;
}
}
bool has_libmemcached_sasl(void)
{
-#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
- if (LIBMEMCACHED_WITH_SASL_SUPPORT)
- {
- return true;
- }
-#endif
-
return false;
}
{
initialize_memcached_binary();
- if (memcached_binary_path[0])
if (memcached_binary_path[0] and (strlen(memcached_binary_path) > 0))
{
return true;
return NULL;
}
-static char memcached_sasl_binary_path[FILENAME_MAX];
-
-static void initialize_has_memcached_sasl()
-{
- memcached_sasl_binary_path[0]= 0;
-
-#if defined(MEMCACHED_BINARY) && defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY
- if (HAVE_MEMCACHED_BINARY)
- {
- std::stringstream arg_buffer;
-
- char *getenv_ptr;
- if (bool((getenv_ptr= getenv("PWD"))) and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0)
- {
- arg_buffer << getenv_ptr;
- arg_buffer << "/";
- }
- arg_buffer << MEMCACHED_BINARY;
-
- if (access(arg_buffer.str().c_str(), X_OK) == 0)
- {
- strncpy(memcached_sasl_binary_path, arg_buffer.str().c_str(), FILENAME_MAX);
- }
- }
-#endif
-}
-
-bool has_memcached_sasl()
-{
- initialize_has_memcached_sasl();
-
- if (memcached_sasl_binary_path[0] and (strlen(memcached_sasl_binary_path) > 0))
- {
- return true;
- }
-
- return false;
-}
-
const char *gearmand_binary()
{
#if defined(GEARMAND_BINARY)
#if defined(HAVE_LIBCURL) && HAVE_LIBCURL
if (HAVE_LIBCURL)
{
- CURL *curl= curl_easy_init();;
+ CURL *curl= curl_easy_init();
init(curl, url());
noinst_HEADERS+= libtest/wait.h
noinst_HEADERS+= libtest/yatl.h
-noinst_LTLIBRARIES+= libtest/libtest.la
+check_LTLIBRARIES+= libtest/libtest.la
libtest_libtest_la_CXXFLAGS=
EXTRA_libtest_libtest_la_DEPENDENCIES=
libtest_libtest_la_LIBADD=
libtest_libtest_la_SOURCES=
-if BUILDING_LIBMEMCACHED
-libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
-else
-libtest_libtest_la_CXXFLAGS+= @LIBMEMCACHED_CFLAGS@
-libtest_libtest_la_LIBADD+= @LIBMEMCACHED_LIB@
-endif
libtest_libtest_la_SOURCES+= libtest/alarm.cc
libtest_libtest_la_SOURCES+= libtest/binaries.cc
set logging overwrite on
set environment LIBTEST_IN_GDB=1
#set ASAN_OPTIONS=abort_on_error=1
+handle SIGVTALRM stop
run
thread apply all bt
return TEST_SUCCESS;
}
+static test_return_t check_for_VALGRIND(void *)
+{
+ test_skip_valgrind();
+ return TEST_SUCCESS;
+}
+
static test_return_t check_for_gearman(void *)
{
test_skip(true, HAVE_LIBGEARMAN);
{"fatal", disable_fatal_exception, enable_fatal_exception, fatal_message_TESTS },
{"number_of_cpus()", 0, 0, number_of_cpus_TESTS },
{"create_tmpfile()", 0, 0, create_tmpfile_TESTS },
- {"dns", 0, 0, dns_TESTS },
+ {"dns", check_for_VALGRIND, 0, dns_TESTS },
{"libtest::Timer", 0, 0, timer_TESTS },
{0, 0, 0, 0}
};
using namespace libtest;
#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+# pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
static std::string executable;
static test_return_t quiet_test(void *)
{
- const char *args[]= { "-q", 0 };
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "%d", int(get_free_port()));
+ const char *args[]= { "-p", buffer, "-q", 0 };
test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
{0, 0, 0, 0}
};
-static void *world_create(server_startup_st& servers, test_return_t& error)
+static void *world_create(server_startup_st& servers, test_return_t&)
{
SKIP_UNLESS(libtest::has_memcached());