test_drm.py 594 Bytes
Newer Older
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
import os
import subprocess

NODE = '/dev/dri/renderD128'


def udev_props(path):
    out = subprocess.check_output(['udevadm', 'info', '-qproperty', path]).decode('utf-8')
    props = {}
    for line in out.split('\n'):
        if not line.strip():
            continue
        k, v = line.strip().split('=', 1)
        props[k] = v
    return props


def test_render_node():
    "Test if we have a render node"
    assert(os.path.exists(NODE))


def test_etnaviv_node():
    "Test if the render node is etnaviv"
    props = udev_props(NODE)
    assert(props['ID_PATH'] == 'platform-etnaviv')