slurp();
if (waited_pid == _pid and WIFEXITED(_status) == false)
{
-
/*
What we are looking for here is how the exit status happened.
- 127 means that posix_spawn() itself had an error.
{
if (WTERMSIG(_status) != SIGTERM and WTERMSIG(_status) != SIGHUP)
{
+ slurp();
_app_exit_state= Application::INVALID_POSIX_SPAWN;
std::string error_string(print_argv(built_argv));
error_string+= " was killed by signal ";
error_string+= strsignal(WTERMSIG(_status));
+
if (stdout_result_length())
{
error_string+= " stdout: ";
error_string+= stdout_c_str();
}
+
if (stderr_result_length())
{
error_string+= " stderr: ";
void Application::Pipe::nonblock()
{
int flags;
+ do
{
flags= fcntl(_pipe_fd[READ], F_GETFL, 0);
} while (flags == -1 and (errno == EINTR or errno == EAGAIN));
# include <arpa/inet.h>
#endif
-#if defined(_WIN32)
+#if defined(WIN32)
# include "win32/wrappers.h"
# define get_socket_errno() WSAGetLastError()
#else
void dream(time_t tv_sec, long tv_nsec)
{
-#if defined(_WIN32)
+#if defined(WIN32)
if (tv_sec == 0 and tv_nsec)
{
tv_sec++;
#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
if (HAVE_LIBDRIZZLE)
{
- drizzle_st *drizzle= drizzle_create_tcp(getenv("MYSQL_SERVER"),
- getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
- getenv("MYSQL_USER"),
- getenv("MYSQL_PASSWORD"),
- getenv("MYSQL_SCHEMA"), drizzle_options_t());
+ drizzle_st *drizzle= drizzle_create(getenv("MYSQL_SERVER"),
+ getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
+ getenv("MYSQL_USER"),
+ getenv("MYSQL_PASSWORD"),
+ getenv("MYSQL_SCHEMA"), 0);
if (drizzle == NULL)
{
#
LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
-VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
+VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=memcheck --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
+SGCHECK_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1
VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND)
HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
-DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
+DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd --error-exitcode=1
+SGCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1
MASSIF_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=massif
GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1
export VALGRIND_COMMAND
export HELGRIND_COMMAND
export DRD_COMMAND
+export SGCHECK_COMMAND
export GDB_COMMAND
valgrind:
@echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\""
+sgcheck:
+ @echo make check TESTS_ENVIRONMENT="\"$(SGCHECK_EXEC_COMMAND)\""
+
valgrind-supressions:
@echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_SUPRESSION)\""
noinst_HEADERS+= libtest/thread.hpp
noinst_HEADERS+= libtest/tmpfile.hpp
noinst_HEADERS+= libtest/lite.h
+noinst_HEADERS+= libtest/valgrind.h
noinst_HEADERS+= libtest/vchar.hpp
noinst_HEADERS+= libtest/version.h
noinst_HEADERS+= libtest/visibility.h
drd-unittest: libtest/unittest
@$(DRD_COMMAND) libtest/unittest
+sgcheck-unittest: libtest/unittest
+ echo $(SGCHECK_COMMAND)
+ @$(SGCHECK_COMMAND) libtest/unittest
+
libtest_skiptest_LDADD= libtest/libtest.la
libtest_skiptest_SOURCES= libtest/skiptest.cc
check_PROGRAMS+= libtest/skiptest
# include <string.h>
#endif
-#if defined(_WIN32)
+#if defined(WIN32)
# include <malloc.h>
#else
# include <alloca.h>
# define SKIP(__message_format, ...)
#endif
-static inline bool valgrind_is_caller(void)
-{
- if (getenv("TESTS_ENVIRONMENT") && strstr(getenv("TESTS_ENVIRONMENT"), "valgrind"))
- {
- return true;
- }
-
- return false;
-}
+#include <libtest/valgrind.h>
static inline size_t yatl_strlen(const char *s)
{
Error << "unknown value passed to --repeat: `" << optarg << "`";
exit(EXIT_FAILURE);
}
-
break;
case OPT_LIBYATL_MATCH_COLLECTION:
std::cerr << "std::exception:" << e.what() << std::endl;
exit_code= EXIT_FAILURE;
}
- catch (char const*)
+ catch (char const* s)
{
- std::cerr << "Exception:" << std::endl;
+ std::cerr << "Exception:" << s << std::endl;
exit_code= EXIT_FAILURE;
}
catch (...)
#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
inline bool operator== (const memcached_st& memc, const memcached_return_t rc)
{
- if (memcached_last_error(&memc) == rc)
+ if (memcached_last_error(const_cast<memcached_st *>(&memc)) == rc)
{
return true;
}
}
__test_result::__test_result(const __test_result& other) :
+ std::exception(),
_line(other._line),
_file(other._file),
_func(other._func),
switch (sig)
{
case SIGALRM:
- Error << "SIGALRM";
+ case SIGVTALRM:
+ Error << strsignal(sig);
if (gdb_is_caller())
{
abort();
}
- exit(EXIT_SKIP);
-
- case SIGVTALRM:
- Error << "SIGVTALRM was called";
- context->unblock();
- raise(SIGVTALRM);
+ exit(EXIT_FAILURE);
case SIGABRT:
case SIGUSR2:
}
#pragma GCC diagnostic ignored "-Wstack-protector"
+#ifdef __clang__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-security"
+#endif
+
static test_return_t ASSERT_FALSE__TEST(void *)
{
try {
return TEST_FAILURE;
}
+#ifdef __clang__
+# pragma GCC diagnostic pop
+#endif
+
static test_return_t ASSERT_NEQ_FAIL_TEST(void *)
{
try {
namespace libtest {
+int random_alpha_num(void)
+{
+ return ALPHANUMERICS[get_alpha_num()];
+}
+
static std::string printer(const char *str, size_t length)
{
std::ostringstream buf;
namespace libtest {
+int random_alpha_num(void);
+
typedef std::vector<char*> vchar_ptr_t;
typedef std::vector<char> vchar_t;
} // namespace vchar
#define vchar_param(__arg) (&__arg[0]), (__arg.size())
+#define vchar_printf(__arg) int(__arg.size()), (&__arg[0])
std::ostream& operator<<(std::ostream& output, const libtest::vchar_t& arg);