projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
tests: fix failure tests
[awesomized/libmemcached]
/
libtest
/
server.cc
diff --git
a/libtest/server.cc
b/libtest/server.cc
index 42c6b480d56b69122a7800aa43e18ad08e6bd09d..7f3a2d1eda5947444f60a7e23392e893c7642b26 100644
(file)
--- a/
libtest/server.cc
+++ b/
libtest/server.cc
@@
-98,7
+98,7
@@
class Buffer
{
public:
Buffer(char *b) : b_(b) {}
{
public:
Buffer(char *b) : b_(b) {}
- ~Buffer() { free(b_); }
+ ~Buffer() {
if (b_)
free(b_); }
char* buf() { return b_; }
private:
char *b_;
char* buf() { return b_; }
private:
char *b_;
@@
-130,8
+130,7
@@
Server::~Server()
bool Server::check()
{
_app.slurp();
bool Server::check()
{
_app.slurp();
- _app.check();
- return true;
+ return _app.check();
}
bool Server::validate()
}
bool Server::validate()
@@
-173,6
+172,22
@@
bool Server::wait_for_pidfile() const
return wait.successful();
}
return wait.successful();
}
+bool Server::init(const char *argv[])
+{
+ if (argv)
+ {
+ for (const char **ptr= argv; *ptr ; ++ptr)
+ {
+ if (ptr)
+ {
+ add_option(*ptr);
+ }
+ }
+ }
+
+ return build();
+}
+
bool Server::has_pid() const
{
return (_app.pid() > 1);
bool Server::has_pid() const
{
return (_app.pid() > 1);
@@
-181,21
+196,10
@@
bool Server::has_pid() const
bool Server::start()
{
bool Server::start()
{
- // If we find that we already have a pid then kill it.
- if (has_pid() == true)
- {
-#if 0
- fatal_message("has_pid() failed, programer error");
-#endif
- }
-
- // This needs more work.
-#if 0
- if (gdb_is_caller())
+ if (getenv("YATL_GDB_SERVER"))
{
{
- _app.use_gdb();
+ _app.use_gdb(
true
);
}
}
-#endif
if (port() == LIBTEST_FAIL_PORT)
{
if (port() == LIBTEST_FAIL_PORT)
{
@@
-205,11
+209,11
@@
bool Server::start()
if (getenv("YATL_PTRCHECK_SERVER"))
{
if (getenv("YATL_PTRCHECK_SERVER"))
{
- _app.use_ptrcheck();
+ _app.use_ptrcheck(
true
);
}
else if (getenv("YATL_VALGRIND_SERVER"))
{
}
else if (getenv("YATL_VALGRIND_SERVER"))
{
- _app.use_valgrind();
+ _app.use_valgrind(
true
);
}
out_of_ban_killed(false);
}
out_of_ban_killed(false);
@@
-275,7
+279,7
@@
bool Server::start()
uint32_t waited;
uint32_t retry;
uint32_t waited;
uint32_t retry;
- for (waited= 0, retry=
7
; ; retry++, waited+= this_wait)
+ for (waited= 0, retry=
1
; ; retry++, waited+= this_wait)
{
if (_app.check() == false)
{
{
if (_app.check() == false)
{
@@
-291,8
+295,6
@@
bool Server::start()
break;
}
break;
}
- Error << "ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error();
-
this_wait= retry * retry / 3 + 1;
libtest::dream(this_wait, 0);
}
this_wait= retry * retry / 3 + 1;
libtest::dream(this_wait, 0);
}
@@
-300,6
+302,10
@@
bool Server::start()
if (pinged == false)
{
if (pinged == false)
{
+#if 0
+ Error << "Failed to ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error();
+#endif
+
// If we happen to have a pid file, lets try to kill it
if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0))
{
// If we happen to have a pid file, lets try to kill it
if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0))
{
@@
-483,13
+489,16
@@
bool Server::args(Application& app)
for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter)
{
for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter)
{
- if ((*iter).
second
.empty() == false)
+ if ((*iter).
first
.empty() == false)
{
{
- app.add_option((*iter).first, (*iter).second);
- }
- else
- {
- app.add_option((*iter).first);
+ if ((*iter).second.empty() == false)
+ {
+ app.add_option((*iter).first, (*iter).second);
+ }
+ else
+ {
+ app.add_option((*iter).first);
+ }
}
}
}
}