From 8ef948c25f193baa9acfe363a2193d4ffa4f0a49 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Thu, 24 Dec 2015 10:08:19 +0100 Subject: [PATCH] Move libtransport form ./src to ./libtransport. Move all tests to ./tests directory and add 'make test' target. --- .travis.yml | 2 +- CMakeLists.txt | 3 +- cmake_modules/eventConfig.cmake | 2 +- {src => libtransport}/AdminInterface.cpp | 0 {src => libtransport}/Buddy.cpp | 0 {src => libtransport}/CMakeLists.txt | 11 -- {src => libtransport}/Config.cpp | 0 {src => libtransport}/Conversation.cpp | 0 {src => libtransport}/ConversationManager.cpp | 0 {src => libtransport}/FileTransferManager.cpp | 0 {src => libtransport}/HTTPRequest.cpp | 0 {src => libtransport}/HTTPRequestQueue.cpp | 0 {src => libtransport}/LocalBuddy.cpp | 0 {src => libtransport}/Logging.cpp | 0 .../MemoryReadByteStream.cpp | 0 {src => libtransport}/MemoryUsage.cpp | 0 {src => libtransport}/MySQLBackend.cpp | 0 {src => libtransport}/NetworkPluginServer.cpp | 0 {src => libtransport}/OAuth2.cpp | 0 {src => libtransport}/PQXXBackend.cpp | 0 {src => libtransport}/PresenceOracle.cpp | 0 {src => libtransport}/RosterManager.cpp | 0 {src => libtransport}/RosterStorage.cpp | 0 {src => libtransport}/SQLite3Backend.cpp | 0 {src => libtransport}/StorageBackend.cpp | 0 {src => libtransport}/ThreadPool.cpp | 0 {src => libtransport}/Transport.cpp | 0 {src => libtransport}/User.cpp | 0 {src => libtransport}/UserManager.cpp | 0 {src => libtransport}/UserRegistration.cpp | 0 {src => libtransport}/UserRegistry.cpp | 0 {src => libtransport}/UsersReconnecter.cpp | 0 {src => libtransport}/Util.cpp | 0 {src => libtransport}/WebSocketClient.cpp | 0 {src => libtransport}/transport.pc.in | 0 plugin/cpp/CMakeLists.txt | 8 +- spectrum_manager/src/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 4 + .../tests => tests/libcommuni}/irc_test.cfg | 2 +- .../tests => tests/libcommuni}/irc_test2.cfg | 2 +- .../libcommuni}/muc_change_topic.py | 0 .../tests => tests/libcommuni}/muc_echo.py | 0 .../libcommuni}/muc_join_leave.py | 0 .../src/tests => tests/libcommuni}/muc_pm.py | 0 .../tests => tests/libcommuni}/muc_whois.py | 0 .../tests => tests/libcommuni}/ngircd.conf | 0 .../libpurple_jabber}/jabber_test.cfg | 2 +- .../libpurple_jabber}/manager.conf | 2 +- tests/libpurple_jabber/muc_echo.py | 53 ++++++ tests/libpurple_jabber/muc_join_leave.py | 51 ++++++ tests/libpurple_jabber/muc_pm.py | 62 +++++++ .../libpurple_jabber}/prosody.cfg.lua | 0 tests/libtransport/CMakeLists.txt | 31 ++++ .../libtransport}/basictest.cpp | 0 {src/tests => tests/libtransport}/basictest.h | 0 .../libtransport}/component.cpp | 0 {src/tests => tests/libtransport}/config.cpp | 0 .../libtransport}/conversationmanager.cpp | 0 .../libtransport}/discoitemsresponder.cpp | 0 .../libtransport}/gatewayresponder.cpp | 0 .../libtransport}/localbuddy.cpp | 0 {src/tests => tests/libtransport}/main.cpp | 0 {src/tests => tests/libtransport}/main.h | 0 .../libtransport}/networkpluginserver.cpp | 0 .../libtransport}/rostermanager.cpp | 0 .../libtransport}/rosterresponder.cpp | 0 .../libtransport}/settingsadhoccommand.cpp | 0 .../libtransport}/stringtreeparser.cpp | 0 {src/tests => tests/libtransport}/user.cpp | 0 .../libtransport}/usermanager.cpp | 0 .../libtransport}/userregistration.cpp | 0 .../libtransport}/userregistry.cpp | 0 {src/tests => tests/libtransport}/util.cpp | 0 .../slack_jabber}/jabber_slack_test.cfg | 2 +- tests/slack_jabber/muc_echo.py | 53 ++++++ tests/slack_jabber/prosody.cfg.lua | 167 ++++++++++++++++++ .../tests => tests/slack_jabber}/slack.sql | Bin {spectrum/src/tests => tests}/start.py | 32 ++-- .../localhost/accounts/client.dat | 0 .../localhost/accounts/responder.dat | 0 80 files changed, 453 insertions(+), 38 deletions(-) rename {src => libtransport}/AdminInterface.cpp (100%) rename {src => libtransport}/Buddy.cpp (100%) rename {src => libtransport}/CMakeLists.txt (86%) rename {src => libtransport}/Config.cpp (100%) rename {src => libtransport}/Conversation.cpp (100%) rename {src => libtransport}/ConversationManager.cpp (100%) rename {src => libtransport}/FileTransferManager.cpp (100%) rename {src => libtransport}/HTTPRequest.cpp (100%) rename {src => libtransport}/HTTPRequestQueue.cpp (100%) rename {src => libtransport}/LocalBuddy.cpp (100%) rename {src => libtransport}/Logging.cpp (100%) rename {src => libtransport}/MemoryReadByteStream.cpp (100%) rename {src => libtransport}/MemoryUsage.cpp (100%) rename {src => libtransport}/MySQLBackend.cpp (100%) rename {src => libtransport}/NetworkPluginServer.cpp (100%) rename {src => libtransport}/OAuth2.cpp (100%) rename {src => libtransport}/PQXXBackend.cpp (100%) rename {src => libtransport}/PresenceOracle.cpp (100%) rename {src => libtransport}/RosterManager.cpp (100%) rename {src => libtransport}/RosterStorage.cpp (100%) rename {src => libtransport}/SQLite3Backend.cpp (100%) rename {src => libtransport}/StorageBackend.cpp (100%) rename {src => libtransport}/ThreadPool.cpp (100%) rename {src => libtransport}/Transport.cpp (100%) rename {src => libtransport}/User.cpp (100%) rename {src => libtransport}/UserManager.cpp (100%) rename {src => libtransport}/UserRegistration.cpp (100%) rename {src => libtransport}/UserRegistry.cpp (100%) rename {src => libtransport}/UsersReconnecter.cpp (100%) rename {src => libtransport}/Util.cpp (100%) rename {src => libtransport}/WebSocketClient.cpp (100%) rename {src => libtransport}/transport.pc.in (100%) create mode 100644 tests/CMakeLists.txt rename {spectrum/src/tests => tests/libcommuni}/irc_test.cfg (94%) rename {spectrum/src/tests => tests/libcommuni}/irc_test2.cfg (94%) rename {spectrum/src/tests => tests/libcommuni}/muc_change_topic.py (100%) rename {spectrum/src/tests => tests/libcommuni}/muc_echo.py (100%) rename {spectrum/src/tests => tests/libcommuni}/muc_join_leave.py (100%) rename {spectrum/src/tests => tests/libcommuni}/muc_pm.py (100%) rename {spectrum/src/tests => tests/libcommuni}/muc_whois.py (100%) rename {spectrum/src/tests => tests/libcommuni}/ngircd.conf (100%) rename {spectrum/src/tests => tests/libpurple_jabber}/jabber_test.cfg (95%) rename {spectrum/src/tests => tests/libpurple_jabber}/manager.conf (77%) create mode 100644 tests/libpurple_jabber/muc_echo.py create mode 100644 tests/libpurple_jabber/muc_join_leave.py create mode 100644 tests/libpurple_jabber/muc_pm.py rename {spectrum/src/tests => tests/libpurple_jabber}/prosody.cfg.lua (100%) create mode 100644 tests/libtransport/CMakeLists.txt rename {src/tests => tests/libtransport}/basictest.cpp (100%) rename {src/tests => tests/libtransport}/basictest.h (100%) rename {src/tests => tests/libtransport}/component.cpp (100%) rename {src/tests => tests/libtransport}/config.cpp (100%) rename {src/tests => tests/libtransport}/conversationmanager.cpp (100%) rename {src/tests => tests/libtransport}/discoitemsresponder.cpp (100%) rename {src/tests => tests/libtransport}/gatewayresponder.cpp (100%) rename {src/tests => tests/libtransport}/localbuddy.cpp (100%) rename {src/tests => tests/libtransport}/main.cpp (100%) rename {src/tests => tests/libtransport}/main.h (100%) rename {src/tests => tests/libtransport}/networkpluginserver.cpp (100%) rename {src/tests => tests/libtransport}/rostermanager.cpp (100%) rename {src/tests => tests/libtransport}/rosterresponder.cpp (100%) rename {src/tests => tests/libtransport}/settingsadhoccommand.cpp (100%) rename {src/tests => tests/libtransport}/stringtreeparser.cpp (100%) rename {src/tests => tests/libtransport}/user.cpp (100%) rename {src/tests => tests/libtransport}/usermanager.cpp (100%) rename {src/tests => tests/libtransport}/userregistration.cpp (100%) rename {src/tests => tests/libtransport}/userregistry.cpp (100%) rename {src/tests => tests/libtransport}/util.cpp (100%) rename {spectrum/src/tests => tests/slack_jabber}/jabber_slack_test.cfg (95%) create mode 100644 tests/slack_jabber/muc_echo.py create mode 100644 tests/slack_jabber/prosody.cfg.lua rename {spectrum/src/tests => tests/slack_jabber}/slack.sql (100%) rename {spectrum/src/tests => tests}/start.py (78%) rename {spectrum/src/tests => tests/tests_output}/localhost/accounts/client.dat (100%) rename {spectrum/src/tests => tests/tests_output}/localhost/accounts/responder.dat (100%) diff --git a/.travis.yml b/.travis.yml index a16b2fe2..7e0df67a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,6 @@ before_script: - sudo killall lua5.1 install: "pip install --user sleekxmpp" script: - - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON . && make && ./src/libtransport_test && cd ./spectrum/src/tests && python -V && python start.py + - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON . && make && make test notifications: slack: spectrum2:CIlYHtxGMAaxs3qVHfwBzCuy diff --git a/CMakeLists.txt b/CMakeLists.txt index efcb79a0..db9f3713 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -455,11 +455,12 @@ if (CMAKE_COMPILER_IS_GNUCXX) include_directories(${OPENSSL_INCLUDE_DIR}) endif() -ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(libtransport) ADD_SUBDIRECTORY(plugin) ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(spectrum) ADD_SUBDIRECTORY(backends) +ADD_SUBDIRECTORY(tests) if (NOT WIN32) ADD_SUBDIRECTORY(spectrum_manager) # ADD_SUBDIRECTORY(spectrum2_send_message) diff --git a/cmake_modules/eventConfig.cmake b/cmake_modules/eventConfig.cmake index aba77891..dcbd0a20 100644 --- a/cmake_modules/eventConfig.cmake +++ b/cmake_modules/eventConfig.cmake @@ -5,7 +5,7 @@ FIND_LIBRARY(EVENT_LIBRARIES NAMES ${EVENT_NAMES} PATH) IF(EVENT_INCLUDE_DIRS AND EVENT_LIBRARIES) SET(HAVE_EVENT TRUE) -file(APPEND src/transport_config.h "#define WITH_LIBEVENT 1\n") +file(APPEND libtransport/transport_config.h "#define WITH_LIBEVENT 1\n") ELSE(EVENT_INCLUDE_DIRS AND EVENT_LIBRARIES) SET (EVENT_INCLUDE_DIRS "") SET (EVENT_LIBRARIES "") diff --git a/src/AdminInterface.cpp b/libtransport/AdminInterface.cpp similarity index 100% rename from src/AdminInterface.cpp rename to libtransport/AdminInterface.cpp diff --git a/src/Buddy.cpp b/libtransport/Buddy.cpp similarity index 100% rename from src/Buddy.cpp rename to libtransport/Buddy.cpp diff --git a/src/CMakeLists.txt b/libtransport/CMakeLists.txt similarity index 86% rename from src/CMakeLists.txt rename to libtransport/CMakeLists.txt index 1490cbec..726a57fb 100644 --- a/src/CMakeLists.txt +++ b/libtransport/CMakeLists.txt @@ -19,17 +19,6 @@ endif() FILE(GLOB HEADERS ../include/transport/*.h) include_directories(../spectrum/src/frontends/xmpp/) -if (CPPUNIT_FOUND) - FILE(GLOB SRC_TEST tests/*.cpp) - FILE(GLOB SRC_TEST_FRONTEND ../spectrum/src/frontends/xmpp/*.cpp) - - ADD_EXECUTABLE(libtransport_test ${SRC_TEST} ${SRC_TEST_FRONTEND}) - set_target_properties(libtransport_test PROPERTIES COMPILE_DEFINITIONS LIBTRANSPORT_TEST=1) - - - target_link_libraries(libtransport_test transport ${CPPUNIT_LIBRARY} ${Boost_LIBRARIES}) -endif() - if (NOT WIN32) include_directories(${POPT_INCLUDE_DIR}) endif() diff --git a/src/Config.cpp b/libtransport/Config.cpp similarity index 100% rename from src/Config.cpp rename to libtransport/Config.cpp diff --git a/src/Conversation.cpp b/libtransport/Conversation.cpp similarity index 100% rename from src/Conversation.cpp rename to libtransport/Conversation.cpp diff --git a/src/ConversationManager.cpp b/libtransport/ConversationManager.cpp similarity index 100% rename from src/ConversationManager.cpp rename to libtransport/ConversationManager.cpp diff --git a/src/FileTransferManager.cpp b/libtransport/FileTransferManager.cpp similarity index 100% rename from src/FileTransferManager.cpp rename to libtransport/FileTransferManager.cpp diff --git a/src/HTTPRequest.cpp b/libtransport/HTTPRequest.cpp similarity index 100% rename from src/HTTPRequest.cpp rename to libtransport/HTTPRequest.cpp diff --git a/src/HTTPRequestQueue.cpp b/libtransport/HTTPRequestQueue.cpp similarity index 100% rename from src/HTTPRequestQueue.cpp rename to libtransport/HTTPRequestQueue.cpp diff --git a/src/LocalBuddy.cpp b/libtransport/LocalBuddy.cpp similarity index 100% rename from src/LocalBuddy.cpp rename to libtransport/LocalBuddy.cpp diff --git a/src/Logging.cpp b/libtransport/Logging.cpp similarity index 100% rename from src/Logging.cpp rename to libtransport/Logging.cpp diff --git a/src/MemoryReadByteStream.cpp b/libtransport/MemoryReadByteStream.cpp similarity index 100% rename from src/MemoryReadByteStream.cpp rename to libtransport/MemoryReadByteStream.cpp diff --git a/src/MemoryUsage.cpp b/libtransport/MemoryUsage.cpp similarity index 100% rename from src/MemoryUsage.cpp rename to libtransport/MemoryUsage.cpp diff --git a/src/MySQLBackend.cpp b/libtransport/MySQLBackend.cpp similarity index 100% rename from src/MySQLBackend.cpp rename to libtransport/MySQLBackend.cpp diff --git a/src/NetworkPluginServer.cpp b/libtransport/NetworkPluginServer.cpp similarity index 100% rename from src/NetworkPluginServer.cpp rename to libtransport/NetworkPluginServer.cpp diff --git a/src/OAuth2.cpp b/libtransport/OAuth2.cpp similarity index 100% rename from src/OAuth2.cpp rename to libtransport/OAuth2.cpp diff --git a/src/PQXXBackend.cpp b/libtransport/PQXXBackend.cpp similarity index 100% rename from src/PQXXBackend.cpp rename to libtransport/PQXXBackend.cpp diff --git a/src/PresenceOracle.cpp b/libtransport/PresenceOracle.cpp similarity index 100% rename from src/PresenceOracle.cpp rename to libtransport/PresenceOracle.cpp diff --git a/src/RosterManager.cpp b/libtransport/RosterManager.cpp similarity index 100% rename from src/RosterManager.cpp rename to libtransport/RosterManager.cpp diff --git a/src/RosterStorage.cpp b/libtransport/RosterStorage.cpp similarity index 100% rename from src/RosterStorage.cpp rename to libtransport/RosterStorage.cpp diff --git a/src/SQLite3Backend.cpp b/libtransport/SQLite3Backend.cpp similarity index 100% rename from src/SQLite3Backend.cpp rename to libtransport/SQLite3Backend.cpp diff --git a/src/StorageBackend.cpp b/libtransport/StorageBackend.cpp similarity index 100% rename from src/StorageBackend.cpp rename to libtransport/StorageBackend.cpp diff --git a/src/ThreadPool.cpp b/libtransport/ThreadPool.cpp similarity index 100% rename from src/ThreadPool.cpp rename to libtransport/ThreadPool.cpp diff --git a/src/Transport.cpp b/libtransport/Transport.cpp similarity index 100% rename from src/Transport.cpp rename to libtransport/Transport.cpp diff --git a/src/User.cpp b/libtransport/User.cpp similarity index 100% rename from src/User.cpp rename to libtransport/User.cpp diff --git a/src/UserManager.cpp b/libtransport/UserManager.cpp similarity index 100% rename from src/UserManager.cpp rename to libtransport/UserManager.cpp diff --git a/src/UserRegistration.cpp b/libtransport/UserRegistration.cpp similarity index 100% rename from src/UserRegistration.cpp rename to libtransport/UserRegistration.cpp diff --git a/src/UserRegistry.cpp b/libtransport/UserRegistry.cpp similarity index 100% rename from src/UserRegistry.cpp rename to libtransport/UserRegistry.cpp diff --git a/src/UsersReconnecter.cpp b/libtransport/UsersReconnecter.cpp similarity index 100% rename from src/UsersReconnecter.cpp rename to libtransport/UsersReconnecter.cpp diff --git a/src/Util.cpp b/libtransport/Util.cpp similarity index 100% rename from src/Util.cpp rename to libtransport/Util.cpp diff --git a/src/WebSocketClient.cpp b/libtransport/WebSocketClient.cpp similarity index 100% rename from src/WebSocketClient.cpp rename to libtransport/WebSocketClient.cpp diff --git a/src/transport.pc.in b/libtransport/transport.pc.in similarity index 100% rename from src/transport.pc.in rename to libtransport/transport.pc.in diff --git a/plugin/cpp/CMakeLists.txt b/plugin/cpp/CMakeLists.txt index f5cce80f..6a9d517e 100644 --- a/plugin/cpp/CMakeLists.txt +++ b/plugin/cpp/CMakeLists.txt @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.6) FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../include/transport/*.h) -set(EXTRA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../src/MemoryUsage.cpp) -set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Logging.cpp) -set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Config.cpp) -set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Util.cpp) +set(EXTRA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/MemoryUsage.cpp) +set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Logging.cpp) +set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Config.cpp) +set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Util.cpp) set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc) if (NOT WIN32) diff --git a/spectrum_manager/src/CMakeLists.txt b/spectrum_manager/src/CMakeLists.txt index d0a7bdcf..2ebdd2dd 100644 --- a/spectrum_manager/src/CMakeLists.txt +++ b/spectrum_manager/src/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) FILE(GLOB SRC *.cpp *.c) -ADD_EXECUTABLE(spectrum2_manager ${SRC} ../../src/Config.cpp ../../src/Util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc) +ADD_EXECUTABLE(spectrum2_manager ${SRC} ../../libtransport/Config.cpp ../../libtransport/Util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc) ADD_DEPENDENCIES(spectrum2_manager pb) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc PROPERTIES GENERATED 1) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..b2481cdd --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_SUBDIRECTORY(libtransport) + + +add_custom_target(test ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/start.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output) diff --git a/spectrum/src/tests/irc_test.cfg b/tests/libcommuni/irc_test.cfg similarity index 94% rename from spectrum/src/tests/irc_test.cfg rename to tests/libcommuni/irc_test.cfg index 9fa7a14b..91b57448 100644 --- a/spectrum/src/tests/irc_test.cfg +++ b/tests/libcommuni/irc_test.cfg @@ -15,7 +15,7 @@ admin_password=test users_per_backend=10 #backend=../..//backends/swiften/spectrum2_swiften_backend #backend=../../../backends/twitter/spectrum2_twitter_backend -backend=../../../backends/libcommuni/spectrum2_libcommuni_backend +backend=../../backends/libcommuni/spectrum2_libcommuni_backend protocol=prpl-jabber #protocol=prpl-msn #protocol=any diff --git a/spectrum/src/tests/irc_test2.cfg b/tests/libcommuni/irc_test2.cfg similarity index 94% rename from spectrum/src/tests/irc_test2.cfg rename to tests/libcommuni/irc_test2.cfg index 2bb4e3f9..cecf18b8 100644 --- a/spectrum/src/tests/irc_test2.cfg +++ b/tests/libcommuni/irc_test2.cfg @@ -15,7 +15,7 @@ admin_password=test users_per_backend=10 #backend=../..//backends/swiften/spectrum2_swiften_backend #backend=../../../backends/twitter/spectrum2_twitter_backend -backend=../../../backends/libcommuni/spectrum2_libcommuni_backend +backend=../../backends/libcommuni/spectrum2_libcommuni_backend protocol=prpl-jabber #protocol=prpl-msn #protocol=any diff --git a/spectrum/src/tests/muc_change_topic.py b/tests/libcommuni/muc_change_topic.py similarity index 100% rename from spectrum/src/tests/muc_change_topic.py rename to tests/libcommuni/muc_change_topic.py diff --git a/spectrum/src/tests/muc_echo.py b/tests/libcommuni/muc_echo.py similarity index 100% rename from spectrum/src/tests/muc_echo.py rename to tests/libcommuni/muc_echo.py diff --git a/spectrum/src/tests/muc_join_leave.py b/tests/libcommuni/muc_join_leave.py similarity index 100% rename from spectrum/src/tests/muc_join_leave.py rename to tests/libcommuni/muc_join_leave.py diff --git a/spectrum/src/tests/muc_pm.py b/tests/libcommuni/muc_pm.py similarity index 100% rename from spectrum/src/tests/muc_pm.py rename to tests/libcommuni/muc_pm.py diff --git a/spectrum/src/tests/muc_whois.py b/tests/libcommuni/muc_whois.py similarity index 100% rename from spectrum/src/tests/muc_whois.py rename to tests/libcommuni/muc_whois.py diff --git a/spectrum/src/tests/ngircd.conf b/tests/libcommuni/ngircd.conf similarity index 100% rename from spectrum/src/tests/ngircd.conf rename to tests/libcommuni/ngircd.conf diff --git a/spectrum/src/tests/jabber_test.cfg b/tests/libpurple_jabber/jabber_test.cfg similarity index 95% rename from spectrum/src/tests/jabber_test.cfg rename to tests/libpurple_jabber/jabber_test.cfg index 08f4ac38..21cece53 100644 --- a/spectrum/src/tests/jabber_test.cfg +++ b/tests/libpurple_jabber/jabber_test.cfg @@ -15,7 +15,7 @@ admin_password=test users_per_backend=10 #backend=../..//backends/swiften/spectrum2_swiften_backend #backend=../../../backends/twitter/spectrum2_twitter_backend -backend=../../../backends/libpurple/spectrum2_libpurple_backend +backend=../../backends/libpurple/spectrum2_libpurple_backend protocol=prpl-jabber #protocol=prpl-msn #protocol=any diff --git a/spectrum/src/tests/manager.conf b/tests/libpurple_jabber/manager.conf similarity index 77% rename from spectrum/src/tests/manager.conf rename to tests/libpurple_jabber/manager.conf index 122b74b1..73e2a6c0 100644 --- a/spectrum/src/tests/manager.conf +++ b/tests/libpurple_jabber/manager.conf @@ -1,7 +1,7 @@ [service] admin_username=admin admin_password=test -config_directory=./ +config_directory=../libpurple_jabber/ [servers] server=localhostxmpp diff --git a/tests/libpurple_jabber/muc_echo.py b/tests/libpurple_jabber/muc_echo.py new file mode 100644 index 00000000..80516d25 --- /dev/null +++ b/tests/libpurple_jabber/muc_echo.py @@ -0,0 +1,53 @@ +import optparse +import sys +import time +import subprocess +import os + +import sleekxmpp + + +class Responder(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, room_password, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.room_password = room_password + self.finished = False + self.add_event_handler("session_start", self.start) + self.add_event_handler("groupchat_message", self.muc_message) + + self.tests = {} + + def muc_message(self, msg): + if msg['mucnick'] != self.nick: + self.send_message(mto=msg['from'].bare, + mbody="echo %s" % msg['body'], + mtype='groupchat') + + def start(self, event): + self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True) + +class Client(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.add_event_handler("session_start", self.start) + self.add_event_handler("groupchat_message", self.muc_message) + self.finished = False + + self.tests = {} + self.tests["echo_received"] = ["libcommuni: Send and receive messages", False] + + def muc_message(self, msg): + if msg['mucnick'] != self.nick: + if msg['body'] == "echo abc" or msg['body'] == " echo abc": + self.tests["echo_received"][1] = True + self.finished = True + + def start(self, event): + self.getRoster() + self.sendPresence() + self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True) + self.send_message(mto=self.room, mbody="abc", mtype='groupchat') diff --git a/tests/libpurple_jabber/muc_join_leave.py b/tests/libpurple_jabber/muc_join_leave.py new file mode 100644 index 00000000..1b7b0f71 --- /dev/null +++ b/tests/libpurple_jabber/muc_join_leave.py @@ -0,0 +1,51 @@ +import optparse +import sys +import time +import subprocess +import os + +import sleekxmpp + + +class Responder(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, room_password, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.room_password = room_password + self.nick = nick + self.finished = False + self.add_event_handler("session_start", self.start) + self.add_event_handler("muc::" + room + "::got_online", self.muc_got_online) + self.add_event_handler("muc::" + room + "::got_offline", self.muc_got_offline) + + self.tests = {} + self.tests["online_received"] = ["libcommuni: Received available presence", False] + self.tests["offline_received"] = ["libcommuni: Received unavailable presence", False] + + def muc_got_online(self, presence): + if presence['muc']['nick'] == "client": + self.tests["online_received"][1] = True + + def muc_got_offline(self, presence): + if presence['muc']['nick'] == "client": + self.tests["offline_received"][1] = True + self.finished = True + + def start(self, event): + self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True) + +class Client(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.add_event_handler("session_start", self.start) + self.finished = False + + self.tests = {} + + def start(self, event): + self.getRoster() + self.sendPresence() + self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True) + self.plugin['xep_0045'].leaveMUC(self.room, self.nick) diff --git a/tests/libpurple_jabber/muc_pm.py b/tests/libpurple_jabber/muc_pm.py new file mode 100644 index 00000000..8874e91a --- /dev/null +++ b/tests/libpurple_jabber/muc_pm.py @@ -0,0 +1,62 @@ +import optparse +import sys +import time +import subprocess +import os + +import sleekxmpp + + +class Responder(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, room_password, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.room_password = room_password + self.nick = nick + self.finished = False + self.add_event_handler("session_start", self.start) + self.add_event_handler("message", self.message) + + self.tests = {} + + def message(self, msg): + if msg['body'] == "abc" and msg['from'] == self.room + "/client": + self.send_message(mto=self.room + "/client", + mbody="echo %s" % msg['body'], + mtype='chat') + elif msg['body'] == "def" and msg['from'] == self.room + "/client": + self.send_message(mto=self.room + "/client", + mbody="echo %s" % msg['body'], + mtype='chat') + else: + self.finished = True + + def start(self, event): + self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True) + +class Client(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.add_event_handler("session_start", self.start) + self.add_event_handler("message", self.message) + self.finished = False + + self.tests = {} + self.tests["echo1_received"] = ["libcommuni: Send and receive private messages - 1st msg", False] + self.tests["echo2_received"] = ["libcommuni: Send and receive private messages - 2nd msg", False] + + def message(self, msg): + if msg['body'] == "echo abc" and msg['from'] == self.room + "/responder": + self.tests["echo1_received"][1] = True + self.send_message(mto=self.room + "/responder", mbody="def", mtype='chat') + elif msg['body'] == "echo def" and msg['from'] == self.room + "/responder": + self.tests["echo2_received"][1] = True + self.finished = True + + def start(self, event): + self.getRoster() + self.sendPresence() + self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True) + self.send_message(mto=self.room + "/responder", mbody="abc", mtype='chat') diff --git a/spectrum/src/tests/prosody.cfg.lua b/tests/libpurple_jabber/prosody.cfg.lua similarity index 100% rename from spectrum/src/tests/prosody.cfg.lua rename to tests/libpurple_jabber/prosody.cfg.lua diff --git a/tests/libtransport/CMakeLists.txt b/tests/libtransport/CMakeLists.txt new file mode 100644 index 00000000..a41507c9 --- /dev/null +++ b/tests/libtransport/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 2.6) +FILE(GLOB SRC *.cpp *.h) +FILE(GLOB_RECURSE SWIFTEN_SRC ../include/Swiften/*.cpp) + +# Build without openssl on msvc +if (NOT MSVC) +if (APPLE) + string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") + string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") +else() + string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") + string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") +endif() +else() + string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") + string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") +endif() + +FILE(GLOB HEADERS ../../include/transport/*.h) +include_directories(../../spectrum/src/frontends/xmpp/) + +if (CPPUNIT_FOUND) + FILE(GLOB SRC_TEST *.cpp) + FILE(GLOB SRC_TEST_FRONTEND ../../spectrum/src/frontends/xmpp/*.cpp) + + ADD_EXECUTABLE(libtransport_test ${SRC_TEST} ${SRC_TEST_FRONTEND}) + set_target_properties(libtransport_test PROPERTIES COMPILE_DEFINITIONS LIBTRANSPORT_TEST=1) + + + target_link_libraries(libtransport_test transport ${CPPUNIT_LIBRARY} ${Boost_LIBRARIES}) +endif() diff --git a/src/tests/basictest.cpp b/tests/libtransport/basictest.cpp similarity index 100% rename from src/tests/basictest.cpp rename to tests/libtransport/basictest.cpp diff --git a/src/tests/basictest.h b/tests/libtransport/basictest.h similarity index 100% rename from src/tests/basictest.h rename to tests/libtransport/basictest.h diff --git a/src/tests/component.cpp b/tests/libtransport/component.cpp similarity index 100% rename from src/tests/component.cpp rename to tests/libtransport/component.cpp diff --git a/src/tests/config.cpp b/tests/libtransport/config.cpp similarity index 100% rename from src/tests/config.cpp rename to tests/libtransport/config.cpp diff --git a/src/tests/conversationmanager.cpp b/tests/libtransport/conversationmanager.cpp similarity index 100% rename from src/tests/conversationmanager.cpp rename to tests/libtransport/conversationmanager.cpp diff --git a/src/tests/discoitemsresponder.cpp b/tests/libtransport/discoitemsresponder.cpp similarity index 100% rename from src/tests/discoitemsresponder.cpp rename to tests/libtransport/discoitemsresponder.cpp diff --git a/src/tests/gatewayresponder.cpp b/tests/libtransport/gatewayresponder.cpp similarity index 100% rename from src/tests/gatewayresponder.cpp rename to tests/libtransport/gatewayresponder.cpp diff --git a/src/tests/localbuddy.cpp b/tests/libtransport/localbuddy.cpp similarity index 100% rename from src/tests/localbuddy.cpp rename to tests/libtransport/localbuddy.cpp diff --git a/src/tests/main.cpp b/tests/libtransport/main.cpp similarity index 100% rename from src/tests/main.cpp rename to tests/libtransport/main.cpp diff --git a/src/tests/main.h b/tests/libtransport/main.h similarity index 100% rename from src/tests/main.h rename to tests/libtransport/main.h diff --git a/src/tests/networkpluginserver.cpp b/tests/libtransport/networkpluginserver.cpp similarity index 100% rename from src/tests/networkpluginserver.cpp rename to tests/libtransport/networkpluginserver.cpp diff --git a/src/tests/rostermanager.cpp b/tests/libtransport/rostermanager.cpp similarity index 100% rename from src/tests/rostermanager.cpp rename to tests/libtransport/rostermanager.cpp diff --git a/src/tests/rosterresponder.cpp b/tests/libtransport/rosterresponder.cpp similarity index 100% rename from src/tests/rosterresponder.cpp rename to tests/libtransport/rosterresponder.cpp diff --git a/src/tests/settingsadhoccommand.cpp b/tests/libtransport/settingsadhoccommand.cpp similarity index 100% rename from src/tests/settingsadhoccommand.cpp rename to tests/libtransport/settingsadhoccommand.cpp diff --git a/src/tests/stringtreeparser.cpp b/tests/libtransport/stringtreeparser.cpp similarity index 100% rename from src/tests/stringtreeparser.cpp rename to tests/libtransport/stringtreeparser.cpp diff --git a/src/tests/user.cpp b/tests/libtransport/user.cpp similarity index 100% rename from src/tests/user.cpp rename to tests/libtransport/user.cpp diff --git a/src/tests/usermanager.cpp b/tests/libtransport/usermanager.cpp similarity index 100% rename from src/tests/usermanager.cpp rename to tests/libtransport/usermanager.cpp diff --git a/src/tests/userregistration.cpp b/tests/libtransport/userregistration.cpp similarity index 100% rename from src/tests/userregistration.cpp rename to tests/libtransport/userregistration.cpp diff --git a/src/tests/userregistry.cpp b/tests/libtransport/userregistry.cpp similarity index 100% rename from src/tests/userregistry.cpp rename to tests/libtransport/userregistry.cpp diff --git a/src/tests/util.cpp b/tests/libtransport/util.cpp similarity index 100% rename from src/tests/util.cpp rename to tests/libtransport/util.cpp diff --git a/spectrum/src/tests/jabber_slack_test.cfg b/tests/slack_jabber/jabber_slack_test.cfg similarity index 95% rename from spectrum/src/tests/jabber_slack_test.cfg rename to tests/slack_jabber/jabber_slack_test.cfg index 0e61ee8a..9f4151cf 100644 --- a/spectrum/src/tests/jabber_slack_test.cfg +++ b/tests/slack_jabber/jabber_slack_test.cfg @@ -16,7 +16,7 @@ admin_password=test users_per_backend=10 #backend=../..//backends/swiften/spectrum2_swiften_backend #backend=../../../backends/twitter/spectrum2_twitter_backend -backend=../../../backends/libpurple/spectrum2_libpurple_backend +backend=../../backends/libpurple/spectrum2_libpurple_backend protocol=prpl-jabber #protocol=prpl-msn #protocol=any diff --git a/tests/slack_jabber/muc_echo.py b/tests/slack_jabber/muc_echo.py new file mode 100644 index 00000000..80516d25 --- /dev/null +++ b/tests/slack_jabber/muc_echo.py @@ -0,0 +1,53 @@ +import optparse +import sys +import time +import subprocess +import os + +import sleekxmpp + + +class Responder(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, room_password, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.room_password = room_password + self.finished = False + self.add_event_handler("session_start", self.start) + self.add_event_handler("groupchat_message", self.muc_message) + + self.tests = {} + + def muc_message(self, msg): + if msg['mucnick'] != self.nick: + self.send_message(mto=msg['from'].bare, + mbody="echo %s" % msg['body'], + mtype='groupchat') + + def start(self, event): + self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True) + +class Client(sleekxmpp.ClientXMPP): + def __init__(self, jid, password, room, nick): + sleekxmpp.ClientXMPP.__init__(self, jid, password) + self.room = room + self.nick = nick + self.add_event_handler("session_start", self.start) + self.add_event_handler("groupchat_message", self.muc_message) + self.finished = False + + self.tests = {} + self.tests["echo_received"] = ["libcommuni: Send and receive messages", False] + + def muc_message(self, msg): + if msg['mucnick'] != self.nick: + if msg['body'] == "echo abc" or msg['body'] == " echo abc": + self.tests["echo_received"][1] = True + self.finished = True + + def start(self, event): + self.getRoster() + self.sendPresence() + self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True) + self.send_message(mto=self.room, mbody="abc", mtype='groupchat') diff --git a/tests/slack_jabber/prosody.cfg.lua b/tests/slack_jabber/prosody.cfg.lua new file mode 100644 index 00000000..aeccf107 --- /dev/null +++ b/tests/slack_jabber/prosody.cfg.lua @@ -0,0 +1,167 @@ +-- Prosody Example Configuration File +-- +-- Information on configuring Prosody can be found on our +-- website at http://prosody.im/doc/configure +-- +-- Tip: You can check that the syntax of this file is correct +-- when you have finished by running: luac -p prosody.cfg.lua +-- If there are any errors, it will let you know what and where +-- they are, otherwise it will keep quiet. +-- +-- The only thing left to do is rename this file to remove the .dist ending, and fill in the +-- blanks. Good luck, and happy Jabbering! + + +---------- Server-wide settings ---------- +-- Settings in this section apply to the whole server and are the default settings +-- for any virtual hosts + +-- This is a (by default, empty) list of accounts that are admins +-- for the server. Note that you must create the accounts separately +-- (see http://prosody.im/doc/creating_accounts for info) +-- Example: admins = { "user1@example.com", "user2@example.net" } +admins = { } + +data_path="." + +-- Enable use of libevent for better performance under high load +-- For more information see: http://prosody.im/doc/libevent +--use_libevent = true; + +-- This is the list of modules Prosody will load on startup. +-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too. +-- Documentation on modules can be found at: http://prosody.im/doc/modules +modules_enabled = { + + -- Generally required + "roster"; -- Allow users to have a roster. Recommended ;) + "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in. +-- "tls"; -- Add support for secure TLS on c2s/s2s connections + "dialback"; -- s2s dialback support + "disco"; -- Service discovery + "muc"; + + -- Not essential, but recommended + "private"; -- Private XML storage (for room bookmarks, etc.) + "vcard"; -- Allow users to set vCards + + -- These are commented by default as they have a performance impact + --"privacy"; -- Support privacy lists + --"compression"; -- Stream compression (Note: Requires installed lua-zlib RPM package) + + -- Nice to have + "version"; -- Replies to server version requests + "uptime"; -- Report how long server has been running + "time"; -- Let others know the time here on this server + "ping"; -- Replies to XMPP pings with pongs + "pep"; -- Enables users to publish their mood, activity, playing music and more + "register"; -- Allow users to register on this server using a client and change passwords + + -- Admin interfaces + "admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands + --"admin_telnet"; -- Opens telnet console interface on localhost port 5582 + + -- HTTP modules + --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP" + --"http_files"; -- Serve static files from a directory over HTTP + + -- Other specific functionality +-- "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. + --"groups"; -- Shared roster support + --"announce"; -- Send announcement to all online users + --"welcome"; -- Welcome users who register accounts + --"watchregistrations"; -- Alert admins of registrations + --"motd"; -- Send a message to users when they log in + --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots. +}; + +-- These modules are auto-loaded, but should you want +-- to disable them then uncomment them here: +modules_disabled = { + -- "offline"; -- Store offline messages + -- "c2s"; -- Handle client connections + -- "s2s"; -- Handle server-to-server connections +}; + +-- Disable account creation by default, for security +-- For more information see http://prosody.im/doc/creating_accounts +allow_registration = true + +-- These are the SSL/TLS-related settings. If you don't want +-- to use SSL/TLS, you may comment or remove this +-- ssl = { +-- key = "/etc/pki/prosody/localhost.key"; +-- certificate = "/etc/pki/prosody/localhost.crt"; +-- } + +-- Force clients to use encrypted connections? This option will +-- prevent clients from authenticating unless they are using encryption. + +c2s_require_encryption = false + +-- Force certificate authentication for server-to-server connections? +-- This provides ideal security, but requires servers you communicate +-- with to support encryption AND present valid, trusted certificates. +-- NOTE: Your version of LuaSec must support certificate verification! +-- For more information see http://prosody.im/doc/s2s#security + +s2s_secure_auth = false + +-- Many servers don't support encryption or have invalid or self-signed +-- certificates. You can list domains here that will not be required to +-- authenticate using certificates. They will be authenticated using DNS. + +--s2s_insecure_domains = { "gmail.com" } + +-- Even if you leave s2s_secure_auth disabled, you can still require valid +-- certificates for some domains by specifying a list here. + +--s2s_secure_domains = { "jabber.org" } + +-- Select the authentication backend to use. The 'internal' providers +-- use Prosody's configured data storage to store the authentication data. +-- To allow Prosody to offer secure authentication mechanisms to clients, the +-- default provider stores passwords in plaintext. If you do not trust your +-- server please see http://prosody.im/doc/modules/mod_auth_internal_hashed +-- for information about using the hashed backend. + +authentication = "internal_plain" + +-- Select the storage backend to use. By default Prosody uses flat files +-- in its configured data directory, but it also supports more backends +-- through modules. An "sql" backend is included by default, but requires +-- additional dependencies. See http://prosody.im/doc/storage for more info. + +--storage = "sql" -- Default is "internal" (Note: "sql" requires installed +-- lua-dbi RPM package) + +-- For the "sql" backend, you can uncomment *one* of the below to configure: +-- sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename. +--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" } +--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" } + +-- Logging configuration +-- For advanced logging see http://prosody.im/doc/logging +-- log = { + -- Log everything of level "info" and higher (that is, all except "debug" messages) + -- to /var/log/prosody/prosody.log and errors also to /var/log/prosody/prosody.err +-- info = "/var/log/prosody/prosody.log"; -- Change 'info' to 'debug' for verbose logging +-- error = "/var/log/prosody/prosody.err"; -- Log errors also to file + -- error = "*syslog"; -- Log errors also to syslog + -- log = "*console"; -- Log to the console, useful for debugging with daemonize=false +-- } +log = "*console" + +-- POSIX configuration, see also http://prosody.im/doc/modules/mod_posix +-- pidfile = "/run/prosody/prosody.pid"; +daemonize = false -- Default is "true" + +------ Additional config files ------ +-- For organizational purposes you may prefer to add VirtualHost and +-- Component definitions in their own config files. This line includes +-- all config files in /etc/prosody/conf.d/ + +VirtualHost "localhost" +--Component "gateway.localhost" +-- component_secret = "secret" +Component "conference.localhost" "muc" diff --git a/spectrum/src/tests/slack.sql b/tests/slack_jabber/slack.sql similarity index 100% rename from spectrum/src/tests/slack.sql rename to tests/slack_jabber/slack.sql diff --git a/spectrum/src/tests/start.py b/tests/start.py similarity index 78% rename from spectrum/src/tests/start.py rename to tests/start.py index e1130d24..a53c73ce 100644 --- a/spectrum/src/tests/start.py +++ b/tests/start.py @@ -38,7 +38,7 @@ class BaseTest: return False def start(self, Client, Responder): - os.system("../spectrum2 -n ./" + self.config + " > spectrum2.log &") + os.system("../../spectrum/src/spectrum2 -n ./" + self.config + " > spectrum2.log &") self.pre_test() time.sleep(1) @@ -106,10 +106,11 @@ class BaseTest: class LibcommuniServerModeSingleServerConf(BaseTest): def __init__(self): - BaseTest.__init__(self, "irc_test.cfg", True, "#channel@localhost") + BaseTest.__init__(self, "../libcommuni/irc_test.cfg", True, "#channel@localhost") + self.directory = "../libcommuni/" def pre_test(self): - os.system("ngircd -f ngircd.conf &") + os.system("ngircd -f ../libcommuni/ngircd.conf &") def post_test(self): os.system("killall ngircd 2>/dev/null") @@ -117,10 +118,11 @@ class LibcommuniServerModeSingleServerConf(BaseTest): class LibcommuniServerModeConf(BaseTest): def __init__(self): - BaseTest.__init__(self, "irc_test2.cfg", True, "#channel%localhost@localhost") + BaseTest.__init__(self, "../libcommuni/irc_test2.cfg", True, "#channel%localhost@localhost") + self.directory = "../libcommuni/" def pre_test(self): - os.system("ngircd -f ngircd.conf &") + os.system("ngircd -f ../libcommuni/ngircd.conf &") def post_test(self): os.system("killall ngircd 2>/dev/null") @@ -128,7 +130,8 @@ class LibcommuniServerModeConf(BaseTest): class JabberServerModeConf(BaseTest): def __init__(self): - BaseTest.__init__(self, "jabber_test.cfg", True, "room%conference.localhost@localhostxmpp") + BaseTest.__init__(self, "../libpurple_jabber/jabber_test.cfg", True, "room%conference.localhost@localhostxmpp") + self.directory = "../libpurple_jabber/" self.client_jid = "client%localhost@localhostxmpp" self.responder_jid = "responder%localhost@localhostxmpp" @@ -138,10 +141,10 @@ class JabberServerModeConf(BaseTest): return False def pre_test(self): - os.system("prosody --config prosody.cfg.lua >prosody.log &") + os.system("prosody --config ../libpurple_jabber/prosody.cfg.lua >prosody.log &") time.sleep(3) - os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null") - os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null") + os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null") + os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null") def post_test(self): os.system("killall lua-5.1 2>/dev/null") @@ -149,7 +152,8 @@ class JabberServerModeConf(BaseTest): class JabberSlackServerModeConf(BaseTest): def __init__(self): - BaseTest.__init__(self, "jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp") + BaseTest.__init__(self, "../slack_jabber/jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp") + self.directory = "../slack_jabber/" self.client_jid = "client@localhost" self.client_room = "room@conference.localhost" self.responder_jid = "owner@spectrum2tests.xmpp.slack.com" @@ -159,13 +163,13 @@ class JabberSlackServerModeConf(BaseTest): self.responder_roompassword = "spectrum2tests.rkWHkOrjYucxsmBVkA9K" def skip_test(self, test): - os.system("cp slack.sql users.sqlite") + os.system("cp ../slack_jabber/slack.sql users.sqlite") if test in ["muc_whois.py", "muc_change_topic.py", "muc_join_leave.py", "muc_pm.py"]: return True return False def pre_test(self): - os.system("prosody --config prosody.cfg.lua > prosody.log &") + os.system("prosody --config ../slack_jabber/prosody.cfg.lua > prosody.log &") #time.sleep(3) #os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp set_oauth2_code xoxb-17213576196-VV2K8kEwwrJhJFfs5YWv6La6 use_bot_token 2>/dev/null >/dev/null") @@ -182,7 +186,7 @@ configurations.append(JabberSlackServerModeConf()) exitcode = 0 for conf in configurations: - for f in os.listdir("."): + for f in os.listdir(conf.directory): if not f.endswith(".py") or f == "start.py": continue @@ -190,7 +194,7 @@ for conf in configurations: continue print conf.__class__.__name__ + ": Starting " + f + " test ..." - test = imp.load_source('test', './' + f) + test = imp.load_source('test', conf.directory + f) if conf.skip_test(f): print "Skipped." continue diff --git a/spectrum/src/tests/localhost/accounts/client.dat b/tests/tests_output/localhost/accounts/client.dat similarity index 100% rename from spectrum/src/tests/localhost/accounts/client.dat rename to tests/tests_output/localhost/accounts/client.dat diff --git a/spectrum/src/tests/localhost/accounts/responder.dat b/tests/tests_output/localhost/accounts/responder.dat similarity index 100% rename from spectrum/src/tests/localhost/accounts/responder.dat rename to tests/tests_output/localhost/accounts/responder.dat