From a9fbe73b80257c3d3814e0a118e95f6554a76312 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 8 Jun 2011 13:17:09 +0200 Subject: [PATCH] Tests tweaking --- include/transport/transport.h | 1 + tests/login/CMakeLists.txt | 2 +- tests/login/main.cpp | 10 ++++++---- tests/runtests.py | 16 +++++++++++----- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/transport/transport.h b/include/transport/transport.h index 5c91442b..62e644ac 100644 --- a/include/transport/transport.h +++ b/include/transport/transport.h @@ -31,6 +31,7 @@ #include "Swiften/Network/BoostTimerFactory.h" #include "Swiften/Network/BoostIOServiceThread.h" #include "Swiften/Server/UserRegistry.h" +#include "Swiften/Base/SafeByteArray.h" #include #include "transport/config.h" #include "transport/factory.h" diff --git a/tests/login/CMakeLists.txt b/tests/login/CMakeLists.txt index 9c129973..d0468bd6 100644 --- a/tests/login/CMakeLists.txt +++ b/tests/login/CMakeLists.txt @@ -2,5 +2,5 @@ FILE(GLOB SRC *.cpp) ADD_EXECUTABLE(login_test ${SRC}) -TARGET_LINK_LIBRARIES(login_test transport ${SWIFTEN_LIBRARIES}) +TARGET_LINK_LIBRARIES(login_test transport ${SWIFTEN_LIBRARIES} -lgconf-2 -lgobject-2.0 -lglib-2.0) diff --git a/tests/login/main.cpp b/tests/login/main.cpp index d303b6fe..77ab9a44 100644 --- a/tests/login/main.cpp +++ b/tests/login/main.cpp @@ -2,6 +2,7 @@ #include #include +#include using namespace Swift; using namespace boost; @@ -9,12 +10,12 @@ using namespace boost; Client* client; static void handleDisconnected(const boost::optional &) { - std::cout << "Disconnected..." << std::endl; +// std::cout << "Disconnected..." << std::endl; exit(1); } static void handleConnected() { - std::cout << "Connected..." << std::endl; +// std::cout << "Connected..." << std::endl; exit(0); } @@ -31,11 +32,12 @@ int main(int, char **argv) { client = new Client(argv[1], argv[2], &networkFactories); client->setAlwaysTrustCertificates(); - client->setAllowPLAINOverNonTLS(true); client->onConnected.connect(&handleConnected); client->onDisconnected.connect(bind(&handleDisconnected, _1)); client->onMessageReceived.connect(bind(&handleMessageReceived, _1)); - client->connect(); + ClientOptions opt; + opt.allowPLAINOverNonTLS = true; + client->connect(opt); eventLoop.run(); diff --git a/tests/runtests.py b/tests/runtests.py index 014a45e5..cfd08614 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -21,12 +21,13 @@ def run_spectrum(backend): " % (backend, backend) ) f.close() - p = Popen("../spectrum/src/spectrum sample.cfg > /dev/null 2> /dev/null", shell=True) - time.sleep(1) + p = Popen("../spectrum/src/spectrum sample.cfg >> test.log 2> /dev/null", shell=True) + time.sleep(2) return p os.system("killall spectrum 2> /dev/null") +os.system("rm test.log") for backend in os.listdir("../backends"): if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles": @@ -40,10 +41,15 @@ for backend in os.listdir("../backends"): p = run_spectrum(backend); if backend.find("purple") >= 0: - ret = os.system(binary + " pyjim%jabber.cz@localhost test") + p = Popen(binary + " pyjim%jabber.cz@localhost test", shell=True) + else: - ret = os.system(binary + " testnickname%irc.freenode.net@localhost test") - if ret == 0: + p = Popen(binary + " testnickname%irc.freenode.net@localhost test", shell=True) + + time.sleep(5) + + p.poll() + if p.returncode == 0: print "[ PASS ]", backend, binary else: print "[ FAIL ]", backend, binary