+public:
+ MemcachedLight(const std::string& host_arg, const in_port_t port_arg) :
+ libtest::Server(host_arg, port_arg, MEMCACHED_LIGHT_BINARY, true)
+ {
+ set_pid_file();
+ }
+
+ bool ping()
+ {
+ // Memcached is slow to start, so we need to do this
+ if (not pid_file().empty())
+ {
+ if (not wait_for_pidfile())
+ {
+ Error << "Pidfile was not found:" << pid_file();
+ return false;
+ }
+ }
+
+ std::stringstream error_message;
+ pid_t local_pid= get_pid_from_file(pid_file(), error_message);
+ if (local_pid > 0)
+ {
+ if (::kill(local_pid, 0) == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ const char *name()
+ {
+ return "memcached_light";
+ };
+
+ const char *executable()
+ {
+ return MEMCACHED_LIGHT_BINARY;
+ }
+
+ virtual void port_option(Application& app, in_port_t arg)
+ {
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "--port=%d", int(arg));
+ app.add_option(buffer);
+ }