summaryrefslogtreecommitdiff
path: root/stacks/daemon/test_max25_platform.py
blob: 5073e01c14e4e752685c60b46f9187e9e4349dcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
"""Platform helpers for max25d."""
from __future__ import annotations

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))
from max25_platform import (  # noqa: E402
    crdop_audio_backend,
    default_bans_file,
    default_unix_socket,
    is_freebsd,
    is_linux,
    max25d_supported,
    supported_device_ids,
)


def test_linux_defaults() -> None:
  # Run on Linux CI — skip assertions on other hosts
    if not is_linux():
        return
    assert max25d_supported()
    assert "tnc2c" in supported_device_ids()
    assert "baycom-kiss" in supported_device_ids()
    assert "pccom-kiss" in supported_device_ids()
    assert "max25e0" in supported_device_ids()
    assert "max25e0" in supported_device_ids()
    assert "max25e0:bc1" in supported_device_ids()
    assert "baycom-ser12" not in supported_device_ids()
    assert "baycom-a" not in supported_device_ids()
    assert crdop_audio_backend() == "alsa"
    assert default_unix_socket() == "/run/max25/modem.sock"
    assert default_bans_file() == "/var/lib/max25/bans.txt"


def test_freebsd_profile() -> None:
    if not is_freebsd():
        return
    assert max25d_supported()
    assert "soft-crdop" in supported_device_ids()
    assert "tmodem" in supported_device_ids()
    assert "max25e0" in supported_device_ids()
    assert "tnc2c" not in supported_device_ids()
    assert crdop_audio_backend() == "oss"
    assert default_unix_socket() == "/var/run/max25/modem.sock"
    assert default_bans_file() == "/var/db/max25/bans.txt"


if __name__ == "__main__":
    test_linux_defaults()
    test_freebsd_profile()
    print("test_max25_platform: ok")
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com