From 407fe663d1dc614f50dab45e7274c018499aab28 Mon Sep 17 00:00:00 2001
From: Valentin Lorentz <progval+git@progval.net>
Date: Sat, 27 Feb 2021 14:43:52 +0100
Subject: [PATCH] Add Solanum

---
 .github/workflows/solanum.yml    | 54 ++++++++++++++++++++++++++++++++
 README.md                        | 13 ++++++++
 irctest/controllers/charybdis.py |  3 +-
 irctest/controllers/solanum.py   | 10 ++++++
 4 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 .github/workflows/solanum.yml
 create mode 100644 irctest/controllers/solanum.py

diff --git a/.github/workflows/solanum.yml b/.github/workflows/solanum.yml
new file mode 100644
index 0000000..ee08e9a
--- /dev/null
+++ b/.github/workflows/solanum.yml
@@ -0,0 +1,54 @@
+name: irctest with Solanum
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+
+    - uses: actions/checkout@v2
+
+    - name: Set up Python 3.7
+      uses: actions/setup-python@v2
+      with:
+        python-version: 3.7
+
+    - name: Cache dependencies
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.cache
+          $GITHUB_WORKSPACE/solanum
+        key: ${{ runner.os }}-solanum
+
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install pytest -r requirements.txt
+
+    - name: Checkout Solanum
+      uses: actions/checkout@v2
+      with:
+        repository: solanum-ircd/solanum
+        ref: 2e8a889fc94313acf53c430cec1bd044850769a0
+        path: solanum
+
+    - name: Build Solanum
+      run: |
+        cd $GITHUB_WORKSPACE/solanum/
+        ./autogen.sh
+        ./configure --prefix=$HOME/.local/
+        make -j 4
+        make install
+
+    - name: Test with pytest
+      run: |
+        PATH=~/.local/bin:$PATH pytest --controller=irctest.controllers.solanum -k 'not Oragono and not deprecated and not strict and not testDoubleKickMessages'
+
+
+
diff --git a/README.md b/README.md
index d2904d6..242f56b 100644
--- a/README.md
+++ b/README.md
@@ -77,6 +77,19 @@ cd ~/irctest
 pytest --controller irctest.controllers.oragono -k 'not deprecated'
 ```
 
+To run (server) tests on Solanum:
+
+```
+cd /tmp/
+git clone https://github.com/solanum-ircd/solanum.git
+cd charybdis
+./autogen.sh
+./configure --prefix=$HOME/.local/
+make -j 4
+make install
+pytest --controller irctest.controllers.solanum -k 'not Oragono and not deprecated and not strict'
+```
+
 To run (server) tests on Charybdis::
 
 ```
diff --git a/irctest/controllers/charybdis.py b/irctest/controllers/charybdis.py
index 4886abf..782ee22 100644
--- a/irctest/controllers/charybdis.py
+++ b/irctest/controllers/charybdis.py
@@ -42,6 +42,7 @@ TEMPLATE_SSL_CONFIG = """
 
 class CharybdisController(BaseServerController, DirectoryBasedController):
     software_name = "Charybdis"
+    binary_name = "charybdis"
     supported_sasl_mechanisms = set()
     supported_capabilities = set()  # Not exhaustive
 
@@ -85,7 +86,7 @@ class CharybdisController(BaseServerController, DirectoryBasedController):
             )
         self.proc = subprocess.Popen(
             [
-                "charybdis",
+                self.binary_name,
                 "-foreground",
                 "-configfile",
                 os.path.join(self.directory, "server.conf"),
diff --git a/irctest/controllers/solanum.py b/irctest/controllers/solanum.py
new file mode 100644
index 0000000..063e03e
--- /dev/null
+++ b/irctest/controllers/solanum.py
@@ -0,0 +1,10 @@
+from .charybdis import CharybdisController
+
+
+class SolanumController(CharybdisController):
+    software_name = "Solanum"
+    binary_name = "solanum"
+
+
+def get_irctest_controller_class():
+    return SolanumController