commit - f6faef172c3e17f6355d8306598861e55f63c48e
commit + a38f401ad8494deb85e562a21cbd4150a5099801
blob - 6881369c648ff0ebdda0fe986eef3f510bc1a64e (mode 644)
blob + /dev/null
--- tests/conftest.py
+++ /dev/null
-import subprocess
-import os
-from settings import DEF_VERSION, DEF_PKG_PATH
-
-
-def service(service_name, action):
- proc_cmd = ["/etc/rc.d/%s" % service_name, action]
- proc = subprocess.Popen(proc_cmd)
- proc.wait()
- assert proc.returncode == 0
-
-
-def addpkg(package, version=DEF_VERSION, pkg_path=DEF_PKG_PATH):
- pkg_path = os.path.join(pkg_path, version, 'packages')
- proc = subprocess(['pkg_add', package])
- proc.wait()
- assert proc.returncode == 0
-
-
-def osname():
- return subprocess.check_output(["uname", "-s"])
blob - /dev/null
blob + 6881369c648ff0ebdda0fe986eef3f510bc1a64e (mode 644)
--- /dev/null
+++ tests/python/conftest.py
+import subprocess
+import os
+from settings import DEF_VERSION, DEF_PKG_PATH
+
+
+def service(service_name, action):
+ proc_cmd = ["/etc/rc.d/%s" % service_name, action]
+ proc = subprocess.Popen(proc_cmd)
+ proc.wait()
+ assert proc.returncode == 0
+
+
+def addpkg(package, version=DEF_VERSION, pkg_path=DEF_PKG_PATH):
+ pkg_path = os.path.join(pkg_path, version, 'packages')
+ proc = subprocess(['pkg_add', package])
+ proc.wait()
+ assert proc.returncode == 0
+
+
+def osname():
+ return subprocess.check_output(["uname", "-s"])
blob - /dev/null
blob + 3d3fa529680e22a8f482de1b6082f3c7837f4ee6 (mode 644)
--- /dev/null
+++ tests/python/settings.py
+DEF_PKG_PATH = "ftp://ftp.eu.openbsd.org/pub/OpenBSD/"
+DEF_VERSION = "snapshots"
blob - /dev/null
blob + e55380acd8b09ff3891dfcf6164c8575862168b5 (mode 755)
--- /dev/null
+++ tests/python/test_adjtime.py
+import pytest
+import subprocess
+from conftest import service
+from conftest import osname
+
+
+@pytest.mark.skipif(osname != "OpenBSD")
+def test_adjtime():
+ service("ntpd", "start")
+ print("Sync time")
+ proc = subprocess.Popen(["ntpd", "-s"])
+ proc.wait()
+ service("ntpd", "stop")
+ print("Move time forward for 5 minutes")
+ # time=`date "+ %M"`
+ # date $(($time+5)) > /dev/null 2>&1 && date "+ %H:%M"
+ print("Validate adjustment")
+ # ntpd -s && sleep 60 && pkill -TERM ntpd
+ # date "+ %H:%M"
+ # [ `date "+ %M"` -eq $(($time+1)) ]; then
blob - /dev/null
blob + 88ad11a1ad64972a07f9a81904cf39d451fef249 (mode 644)
--- /dev/null
+++ tests/python/test_benchmarks.py
+import pytest
+import mmap
+import socket
+
+
+def test_socket(benchmark):
+ def socket_call():
+ socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ benchmark.pedantic(socket_call, iterations=1000, rounds=100)
+
+
+def test_bind(benchmark):
+ def bind_call():
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.bind(('', 9090))
+ benchmark.pedantic(bind_call, iterations=1000, rounds=100)
+
+
+def test_mmap(benchmark):
+ with open("test_mmap.txt", "wb") as f:
+ f.write("Hello, OpenBSD!\n")
+
+ def mmap_call():
+ with open("test_mmap.txt", "r+b") as f:
+ mm = mmap.mmap(f.fileno(), 0)
+ mm.close()
+ benchmark.pedantic(mmap_call, iterations=100, rounds=10)
blob - /dev/null
blob + 6039975decf059202dac487a7ada28daeec07c52 (mode 644)
--- /dev/null
+++ tests/python/test_config.py
+import pytest
+import subprocess
+
+# PKG_REQUIRED = zzuf
+ZZUF_OPT = "-s0:100 -r0.01"
+NUMBER = 20
+
+config = {'smtpd': '/etc/mail/smtpd.conf',
+ 'ntpd': '/etc/ntpd.conf',
+ 'ldapd': '/etc/ldapd.conf',
+ 'dhcpd': '/etc/dhcpd.conf',
+ 'npppd': '/etc/npppd/npppd.conf',
+ 'iked': '/etc/iked.conf'}
+
+
+def fuzz_config(app):
+ zzuf_cmd = ['zzuf'] + ZZUF_OPT.split(' ') + [config[app]]
+ proc = subprocess.Popen(zzuf_cmd)
+ proc.wait()
+ assert proc.returncode == 0
+
+
+def check_config(app):
+ cmd = [app, '-n', '-f', config[app]]
+ proc = subprocess.Popen(cmd)
+ proc.wait()
+ assert proc.returncode == 0
+
+
+@pytest.mark.parametrize("app", ['smtpd', 'ntpd', 'ldapd', 'dhcpd', 'npppd', 'iked'])
+def test_config(app):
+ for n in range(NUMBER):
+ fuzz_config(app)
+ check_config(app)
blob - /dev/null
blob + 0665eedf8267c9c2b9b579a25679e57a12dd7ac2 (mode 644)
--- /dev/null
+++ tests/python/test_fuse.py
+import subprocess
+import pytest
+from conftest import osname
+
+
+@pytest.fixture(scope="session")
+def make_fusexmp_bin():
+ cmd = ["gcc", "fusexmp.c", "-o", "fusexmp"]
+ retcode = subprocess.call(cmd)
+ assert retcode == 0
+
+
+@pytest.mark.skipif(osname != "OpenBSD", reason="supported only OpenBSD")
+@pytest.mark.usefixtures('make_fusexmp_bin')
+def test_fusexmp():
+ fusexmp_cmd = ["fusexmp", "speed"]
+ proc = subprocess.Popen(fusexmp_cmd)
+ proc.wait()
+ assert proc.returncode == 0
blob - /dev/null
blob + 68c5bd9ca6570bee9a56033026f095a2b4795351 (mode 644)
--- /dev/null
+++ tests/python/test_openssl.py
+import pytest
+import subprocess
+
+
+@pytest.mark.slowtest
+def test_openssl():
+ openssl_cmd = ["openssl", "speed"]
+ proc = subprocess.Popen(openssl_cmd)
+ proc.wait()
+ assert proc.returncode == 0
blob - /dev/null
blob + 45745d6123a8e3dd32a9c5229d31cf282ae64e26 (mode 644)
--- /dev/null
+++ tests/python/test_tcpstress.py
+import pytest
+import subprocess
+
+
+@pytest.fixture(scope="session")
+def make_tcpstress_bin(request):
+ cmd = ["gcc", "tcpstress.c", "-o", "tcpstress"]
+ retcode = subprocess.call(cmd)
+ assert retcode == 0
+
+
+@pytest.mark.usefixtures('make_tcpstress_bin')
+def test_tcpstress():
+ THREADS = 10
+ ACTIVE = 5
+ MAX = 10
+ HOSTNAME = 'localhost'
+ PORT = 1000
+
+ tcpstress_cmd = ['tcpstress', '-t', THREADS,
+ '-a', ACTIVE, '-m', MAX, HOSTNAME, PORT]
+ proc = subprocess.Popen(tcpstress_cmd)
+ proc.wait()
+ assert proc.returncode == 0
blob - /dev/null
blob + 83f8bdee4f809dd0b73a2636fc702ba1aaa73f23 (mode 644)
--- /dev/null
+++ tests/python/test_x11perf.py
+import os
+import subprocess
+import pytest
+
+
+def isX11():
+ X11PATH = "/usr/X11/"
+ if os.path.exists(X11PATH):
+ return True
+ return False
+
+
+@pytest.mark.skipif(isX11 is False, reason="Xenocara is not installed")
+@pytest.mark.slowtest
+def test_x11perf():
+ x11perf_cmd = ["x11perf", "-all"]
+ proc = subprocess.Popen(x11perf_cmd)
+ proc.wait()
+ assert proc.returncode == 0
blob - 3d3fa529680e22a8f482de1b6082f3c7837f4ee6 (mode 644)
blob + /dev/null
--- tests/settings.py
+++ /dev/null
-DEF_PKG_PATH = "ftp://ftp.eu.openbsd.org/pub/OpenBSD/"
-DEF_VERSION = "snapshots"
blob - e55380acd8b09ff3891dfcf6164c8575862168b5 (mode 755)
blob + /dev/null
--- tests/test_adjtime.py
+++ /dev/null
-import pytest
-import subprocess
-from conftest import service
-from conftest import osname
-
-
-@pytest.mark.skipif(osname != "OpenBSD")
-def test_adjtime():
- service("ntpd", "start")
- print("Sync time")
- proc = subprocess.Popen(["ntpd", "-s"])
- proc.wait()
- service("ntpd", "stop")
- print("Move time forward for 5 minutes")
- # time=`date "+ %M"`
- # date $(($time+5)) > /dev/null 2>&1 && date "+ %H:%M"
- print("Validate adjustment")
- # ntpd -s && sleep 60 && pkill -TERM ntpd
- # date "+ %H:%M"
- # [ `date "+ %M"` -eq $(($time+1)) ]; then
blob - 88ad11a1ad64972a07f9a81904cf39d451fef249 (mode 644)
blob + /dev/null
--- tests/test_benchmarks.py
+++ /dev/null
-import pytest
-import mmap
-import socket
-
-
-def test_socket(benchmark):
- def socket_call():
- socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- benchmark.pedantic(socket_call, iterations=1000, rounds=100)
-
-
-def test_bind(benchmark):
- def bind_call():
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.bind(('', 9090))
- benchmark.pedantic(bind_call, iterations=1000, rounds=100)
-
-
-def test_mmap(benchmark):
- with open("test_mmap.txt", "wb") as f:
- f.write("Hello, OpenBSD!\n")
-
- def mmap_call():
- with open("test_mmap.txt", "r+b") as f:
- mm = mmap.mmap(f.fileno(), 0)
- mm.close()
- benchmark.pedantic(mmap_call, iterations=100, rounds=10)
blob - 6039975decf059202dac487a7ada28daeec07c52 (mode 644)
blob + /dev/null
--- tests/test_config.py
+++ /dev/null
-import pytest
-import subprocess
-
-# PKG_REQUIRED = zzuf
-ZZUF_OPT = "-s0:100 -r0.01"
-NUMBER = 20
-
-config = {'smtpd': '/etc/mail/smtpd.conf',
- 'ntpd': '/etc/ntpd.conf',
- 'ldapd': '/etc/ldapd.conf',
- 'dhcpd': '/etc/dhcpd.conf',
- 'npppd': '/etc/npppd/npppd.conf',
- 'iked': '/etc/iked.conf'}
-
-
-def fuzz_config(app):
- zzuf_cmd = ['zzuf'] + ZZUF_OPT.split(' ') + [config[app]]
- proc = subprocess.Popen(zzuf_cmd)
- proc.wait()
- assert proc.returncode == 0
-
-
-def check_config(app):
- cmd = [app, '-n', '-f', config[app]]
- proc = subprocess.Popen(cmd)
- proc.wait()
- assert proc.returncode == 0
-
-
-@pytest.mark.parametrize("app", ['smtpd', 'ntpd', 'ldapd', 'dhcpd', 'npppd', 'iked'])
-def test_config(app):
- for n in range(NUMBER):
- fuzz_config(app)
- check_config(app)
blob - 0665eedf8267c9c2b9b579a25679e57a12dd7ac2 (mode 644)
blob + /dev/null
--- tests/test_fuse.py
+++ /dev/null
-import subprocess
-import pytest
-from conftest import osname
-
-
-@pytest.fixture(scope="session")
-def make_fusexmp_bin():
- cmd = ["gcc", "fusexmp.c", "-o", "fusexmp"]
- retcode = subprocess.call(cmd)
- assert retcode == 0
-
-
-@pytest.mark.skipif(osname != "OpenBSD", reason="supported only OpenBSD")
-@pytest.mark.usefixtures('make_fusexmp_bin')
-def test_fusexmp():
- fusexmp_cmd = ["fusexmp", "speed"]
- proc = subprocess.Popen(fusexmp_cmd)
- proc.wait()
- assert proc.returncode == 0
blob - 68c5bd9ca6570bee9a56033026f095a2b4795351 (mode 644)
blob + /dev/null
--- tests/test_openssl.py
+++ /dev/null
-import pytest
-import subprocess
-
-
-@pytest.mark.slowtest
-def test_openssl():
- openssl_cmd = ["openssl", "speed"]
- proc = subprocess.Popen(openssl_cmd)
- proc.wait()
- assert proc.returncode == 0
blob - 45745d6123a8e3dd32a9c5229d31cf282ae64e26 (mode 644)
blob + /dev/null
--- tests/test_tcpstress.py
+++ /dev/null
-import pytest
-import subprocess
-
-
-@pytest.fixture(scope="session")
-def make_tcpstress_bin(request):
- cmd = ["gcc", "tcpstress.c", "-o", "tcpstress"]
- retcode = subprocess.call(cmd)
- assert retcode == 0
-
-
-@pytest.mark.usefixtures('make_tcpstress_bin')
-def test_tcpstress():
- THREADS = 10
- ACTIVE = 5
- MAX = 10
- HOSTNAME = 'localhost'
- PORT = 1000
-
- tcpstress_cmd = ['tcpstress', '-t', THREADS,
- '-a', ACTIVE, '-m', MAX, HOSTNAME, PORT]
- proc = subprocess.Popen(tcpstress_cmd)
- proc.wait()
- assert proc.returncode == 0
blob - 83f8bdee4f809dd0b73a2636fc702ba1aaa73f23 (mode 644)
blob + /dev/null
--- tests/test_x11perf.py
+++ /dev/null
-import os
-import subprocess
-import pytest
-
-
-def isX11():
- X11PATH = "/usr/X11/"
- if os.path.exists(X11PATH):
- return True
- return False
-
-
-@pytest.mark.skipif(isX11 is False, reason="Xenocara is not installed")
-@pytest.mark.slowtest
-def test_x11perf():
- x11perf_cmd = ["x11perf", "-all"]
- proc = subprocess.Popen(x11perf_cmd)
- proc.wait()
- assert proc.returncode == 0