summaryrefslogtreecommitdiff
path: root/test/basicserver
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-04-22 20:02:40 +0000
committerChris Wilson <chris+github@qwirx.com>2007-04-22 20:02:40 +0000
commita670b7cb878bbb12532d8be0eba2cb2386972e95 (patch)
tree00505c99d000d16e4a545f7a1f9497545d0c3cd3 /test/basicserver
parent211c489e686c8c43f00decba3f79c7054bea3caf (diff)
Use LaunchServer to remove the need for some #ifdefs.
Use directory separator constant instead of forward slash. Add some blank lines for readability. (refs #3)
Diffstat (limited to 'test/basicserver')
-rw-r--r--test/basicserver/testbasicserver.cpp55
1 files changed, 20 insertions, 35 deletions
diff --git a/test/basicserver/testbasicserver.cpp b/test/basicserver/testbasicserver.cpp
index f7ec5e0a..4b33f555 100644
--- a/test/basicserver/testbasicserver.cpp
+++ b/test/basicserver/testbasicserver.cpp
@@ -436,13 +436,8 @@ int test(int argc, const char *argv[])
// Launch a basic server
{
- #ifdef WIN32
- int pid = LaunchServer("test srv1 testfiles\\srv1.conf",
- "testfiles\\srv1.pid");
- #else
- int pid = LaunchServer("./test srv1 testfiles/srv1.conf",
- "testfiles/srv1.pid");
- #endif
+ int pid = LaunchServer("./test srv1 testfiles/srv1.conf",
+ "testfiles/srv1.pid");
TEST_THAT(pid != -1 && pid != 0);
if(pid > 0)
@@ -454,9 +449,10 @@ int test(int argc, const char *argv[])
// Move the config file over
#ifdef WIN32
- TEST_THAT(::unlink("testfiles/srv1.conf")
- != -1);
+ TEST_THAT(::unlink("testfiles"
+ DIRECTORY_SEPARATOR "srv1.conf") != -1);
#endif
+
TEST_THAT(::rename(
"testfiles" DIRECTORY_SEPARATOR "srv1b.conf",
"testfiles" DIRECTORY_SEPARATOR "srv1.conf")
@@ -474,6 +470,7 @@ int test(int argc, const char *argv[])
// Kill it off
TEST_THAT(KillServer(pid));
+
#ifndef WIN32
TestRemoteProcessMemLeaks(
"generic-daemon.memleaks");
@@ -483,15 +480,11 @@ int test(int argc, const char *argv[])
// Launch a test forking server
{
- #ifdef WIN32
- int pid = LaunchServer("test srv2 testfiles\\srv2.conf",
- "testfiles\\srv2.pid");
- #else
- int pid = LaunchServer("./test srv2 testfiles/srv2.conf",
- "testfiles/srv2.pid");
- #endif
+ int pid = LaunchServer("./test srv2 testfiles/srv2.conf",
+ "testfiles/srv2.pid");
TEST_THAT(pid != -1 && pid != 0);
+
if(pid > 0)
{
// Will it restart?
@@ -530,6 +523,7 @@ int test(int argc, const char *argv[])
conns.push_back(&conn2);
conns.push_back(&conn3);
#endif // !WIN32
+
Srv2TestConversations(conns);
// Implicit close
}
@@ -554,15 +548,11 @@ int test(int argc, const char *argv[])
// Launch a test SSL server
{
- #ifdef WIN32
- int pid = LaunchServer("test srv3 testfiles\\srv3.conf",
- "testfiles\\srv3.pid");
- #else
- int pid = LaunchServer("./test srv3 testfiles/srv3.conf",
- "testfiles/srv3.pid");
- #endif
+ int pid = LaunchServer("./test srv3 testfiles/srv3.conf",
+ "testfiles/srv3.pid");
TEST_THAT(pid != -1 && pid != 0);
+
if(pid > 0)
{
// Will it restart?
@@ -598,9 +588,9 @@ int test(int argc, const char *argv[])
#endif
// Quick check that reconnections fail
- TEST_CHECK_THROWS(conn1.Open(context,
- Socket::TypeUNIX,
- "testfiles/srv3.sock"),
+ TEST_CHECK_THROWS(conn1.Open(context,
+ Socket::TypeUNIX,
+ "testfiles/srv3.sock");,
ServerException, SocketAlreadyOpen);
// Stuff some data around
@@ -637,15 +627,11 @@ int test(int argc, const char *argv[])
//protocolserver:
// Launch a test protocol handling server
{
- #ifdef WIN32
- int pid = LaunchServer("test srv4 testfiles\\srv4.conf",
- "testfiles\\srv4.pid");
- #else
- int pid = LaunchServer("./test srv4 testfiles/srv4.conf",
- "testfiles/srv4.pid");
- #endif
+ int pid = LaunchServer("./test srv4 testfiles/srv4.conf",
+ "testfiles/srv4.pid");
TEST_THAT(pid != -1 && pid != 0);
+
if(pid > 0)
{
::sleep(1);
@@ -656,8 +642,7 @@ int test(int argc, const char *argv[])
#ifdef WIN32
conn.Open(Socket::TypeINET, "localhost", 2003);
#else
- conn.Open(Socket::TypeUNIX,
- "testfiles/srv4.sock");
+ conn.Open(Socket::TypeUNIX, "testfiles/srv4.sock");
#endif
// Create a protocol