diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d8781c91..25b7b1af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,11 +3,25 @@ name: CI on: pull_request: push: - branches: master + branches: [master] jobs: linux-glibc: runs-on: ubuntu-latest + services: + ircd: + image: linuxserver/ngircd + ports: + - 6667:6667 + xmppd: + image: cr.spectrum.im/spectrumim/prosody:master + ports: + - 5222:5222 + - 5347:5347 + env: + LOCAL: admin + DOMAIN: localhost + PASSWORD: secret steps: - uses: actions/checkout@v2 @@ -39,7 +53,7 @@ jobs: - name: Run tests run: docker run -tt --env LANG=en_US.UTF-8 spectrum:tests-musl macos: - runs-on: macOS-12 + runs-on: macos-12 steps: - uses: actions/checkout@v2 - name: Install MacPorts diff --git a/Dockerfile b/Dockerfile index fc171ffd..3ad71e78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,11 +28,11 @@ ARG APT_LISTCHANGES_FRONTEND=none WORKDIR /spectrum2 -RUN apt-get install --no-install-recommends -y prosody ngircd python3-sleekxmpp python3-dateutil python3-dnspython libcppunit-dev purple-xmpp-carbons libglib2.0-dev psmisc +RUN apt-get install --no-install-recommends -y python3-sleekxmpp python3-dateutil python3-dnspython libcppunit-dev purple-xmpp-carbons libglib2.0-dev psmisc RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_QT4=OFF -DCMAKE_UNITY_BUILD=ON . && make -j4 -ENTRYPOINT ["make", "extended_test"] +ENTRYPOINT ["make", "test"] FROM base as test-clang diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 32ef0c2e..30f7bcef 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,12 +6,5 @@ if(ENABLE_TESTS) COMMAND ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output ) - - add_custom_target(extended_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test - COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/start.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output - ) - endif() diff --git a/tests/start.py b/tests/start.py index afbb2c44..2ded471e 100644 --- a/tests/start.py +++ b/tests/start.py @@ -176,10 +176,10 @@ def start(self, TestCaseFile): return ret def pre_test(self): - os.system("../../spectrum/src/spectrum2 -n ./" + self.config + " > spectrum2.log &") + pass def post_test(self): - os.system("killall -w spectrum2") + pass class LibcommuniServerModeSingleServerConf(BaseTest): def __init__(self): @@ -191,29 +191,11 @@ def skip_test(self, test): return True return False - def pre_test(self): - BaseTest.pre_test(self) - os.system("/usr/sbin/ngircd -f ../libcommuni/ngircd.conf &") - - def post_test(self): - os.system("killall -w ngircd 2>/dev/null") - os.system("killall -w spectrum2_libcommuni_backend 2>/dev/null") - BaseTest.post_test(self) - class LibcommuniServerModeConf(BaseTest): def __init__(self): BaseTest.__init__(self, "../libcommuni/irc_test2.cfg", True, "#channel%localhost@localhost") self.directory = "../libcommuni/" - def pre_test(self): - BaseTest.pre_test(self) - os.system("/usr/sbin/ngircd -f ../libcommuni/ngircd.conf &") - - def post_test(self): - os.system("killall -w ngircd 2>/dev/null") - os.system("killall -w spectrum2_libcommuni_backend 2>/dev/null") - BaseTest.post_test(self) - class JabberServerModeConf(BaseTest): def __init__(self): BaseTest.__init__(self, "../libpurple_jabber/jabber_test.cfg", True, "room%conference.localhost@localhostxmpp") @@ -233,68 +215,13 @@ def skip_test(self, test): def pre_test(self): os.system("cp ../libpurple_jabber/prefs.xml ./ -f >/dev/null") BaseTest.pre_test(self) - os.system("prosody --config ../libpurple_jabber/prosody.cfg.lua >prosody.log &") - time.sleep(3) - 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 -w -r lua.* 2>/dev/null") - os.system("killall -w spectrum2_libpurple_backend 2>/dev/null") - BaseTest.post_test(self) - -class JabberSlackServerModeConf(BaseTest): - def __init__(self): - 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" - # Implicitly forces responder to connect to slack.com instead of localhost - # by passing a nonstandard responder_roompassword - self.responder_jid = "owner@spectrum2tests.xmpp.slack.com" - self.responder_password = "spectrum2tests.e2zJwtKjLhLmt14VsMKq" - self.responder_room = "spectrum2_room@conference.spectrum2tests.xmpp.slack.com" - self.responder_nick = "owner" - self.responder_roompassword = "spectrum2tests.e2zJwtKjLhLmt14VsMKq" - - def skip_test(self, test): - os.system("cp ../slack_jabber/slack.sql .") - if test.find("bad_password") != -1: - print("Changing password to 'badpassword'") - os.system("sqlite3 slack.sql \"UPDATE users SET password='badpassword' WHERE id=1\"") - return False - - def pre_test(self): - BaseTest.pre_test(self) - os.system("prosody --config ../slack_jabber/prosody.cfg.lua > prosody.log &") - - def post_test(self): - os.system("killall -w -r lua.* 2>/dev/null") - os.system("killall -w spectrum2_libpurple_backend 2>/dev/null") - BaseTest.post_test(self) - -class TwitterServerModeConf(BaseTest): - def __init__(self): - BaseTest.__init__(self, "../twitter/twitter_test.cfg", True, "") - self.directory = "../twitter/" - self.client_password = "testpass123" - - def skip_test(self, test): - os.system("cp ../twitter/twitter.sql .") - - def pre_test(self): - BaseTest.pre_test(self) - - def post_test(self): - os.system("killall -w spectrum2_twitter_backend 2>/dev/null") - BaseTest.post_test(self) + os.system("spectrum2_manager localhostxmpp register client%localhost@localhostxmpp client@localhost password") + os.system("spectrum2_manager localhostxmpp register responder%localhost@localhostxmpp responder@localhost password") configurations = [] configurations.append(LibcommuniServerModeSingleServerConf()) configurations.append(LibcommuniServerModeConf()) configurations.append(JabberServerModeConf()) -#configurations.append(JabberSlackServerModeConf()) -#configurations.append(TwitterServerModeConf()) exitcode = 0