Semi-automated conformance checking for IRC implementations (RFC1459/RFC2812, the "modern spec" by ircdocs, and IRCv3)
Go to file
Val Lorentz 136a7923c0
Bump linter versions (#188)
The isort we had has some weird poetry issue, I figured I might as well
bump the other linters at the same time

```
[INFO] Installing environment for https://github.com/PyCQA/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/runner/.cache/pre-commit/repo0m3eczdf/py_env-python3.7/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing /home/runner/.cache/pre-commit/repo0m3eczdf
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
      Preparing metadata (pyproject.toml): started
      Preparing metadata (pyproject.toml): finished with status 'error'

stderr:
      error: subprocess-exited-with-error

      × Preparing metadata (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [14 lines of output]
          Traceback (most recent call last):
            File "/home/runner/.cache/pre-commit/repo0m3eczdf/py_env-python3.7/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
              main()
            File "/home/runner/.cache/pre-commit/repo0m3eczdf/py_env-python3.7/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
            File "/home/runner/.cache/pre-commit/repo0m3eczdf/py_env-python3.7/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
              return hook(metadata_directory, config_settings)
            File "/tmp/pip-build-env-beaf5dxh/overlay/lib/python3.7/site-packages/poetry/core/masonry/api.py", line 40, in prepare_metadata_for_build_wheel
              poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
            File "/tmp/pip-build-env-beaf5dxh/overlay/lib/python3.7/site-packages/poetry/core/factory.py", line 57, in create_poetry
              raise RuntimeError("The Poetry configuration is invalid:\n" + message)
          RuntimeError: The Poetry configuration is invalid:
            - [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'

          [end of output]

      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
```
2023-03-04 10:51:40 +01:00
.github github: Force ubuntu-20.04 2022-12-06 20:59:27 +01:00
data Add support for Nefarious (#151) 2022-04-10 11:37:35 +02:00
irctest Bump linter versions (#188) 2023-03-04 10:51:40 +01:00
patches bahamut: lower mainloop delay, and reduce parallelism to make tests less flaky 2022-06-18 20:26:53 +02:00
.gitignore add a test for INVITE 2018-12-23 16:41:54 -05:00
.pre-commit-config.yaml Bump linter versions (#188) 2023-03-04 10:51:40 +01:00
CONTRIBUTING.md Split channel_operations.py by command. 2021-08-11 20:46:10 +02:00
LICENSE Initial commit 2015-12-18 17:26:55 +01:00
Makefile Add support for Dlk-Services (#176) 2022-11-14 22:58:30 +01:00
README.md README: Remove reference to setup.py 2022-08-20 18:05:47 +02:00
conftest.py Add support for pytest 7.0.0 2022-02-04 20:48:28 +01:00
make_workflows.py Bump linter versions (#188) 2023-03-04 10:51:40 +01:00
mypy.ini Bump linter versions (#188) 2023-03-04 10:51:40 +01:00
pyproject.toml Make black ignore irctest/scram/ 2021-11-12 22:34:48 +01:00
pytest.ini Add tests for draft/extended-monitor (#180) 2023-03-04 10:11:51 +01:00
report.py Bump linter versions (#188) 2023-03-04 10:51:40 +01:00
requirements.txt basic server test for SCRAM-SHA-256 (#84) 2021-08-08 20:47:42 +02:00
setup.cfg exhaustive testing of Modern's WHOIS spec (#104) 2021-08-29 16:38:38 +02:00
workflows.yml Add support for Dlk-Services (#176) 2022-11-14 22:58:30 +01:00

irctest

This project aims at testing interoperability of software using the IRC protocol, by running them against common test suites.

The big picture

This project contains:

  • IRC protocol test cases
  • small wrappers around existing software to run tests on them

Wrappers run software in temporary directories, so running irctest should have no side effect.

Prerequisites

Install irctest and dependencies:

sudo apt install faketime  # Optional, but greatly speeds up irctest/server_tests/list.py
cd ~
git clone https://github.com/ProgVal/irctest.git
cd irctest
pip3 install --user -r requirements.txt

Add ~/.local/bin/ (and/or ~/go/bin/ for Ergo) to your PATH if it is not.

export PATH=$HOME/.local/bin/:$HOME/go/bin/:$PATH

Using pytest

irctest is invoked using the pytest test runner / CLI.

You can usually invoke it with python3 -m pytest command; which can often be called by the pytest or pytest-3 commands (if not, alias them if you are planning to use them often).

The rest of this README assumes pytest works.

Test selection

A major feature of pytest that irctest heavily relies on is test selection. Using the -k option, you can select and deselect tests based on their names and/or markers (listed in pytest.ini). For example, you can run LUSERS-related tests with -k lusers. Or only tests based on RFC1459 with -k rfc1459.

By default, all tests run; even niche ones. So you probably always want to use these options: -k 'not Ergo and not deprecated and not strict. This excludes:

  • Ergo-specific tests (included as Ergo uses irctest as its official integration test suite)
  • tests for deprecated specifications, such as the IRCv3 METADATA specification
  • tests that check for a strict interpretation of a specification, when the specification is ambiguous.

Running tests

Servers

Ergo:

cd /tmp/
git clone https://github.com/ergochat/ergo.git
cd ergo/
make install
cd ~/irctest
pytest --controller irctest.controllers.ergo -k 'not deprecated'

Solanum:

cd /tmp/
git clone https://github.com/solanum-ircd/solanum.git
cd solanum
./autogen.sh
./configure --prefix=$HOME/.local/
make -j 4
make install
pytest --controller irctest.controllers.solanum -k 'not Ergo and not deprecated and not strict'

Charybdis:

cd /tmp/
git clone https://github.com/atheme/charybdis.git
cd charybdis
./autogen.sh
./configure --prefix=$HOME/.local/
make -j 4
make install
cd ~/irctest
pytest --controller irctest.controllers.charybdis -k 'not Ergo and not deprecated and not strict'

InspIRCd:

cd /tmp/
git clone https://github.com/inspircd/inspircd.git
cd inspircd

# optional, makes tests run considerably faster
patch src/inspircd.cpp < ~/irctest/patches/inspircd_mainloop.patch

./configure --prefix=$HOME/.local/ --development
make -j 4
make install
cd ~/irctest
pytest --controller irctest.controllers.inspircd -k 'not Ergo and not deprecated and not strict'

Mammon:

pip3 install --user git+https://github.com/mammon-ircd/mammon.git
cd ~/irctest
pytest --controller irctest.controllers.mammon -k 'not Ergo and not deprecated and not strict'

UnrealIRCd:

cd /tmp/
git clone https://github.com/unrealircd/unrealircd.git
cd unrealircd
./Config  # This will ask a few questions, answer them.
make -j 4
make install
cd ~/irctest
pytest --controller irctest.controllers.unreal -k 'not Ergo and not deprecated and not strict'

Servers with services

Besides Ergo (that has built-in services), most server controllers can optionally run service packages.

Atheme:

You can install it with

sudo apt install atheme-services

and add this to the pytest call:

--services-controller irctest.controllers.atheme_services

Anope:

Build with:

cd /tmp/
git clone https://github.com/anope/anope.git
cd anope
./Config  # This will ask a few questions, answer them.
make -C build -j 4
make -C build install

and add this to the pytest call:

--services-controller irctest.controllers.anope_services

Clients

Limnoria:

pip3 install --user limnoria pyxmpp2-scram
cd ~/irctest
pytest --controller  irctest.controllers.limnoria

Sopel:

pip3 install --user sopel
mkdir ~/.sopel/
cd ~/irctest
pytest --controller irctest.controllers.sopel

What irctest is not

A formal proof that a given software follows any of the IRC specification, or anything near that.

At best, irctest can help you find issues in your software, but it may still have false positives (because it does not implement itself a full-featured client/server, so it supports only “usual” behavior). Bug reports for false positives are welcome.