projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
5dbc64b
)
Update for logic for server_create.
author
Brian Aker
<brian@tangent.org>
Mon, 27 Feb 2012 23:13:08 +0000
(15:13 -0800)
committer
Brian Aker
<brian@tangent.org>
Mon, 27 Feb 2012 23:13:08 +0000
(15:13 -0800)
17 files changed:
libtest/blobslap_worker.cc
patch
|
blob
|
history
libtest/gearmand.cc
patch
|
blob
|
history
libtest/memcached.cc
patch
|
blob
|
history
libtest/server.cc
patch
|
blob
|
history
libtest/server.h
patch
|
blob
|
history
libtest/unittest.cc
patch
|
blob
|
history
tests/libmemcached_world.h
patch
|
blob
|
history
tests/memcapable.cc
patch
|
blob
|
history
tests/memcat.cc
patch
|
blob
|
history
tests/memcp.cc
patch
|
blob
|
history
tests/memdump.cc
patch
|
blob
|
history
tests/memerror.cc
patch
|
blob
|
history
tests/memexist.cc
patch
|
blob
|
history
tests/memflush.cc
patch
|
blob
|
history
tests/memrm.cc
patch
|
blob
|
history
tests/memstat.cc
patch
|
blob
|
history
tests/memtouch.cc
patch
|
blob
|
history
diff --git
a/libtest/blobslap_worker.cc
b/libtest/blobslap_worker.cc
index 5bf5f535f38355ae2c43a3d469774863d03cb479..fe1cdce31baeaa6f75b72fd1b5bd1596dbf93cc0 100644
(file)
--- a/
libtest/blobslap_worker.cc
+++ b/
libtest/blobslap_worker.cc
@@
-142,17
+142,17
@@
public:
return true;
}
return true;
}
- bool build(
in
t argc, const char *argv[]);
+ bool build(
size_
t argc, const char *argv[]);
};
#include <sstream>
};
#include <sstream>
-bool BlobslapWorker::build(
in
t argc, const char *argv[])
+bool BlobslapWorker::build(
size_
t argc, const char *argv[])
{
std::stringstream arg_buffer;
{
std::stringstream arg_buffer;
- for (
int x= 1
; x < argc ; x++)
+ for (
size_t x= 0
; x < argc ; x++)
{
add_option(argv[x]);
}
{
add_option(argv[x]);
}
diff --git
a/libtest/gearmand.cc
b/libtest/gearmand.cc
index dda38fbdfab3b68ca32437fd8c20320c3fa2cf56..4a544f10b9671eeb35b5263e2ee4b069c40e440b 100644
(file)
--- a/
libtest/gearmand.cc
+++ b/
libtest/gearmand.cc
@@
-200,10
+200,10
@@
public:
return true;
}
return true;
}
- bool build(
in
t argc, const char *argv[]);
+ bool build(
size_
t argc, const char *argv[]);
};
};
-bool Gearmand::build(
in
t argc, const char *argv[])
+bool Gearmand::build(
size_
t argc, const char *argv[])
{
std::stringstream arg_buffer;
{
std::stringstream arg_buffer;
@@
-214,7
+214,7
@@
bool Gearmand::build(int argc, const char *argv[])
add_option("--listen=localhost");
add_option("--listen=localhost");
- for (
int x= 1
; x < argc ; x++)
+ for (
size_t x= 0
; x < argc ; x++)
{
add_option(argv[x]);
}
{
add_option(argv[x]);
}
diff --git
a/libtest/memcached.cc
b/libtest/memcached.cc
index 7e396c30a655b68c1f35f67a8288cf7964934b4b..271e2c3baca27864a50397b3c1b1f4a43b2cffe4 100644
(file)
--- a/
libtest/memcached.cc
+++ b/
libtest/memcached.cc
@@
-192,7
+192,7
@@
public:
bool has_socket_file_option() const
{
bool has_socket_file_option() const
{
- return
true
;
+ return
has_socket()
;
}
void socket_file_option(Application& app, const std::string& socket_arg)
}
void socket_file_option(Application& app, const std::string& socket_arg)
@@
-219,7
+219,7
@@
public:
return true;
}
return true;
}
- bool build(
in
t argc, const char *argv[]);
+ bool build(
size_
t argc, const char *argv[]);
};
class MemcachedSaSL : public Memcached
};
class MemcachedSaSL : public Memcached
@@
-312,7
+312,7
@@
public:
#include <sstream>
#include <sstream>
-bool Memcached::build(
in
t argc, const char *argv[])
+bool Memcached::build(
size_
t argc, const char *argv[])
{
std::stringstream arg_buffer;
{
std::stringstream arg_buffer;
diff --git
a/libtest/server.cc
b/libtest/server.cc
index c29d8c4338b9a4c3ed2f565526611827d9a8010e..182e6f3ec2dad99b40b9e5a2fd505ec932640a0a 100644
(file)
--- a/
libtest/server.cc
+++ b/
libtest/server.cc
@@
-70,7
+70,6
@@
std::ostream& operator<<(std::ostream& output, const Server &arg)
output << " Exec:" << arg.running();
}
output << " Exec:" << arg.running();
}
-
return output; // for multiple << operators
}
return output; // for multiple << operators
}
@@
-138,7
+137,7
@@
bool Server::start()
fatal_message("has_pid() failed, programer error");
}
fatal_message("has_pid() failed, programer error");
}
- Application app(
nam
e(), is_libtool());
+ Application app(
executabl
e(), is_libtool());
if (args(app) == false)
{
Error << "Could not build command()";
if (args(app) == false)
{
Error << "Could not build command()";
@@
-151,10
+150,11
@@
bool Server::start()
Error << "Application::run() " << ret;
return false;
}
Error << "Application::run() " << ret;
return false;
}
+ _running= app.print();
if (Application::SUCCESS != (ret= app.wait()))
{
if (Application::SUCCESS != (ret= app.wait()))
{
- Error << "Application::wait() " << ret;
+ Error << "Application::wait() " <<
app.print() << " " <<
ret;
return false;
}
return false;
}
@@
-332,9
+332,10
@@
bool Server::args(Application& app)
app.add_option(daemon_file_option());
}
app.add_option(daemon_file_option());
}
- if (
_is_socket and
has_socket_file_option())
+ if (has_socket_file_option())
{
{
- if (not set_socket_file())
+ Error << "adding socket option ";
+ if (set_socket_file() == false)
{
return false;
}
{
return false;
}
diff --git
a/libtest/server.h
b/libtest/server.h
index 9c8f048bd393049f4739c9e83093b915d95aa704..b193fb8ffd21f617d79a178a0477f4e17bb090c0 100644
(file)
--- a/
libtest/server.h
+++ b/
libtest/server.h
@@
-97,7
+97,7
@@
public:
{
if (arg.empty() == false)
{
{
if (arg.empty() == false)
{
- std::string buffer("--
socket
=");
+ std::string buffer("--
pid-file
=");
buffer+= arg;
app.add_option(buffer);
}
buffer+= arg;
app.add_option(buffer);
}
@@
-164,7
+164,7
@@
public:
virtual pid_t get_pid(bool error_is_ok= false)= 0;
virtual pid_t get_pid(bool error_is_ok= false)= 0;
- virtual bool build(
in
t argc, const char *argv[])= 0;
+ virtual bool build(
size_
t argc, const char *argv[])= 0;
void add_option(const std::string&);
void add_option(const std::string&, const std::string&);
void add_option(const std::string&);
void add_option(const std::string&, const std::string&);
diff --git
a/libtest/unittest.cc
b/libtest/unittest.cc
index 484b444393d5e0adeb254c597a26966999eed95c..53fb605fd658cca034db7b6f5f7be3563855f275 100644
(file)
--- a/
libtest/unittest.cc
+++ b/
libtest/unittest.cc
@@
-236,8
+236,7
@@
static test_return_t gearmand_cycle_test(void *object)
test_skip(true, has_gearmand_binary());
#endif
test_skip(true, has_gearmand_binary());
#endif
- const char *argv[1]= { "cycle_gearmand" };
- test_true(server_startup(*servers, "gearmand", get_free_port(), 1, argv));
+ test_true(server_startup(*servers, "gearmand", get_free_port(), 0, NULL));
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
@@
-250,8
+249,7
@@
static test_return_t memcached_cycle_test(void *object)
if (MEMCACHED_BINARY and HAVE_LIBMEMCACHED)
{
test_true(has_memcached_binary());
if (MEMCACHED_BINARY and HAVE_LIBMEMCACHED)
{
test_true(has_memcached_binary());
- const char *argv[1]= { "cycle_memcached" };
- test_true(server_startup(*servers, "memcached", get_free_port(), 1, argv));
+ test_true(server_startup(*servers, "memcached", get_free_port(), 0, NULL));
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
@@
-269,8
+267,7
@@
static test_return_t memcached_socket_cycle_test(void *object)
if (HAVE_LIBMEMCACHED)
{
test_true(has_memcached_binary());
if (HAVE_LIBMEMCACHED)
{
test_true(has_memcached_binary());
- const char *argv[1]= { "cycle_memcached" };
- test_true(servers->start_socket_server("memcached", get_free_port(), 1, argv));
+ test_true(servers->start_socket_server("memcached", get_free_port(), 0, NULL));
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
@@
-294,8
+291,7
@@
static test_return_t memcached_sasl_test(void *object)
if (HAVE_LIBMEMCACHED)
{
test_true(has_memcached_sasl_binary());
if (HAVE_LIBMEMCACHED)
{
test_true(has_memcached_sasl_binary());
- const char *argv[1]= { "cycle_memcached_sasl" };
- test_true(server_startup(*servers, "memcached-sasl", get_free_port(), 1, argv));
+ test_true(server_startup(*servers, "memcached-sasl", get_free_port(), 0, NULL));
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
diff --git
a/tests/libmemcached_world.h
b/tests/libmemcached_world.h
index 9f8b657ac844babf903fb4cbf579afe77bc92e21..181379868be7b48abe6d34b93df7499219040002 100644
(file)
--- a/
tests/libmemcached_world.h
+++ b/
tests/libmemcached_world.h
@@
-78,17
+78,16
@@
static void *world_create(libtest::server_startup_st& servers, test_return_t& er
{
in_port_t port= libtest::get_free_port();
{
in_port_t port= libtest::get_free_port();
- const char *argv[1]= { "memcached" };
if (servers.sasl())
{
if (servers.sasl())
{
- if (server_startup(servers, "memcached-sasl", port,
1, argv
) == false)
+ if (server_startup(servers, "memcached-sasl", port,
0, NULL
) == false)
{
fatal_message("Could not start memcached-sasl");
}
}
else
{
{
fatal_message("Could not start memcached-sasl");
}
}
else
{
- if (server_startup(servers, "memcached", port,
1, argv
) == false)
+ if (server_startup(servers, "memcached", port,
0, NULL
) == false)
{
fatal_message("Could not start memcached");
}
{
fatal_message("Could not start memcached");
}
diff --git
a/tests/memcapable.cc
b/tests/memcapable.cc
index 75b93995e6e99214998d9d2b73f3fb1fbe51adc3..ae50fefaf95c212d972146c06943d51f31bc6225 100644
(file)
--- a/
tests/memcapable.cc
+++ b/
tests/memcapable.cc
@@
-113,8
+113,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memcapable" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
diff --git
a/tests/memcat.cc
b/tests/memcat.cc
index 23d59325d03bb82b5f36c93be65a3504e00eb97d..e51cdce1451e235e944b626a97cc269cd9d8dc0e 100644
(file)
--- a/
tests/memcat.cc
+++ b/
tests/memcat.cc
@@
-50,16
+50,7
@@
using namespace libtest;
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
-static std::string executable;
-
-static test_return_t quiet_test(void *)
-{
- const char *args[]= { "--quiet", 0 };
-
- test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
-
- return TEST_SUCCESS;
-}
+static std::string executable("clients/memcat");
static test_return_t help_test(void *)
{
static test_return_t help_test(void *)
{
@@
-122,7
+113,6
@@
static test_return_t NOT_FOUND_test(void *)
}
test_st memcat_tests[] ={
}
test_st memcat_tests[] ={
- {"--quiet", true, quiet_test },
{"--help", true, help_test },
{"cat(FOUND)", true, cat_test },
{"cat(NOT_FOUND)", true, NOT_FOUND_test },
{"--help", true, help_test },
{"cat(FOUND)", true, cat_test },
{"cat(NOT_FOUND)", true, NOT_FOUND_test },
@@
-142,8
+132,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memcat" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (not server_startup(servers, "memcached", libtest::default_port(), 0, NULL))
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
@@
-154,7
+143,6
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
void get_world(Framework *world)
{
void get_world(Framework *world)
{
- executable= "clients/memcat";
world->collections= collection;
world->_create= world_create;
}
world->collections= collection;
world->_create= world_create;
}
diff --git
a/tests/memcp.cc
b/tests/memcp.cc
index 99f3e02df652d321f3d1164dcc8a9d14931e2537..eab8cfa58a7d946d9b0d9c229404300a89e0cbed 100644
(file)
--- a/
tests/memcp.cc
+++ b/
tests/memcp.cc
@@
-50,16
+50,7
@@
using namespace libtest;
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
-static std::string executable;
-
-static test_return_t quiet_test(void *)
-{
- const char *args[]= { "--quiet", 0 };
-
- test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
-
- return TEST_SUCCESS;
-}
+static std::string executable("./clients/memcp");
static test_return_t help_test(void *)
{
static test_return_t help_test(void *)
{
@@
-82,7
+73,6
@@
static test_return_t server_test(void *)
}
test_st memcp_tests[] ={
}
test_st memcp_tests[] ={
- {"--quiet", true, quiet_test },
{"--help", true, help_test },
{"--server_test", true, server_test },
{0, 0, 0}
{"--help", true, help_test },
{"--server_test", true, server_test },
{0, 0, 0}
@@
-101,8
+91,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memcp" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
@@
-113,7
+102,6
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
void get_world(Framework *world)
{
void get_world(Framework *world)
{
- executable= "./clients/memcp";
world->collections= collection;
world->_create= world_create;
}
world->collections= collection;
world->_create= world_create;
}
diff --git
a/tests/memdump.cc
b/tests/memdump.cc
index c1ff194000d2430c904dfe1df3d21d00a79b0204..4a30892138cbf7f3dade30185672ccedffeb7918 100644
(file)
--- a/
tests/memdump.cc
+++ b/
tests/memdump.cc
@@
-50,16
+50,7
@@
using namespace libtest;
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
-static std::string executable;
-
-static test_return_t quiet_test(void *)
-{
- const char *args[]= { "--quiet", 0 };
-
- test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
-
- return TEST_SUCCESS;
-}
+static std::string executable("./clients/memdump");
static test_return_t help_test(void *)
{
static test_return_t help_test(void *)
{
@@
-108,7
+99,6
@@
static test_return_t FOUND_test(void *)
}
test_st memdump_tests[] ={
}
test_st memdump_tests[] ={
- {"--quiet", true, quiet_test },
{"--help", true, help_test },
{"--server", true, server_test },
{"FOUND", true, FOUND_test },
{"--help", true, help_test },
{"--server", true, server_test },
{"FOUND", true, FOUND_test },
@@
-128,8
+118,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memdump" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
@@
-140,7
+129,6
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
void get_world(Framework *world)
{
void get_world(Framework *world)
{
- executable= "./clients/memdump";
world->collections= collection;
world->_create= world_create;
}
world->collections= collection;
world->_create= world_create;
}
diff --git
a/tests/memerror.cc
b/tests/memerror.cc
index 00863475838620c3d9639029062737b566ebacb0..914d2a03b4df6ced19d0196503023c68579e161f 100644
(file)
--- a/
tests/memerror.cc
+++ b/
tests/memerror.cc
@@
-50,7
+50,7
@@
using namespace libtest;
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
-static std::string executable;
+static std::string executable
("./clients/memerror")
;
static test_return_t help_TEST(void *)
{
static test_return_t help_TEST(void *)
{
@@
-119,7
+119,6
@@
static void *world_create(server_startup_st&, test_return_t&)
void get_world(Framework *world)
{
void get_world(Framework *world)
{
- executable= "./clients/memerror";
world->collections= collection;
world->_create= world_create;
}
world->collections= collection;
world->_create= world_create;
}
diff --git
a/tests/memexist.cc
b/tests/memexist.cc
index 6cc1f0514448335c287a51933dadfd36926bcd09..a0fec9e02e24647272f80bc2e2113547bf47765c 100644
(file)
--- a/
tests/memexist.cc
+++ b/
tests/memexist.cc
@@
-131,8
+131,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memexist" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
diff --git
a/tests/memflush.cc
b/tests/memflush.cc
index d1184722c64f4749e4ba0ab001f653d9f4e67247..f14b5b727d884f6171d44b89920fd8f4b0cf6abc 100644
(file)
--- a/
tests/memflush.cc
+++ b/
tests/memflush.cc
@@
-101,8
+101,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memflush" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == 0)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
diff --git
a/tests/memrm.cc
b/tests/memrm.cc
index e422a19d3df1249f62559f08236b2c17051fb1cd..8d6109c0ac679084e66662df942d57ce4bd20929 100644
(file)
--- a/
tests/memrm.cc
+++ b/
tests/memrm.cc
@@
-50,7
+50,7
@@
using namespace libtest;
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
-static std::string executable;
+static std::string executable
("./clients/memrm")
;
static test_return_t quiet_test(void *)
{
static test_return_t quiet_test(void *)
{
@@
-152,8
+152,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memrm" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
@@
-164,7
+163,6
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
void get_world(Framework *world)
{
void get_world(Framework *world)
{
- executable= "./clients/memrm";
world->collections= collection;
world->_create= world_create;
}
world->collections= collection;
world->_create= world_create;
}
diff --git
a/tests/memstat.cc
b/tests/memstat.cc
index 6bb8c053bd5f685f64446f7b99a4993c63314312..ae8679fb13d47bc30fd8f63336e9b7cdd8ede2ee 100644
(file)
--- a/
tests/memstat.cc
+++ b/
tests/memstat.cc
@@
-113,8
+113,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memstat" };
- if (server_startup(servers, "memcached", libtest::default_port(), 1, argv) == false)
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}
diff --git
a/tests/memtouch.cc
b/tests/memtouch.cc
index a09bd40a0c8a8eaf92dbcf14f45d36f24560ecb8..df597e0f51df16a2c9b3599e6bb88574c322fed5 100644
(file)
--- a/
tests/memtouch.cc
+++ b/
tests/memtouch.cc
@@
-128,8
+128,7
@@
static void *world_create(server_startup_st& servers, test_return_t& error)
return NULL;
}
return NULL;
}
- const char *argv[1]= { "memtouch" };
- if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv))
+ if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
}
{
error= TEST_FAILURE;
}