Debian Codegraph @

examples/shell/test_memory.py

raw symbols SCIP
1 import re
2
3 import pytest
4
5 from labgrid.driver import ExecutionError
6
7
8 def test_memory_mbw(command):
9 """Test memcopy bandwidth"""
10 try:
11 command.run_check("which mbw")
12 except ExecutionError:
13 pytest.skip("mbw missing")
14
15 result = command.run_check("mbw -qt0 8M")
16 result = result[-1].strip()
17
18 pattern = r"AVG\s+.*Copy:\s+(?P<bw>\S+)\s+MiB/s"
19 (bw,) = map(float, re.fullmatch(pattern, result).groups())
20 assert bw > 40 # > 40 MiB/second
21
22
23 def test_memory_memtester_short(command):
24 """Test RAM for errors"""
25 try:
26 command.run_check("which memtester")
27 except ExecutionError:
28 pytest.skip("memtester missing")
29
30 result = command.run_check("memtester 128k 1 | tail -n 1")
31 result = result[-1].strip()
32
33 assert result == "Done."