| 1 |
import re |
| 2 |
|
| 3 |
import pytest |
| 4 |
|
| 5 |
from labgrid.driver import ExecutionError |
| 6 |
|
| 7 |
|
| 8 |
def test_rt_cyclictest_short(command): |
| 9 |
"""Test a basic cyclictest run""" |
| 10 |
try: |
| 11 |
command.run_check("which cyclictest") |
| 12 |
except ExecutionError: |
| 13 |
pytest.skip("cyclictest missing") |
| 14 |
|
| 15 |
result = command.run_check("cyclictest -SN -D 5 -q") |
| 16 |
result = result[-1].strip() |
| 17 |
|
| 18 |
pattern = r"Min:\s+(?P<min>\w+)\s+Act:\s+\w+\s+Avg:\s+(?P<avg>\w+)\s+Max:\s+(?P<max>\w+)" |
| 19 |
min, avg, max = map(int, re.search(pattern, result).groups()) |
| 20 |
assert min <= avg <= max |
| 21 |
assert avg < 1e6 |
| 22 |
assert max < 10e6 |
| 23 |
|
| 24 |
|
| 25 |
def test_rt_hackbench_short(command): |
| 26 |
"""Test a basic hackbench run""" |
| 27 |
try: |
| 28 |
command.run_check("which hackbench") |
| 29 |
except ExecutionError: |
| 30 |
pytest.skip("hackbench missing") |
| 31 |
|
| 32 |
result = command.run_check("hackbench -f 10") |
| 33 |
result = result[-1].strip() |
| 34 |
|
| 35 |
pattern = r"Time:\s+(?P<time>\w+)" |
| 36 |
(time,) = map(int, re.search(pattern, result).groups()) |
| 37 |
assert time < 20 |