projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
a6a4d4e
)
Additional fixes from Debian.
author
Brian Aker
<brian@tangent.org>
Sat, 20 Apr 2013 05:43:10 +0000
(22:43 -0700)
committer
Brian Aker
<brian@tangent.org>
Sat, 20 Apr 2013 05:43:10 +0000
(22:43 -0700)
libtest/cmdline.cc
patch
|
blob
|
history
libtest/cmdline.h
patch
|
blob
|
history
libtest/has.cc
patch
|
blob
|
history
libtest/has.hpp
patch
|
blob
|
history
libtest/memcached.cc
patch
|
blob
|
history
diff --git
a/libtest/cmdline.cc
b/libtest/cmdline.cc
index 0553fddebb2172f229e4d5e96fb0066d69a0688e..1423eca6ceb51f2ff47ba03234563d5db516f379 100644
(file)
--- a/
libtest/cmdline.cc
+++ b/
libtest/cmdline.cc
@@
-2,7
+2,7
@@
*
* Data Differential YATL (i.e. libtest) library
*
*
* Data Differential YATL (i.e. libtest) library
*
- * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2012
-2013
Data Differential, http://datadifferential.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@
-481,8
+481,20
@@
Application::error_t Application::join()
}
else if (waited_pid == -1)
{
}
else if (waited_pid == -1)
{
+ std::string error_string
+ if (stdout_result_length())
+ {
+ error_string+= " stdout: ";
+ error_string+= stdout_c_str();
+ }
+
+ if (stderr_result_length())
+ {
+ error_string+= " stderr: ";
+ error_string+= stderr_c_str();
+ }
+ Error << "waitpid() returned errno:" << strerror(errno) << " " << error_string;
_app_exit_state= Application::UNKNOWN;
_app_exit_state= Application::UNKNOWN;
- Error << "waitpid() returned errno:" << strerror(errno);
}
else
{
}
else
{
@@
-818,14
+830,4
@@
int exec_cmdline(const std::string& command, const char *args[], bool use_libtoo
return int(app.join());
}
return int(app.join());
}
-const char *gearmand_binary()
-{
- return GEARMAND_BINARY;
-}
-
-const char *drizzled_binary()
-{
- return DRIZZLED_BINARY;
-}
-
} // namespace exec_cmdline
} // namespace exec_cmdline
diff --git
a/libtest/cmdline.h
b/libtest/cmdline.h
index 6bf71b644c6c842215892823e0030f3903868b71..368daaecbbbf2e18ab32b4e169ed7a9d429cc20d 100644
(file)
--- a/
libtest/cmdline.h
+++ b/
libtest/cmdline.h
@@
-245,7
+245,4
@@
static inline std::ostream& operator<<(std::ostream& output, const enum Applicat
int exec_cmdline(const std::string& executable, const char *args[], bool use_libtool= false);
int exec_cmdline(const std::string& executable, const char *args[], bool use_libtool= false);
-const char *gearmand_binary();
-const char *drizzled_binary();
-
}
}
diff --git
a/libtest/has.cc
b/libtest/has.cc
index 9b26b96b675dab7d2fef408cdcf99e276553758c..a7a09cb4da909cb10e3f4eb80eb18a5ecbec4c82 100644
(file)
--- a/
libtest/has.cc
+++ b/
libtest/has.cc
@@
-2,7
+2,7
@@
*
* Data Differential YATL (i.e. libtest) library
*
*
* Data Differential YATL (i.e. libtest) library
*
- * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2012
-2013
Data Differential, http://datadifferential.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@
-37,6
+37,7
@@
#include "libtest/yatlcon.h"
#include <libtest/common.h>
#include "libtest/yatlcon.h"
#include <libtest/common.h>
+#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <cstdlib>
#include <unistd.h>
@@
-138,14
+139,17
@@
bool has_mysqld()
return false;
}
return false;
}
-bool has_memcached()
+static char memcached_binary_path[FILENAME_MAX];
+
+static void initialize_curl_startup()
{
{
+ memcached_binary_path[0]= NULL;
+
#if defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY
if (HAVE_MEMCACHED_BINARY)
{
std::stringstream arg_buffer;
#if 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)
{
char *getenv_ptr;
if (bool((getenv_ptr= getenv("PWD"))) and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0)
{
@@
-156,14
+160,46
@@
bool has_memcached()
if (access(arg_buffer.str().c_str(), X_OK) == 0)
{
if (access(arg_buffer.str().c_str(), X_OK) == 0)
{
-
return true
;
+
strncpy(memcached_binary_path, arg_buffer.str().c_str(), FILENAME_MAX)
;
}
}
#endif
}
}
#endif
+}
+
+static pthread_once_t memcached_binary_once= PTHREAD_ONCE_INIT;
+static void initialize_memcached_binary(void)
+{
+ int ret;
+ if ((ret= pthread_once(&memcached_binary_once, initialize_curl_startup)) != 0)
+ {
+ FATAL(strerror(ret));
+ }
+}
+
+bool has_memcached()
+{
+ initialize_memcached_binary();
+
+ if (memcached_binary_path[0])
+ {
+ return true;
+ }
return false;
}
return false;
}
+const char* memcached_binary()
+{
+ initialize_memcached_binary();
+
+ if (memcached_binary_path[0])
+ {
+ return memcached_binary_path;
+ }
+
+ return NULL;
+}
+
bool has_memcached_sasl()
{
#if defined(HAVE_MEMCACHED_SASL_BINARY) && HAVE_MEMCACHED_SASL_BINARY
bool has_memcached_sasl()
{
#if defined(HAVE_MEMCACHED_SASL_BINARY) && HAVE_MEMCACHED_SASL_BINARY
@@
-179,4
+215,14
@@
bool has_memcached_sasl()
return false;
}
return false;
}
+const char *gearmand_binary()
+{
+ return GEARMAND_BINARY;
+}
+
+const char *drizzled_binary()
+{
+ return DRIZZLED_BINARY;
+}
+
} // namespace libtest
} // namespace libtest
diff --git
a/libtest/has.hpp
b/libtest/has.hpp
index e6c9d4d51680cd54f6e9f05e3e3967041e677c04..f38306d5852802767046caf3c44b912016e5935a 100644
(file)
--- a/
libtest/has.hpp
+++ b/
libtest/has.hpp
@@
-2,7
+2,7
@@
*
* Data Differential YATL (i.e. libtest) library
*
*
* Data Differential YATL (i.e. libtest) library
*
- * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2012
-2013
Data Differential, http://datadifferential.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@
-62,4
+62,12
@@
bool has_drizzled();
LIBTEST_API
bool has_mysqld();
LIBTEST_API
bool has_mysqld();
+LIBTEST_API
+const char* memcached_binary();
+
+LIBTEST_API
+const char *gearmand_binary();
+
+LIBTEST_API
+const char *drizzled_binary();
} // namespace libtest
} // namespace libtest
diff --git
a/libtest/memcached.cc
b/libtest/memcached.cc
index 24bc3b8d18352da7d19656678e1cd6ef79d62a57..15fcbffa834722fd09b093b59bc3dd79092e811b 100644
(file)
--- a/
libtest/memcached.cc
+++ b/
libtest/memcached.cc
@@
-72,14
+72,14
@@
public:
const std::string& username_arg,
const std::string& password_arg) :
libtest::Server(host_arg, port_arg,
const std::string& username_arg,
const std::string& password_arg) :
libtest::Server(host_arg, port_arg,
-
MEMCACHED_BINARY
, false, is_socket_arg),
+
memcached_binary()
, false, is_socket_arg),
_username(username_arg),
_password(password_arg)
{ }
Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) :
libtest::Server(host_arg, port_arg,
_username(username_arg),
_password(password_arg)
{ }
Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) :
libtest::Server(host_arg, port_arg,
-
MEMCACHED_BINARY
, false, is_socket_arg)
+
memcached_binary()
, false, is_socket_arg)
{
set_pid_file();
}
{
set_pid_file();
}
@@
-131,7
+131,7
@@
public:
const char *executable()
{
const char *executable()
{
- return
MEMCACHED_BINARY
;
+ return
memcached_binary()
;
}
bool is_libtool()
}
bool is_libtool()
@@
-218,7
+218,7
@@
bool Memcached::build()
libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port)
{
libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port)
{
- if (
HAVE_MEMCACHED_BINARY
)
+ if (
has_memcached()
)
{
return new Memcached(hostname, try_port, false);
}
{
return new Memcached(hostname, try_port, false);
}
@@
-228,7
+228,7
@@
libtest::Server *build_memcached(const std::string& hostname, const in_port_t tr
libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port)
{
libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port)
{
- if (
HAVE_MEMCACHED_BINARY
)
+ if (
has_memcached()
)
{
return new Memcached(socket_file, try_port, true);
}
{
return new Memcached(socket_file, try_port, true);
}