tests: Add testing to the synaptics driver

As the driver is not a normal image device, we need to add a custom
script to test it. Note that the ioctl dump must also be manually
modified unfortunately as the state is tracked incorrectly for the
device by umockdev-record.
This commit is contained in:
Benjamin Berg
2019-08-12 16:30:40 +02:00
parent 538038867b
commit b92e6d6acd
8 changed files with 474 additions and 3 deletions

View File

@@ -56,10 +56,25 @@ def capture():
# Compare the images, they need to be identical
cmp_pngs(os.path.join(tmpdir, "capture.png"), os.path.join(ddir, "capture.png"))
def custom():
ioctl = os.path.join(ddir, "custom.ioctl")
device = os.path.join(ddir, "device")
dev = open(ioctl).readline().strip()
assert dev.startswith('@DEV ')
dev = dev[5:]
subprocess.check_call(['umockdev-run', '-d', device,
'-i', "%s=%s" % (dev, ioctl),
'--',
'%s' % os.path.join(ddir, "custom.py")])
try:
if os.path.exists(os.path.join(ddir, "capture.ioctl")):
capture()
if os.path.exists(os.path.join(ddir, "custom.ioctl")):
custom()
finally:
shutil.rmtree(tmpdir)