summaryrefslogtreecommitdiff
path: root/tests/accel-pppd/pppoe/conftest.py
diff options
context:
space:
mode:
authorSergey V. Lobanov <sergey@lobanov.in>2024-08-22 15:47:40 +0000
committerSergey V. Lobanov <sergey@lobanov.in>2024-08-23 23:45:58 +0000
commit3be221b510112a30922b1da2697eaaaca09ebfd5 (patch)
tree9db426752552a23796c9fc3c0ac749b4ac099681 /tests/accel-pppd/pppoe/conftest.py
parent2d38a77c008524e293e0dc4b1e46c9093e7a9457 (diff)
downloadaccel-ppp-3be221b510112a30922b1da2697eaaaca09ebfd5.tar.gz
accel-ppp-3be221b510112a30922b1da2697eaaaca09ebfd5.zip
ci: run tests in alpine vm
Alpine Linux uses musl libc so now accel-ppp is tested under musl Currently, Alpine Linux doesn't provide a link to the latest stable version so direct link to Alpine 3.20 is used Improved musl support might be used to run on platforms like openwrt without additional patches
Diffstat (limited to 'tests/accel-pppd/pppoe/conftest.py')
-rw-r--r--tests/accel-pppd/pppoe/conftest.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/accel-pppd/pppoe/conftest.py b/tests/accel-pppd/pppoe/conftest.py
index 8ebaaed3..b3893200 100644
--- a/tests/accel-pppd/pppoe/conftest.py
+++ b/tests/accel-pppd/pppoe/conftest.py
@@ -1,5 +1,6 @@
-import pytest
+import pytest, subprocess, re
from common import pppd_process
+from packaging.version import Version
# pppd executable file name
@pytest.fixture()
@@ -13,11 +14,21 @@ def pppd(pytestconfig):
def pppd_config():
return ""
+# determines which plugin is required - pppoe.so (pppd 2.5.0+) or rp-pppoe.so (pppd <2.5.0)
+def pppd_plugin_so(pppd):
+ command = [pppd, "--version"]
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+ pppd_version = Version(re.search(r'\d+\.\d+\.\d+', result.stdout + result.stderr).group())
+ ref_version = Version("2.5.0")
+ if pppd_version >= ref_version:
+ return "pppoe.so"
+ else:
+ return "rp-pppoe.so"
# pppd configuration as command line args
@pytest.fixture()
-def pppd_args(pppd_config):
- return pppd_config.split()
+def pppd_args(pppd_config, pppd):
+ return ("plugin " + pppd_plugin_so(pppd) + "\n" + pppd_config).split()
# setup and teardown for tests that required running pppd (after accel-pppd)