Tests tweaking

This commit is contained in:
Jan Kaluza 2011-06-08 13:17:09 +02:00
parent a74d8f27a7
commit a9fbe73b80
4 changed files with 19 additions and 10 deletions

View file

@ -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 <boost/bind.hpp>
#include "transport/config.h"
#include "transport/factory.h"

View file

@ -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)

View file

@ -2,6 +2,7 @@
#include <boost/bind.hpp>
#include <Swiften/Swiften.h>
#include <Swiften/Client/ClientOptions.h>
using namespace Swift;
using namespace boost;
@ -9,12 +10,12 @@ using namespace boost;
Client* client;
static void handleDisconnected(const boost::optional<ClientError> &) {
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();

View file

@ -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