File: test_memory.py

package info (click to toggle)
labgrid 25.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,796 kB
  • sloc: python: 21,352; sh: 846; makefile: 35
file content (33 lines) | stat: -rw-r--r-- 799 bytes parent folder | download
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
import re

import pytest

from labgrid.driver import ExecutionError


def test_memory_mbw(command):
    """Test memcopy bandwidth"""
    try:
        command.run_check("which mbw")
    except ExecutionError:
        pytest.skip("mbw missing")

    result = command.run_check("mbw -qt0 8M")
    result = result[-1].strip()

    pattern = r"AVG\s+.*Copy:\s+(?P<bw>\S+)\s+MiB/s"
    (bw,) = map(float, re.fullmatch(pattern, result).groups())
    assert bw > 40  # > 40 MiB/second


def test_memory_memtester_short(command):
    """Test RAM for errors"""
    try:
        command.run_check("which memtester")
    except ExecutionError:
        pytest.skip("memtester missing")

    result = command.run_check("memtester 128k 1 | tail -n 1")
    result = result[-1].strip()

    assert result == "Done."