From 7893278cc636cf5167e67079bdfc21ef5cf7c9ae Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 22 Jun 2021 17:24:10 +0200 Subject: [PATCH] tests: Add handling for SPI ioctl replay This will only be supported with umockdev version 0.15.6. --- tests/umockdev-test.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py index a0ff077..45f19d0 100755 --- a/tests/umockdev-test.py +++ b/tests/umockdev-test.py @@ -19,6 +19,7 @@ try: print('umockdev is too old for test to be reliable, expect random failures!') print('Please update umockdev to at least 0.13.2.') pcap_supported = version >= (0, 15, 6) or os.getenv('CI_COMMIT_SHA') is not None + spi_supported = version >= (0, 15, 6) or os.getenv('CI_COMMIT_SHA') is not None except FileNotFoundError: print('umockdev-run not found, skipping test!') @@ -81,10 +82,17 @@ def get_umockdev_runner(ioctl_basename): dev = open(ioctl).readline().strip() assert dev.startswith('@DEV ') dev = dev[5:] + if dev.endswith(" (SPI)"): + dev = dev[:dev.rindex(" ")] + + # Skip test if we detect too old umockdev for spi replay + if not spi_supported: + sys.exit(77) umockdev = ['umockdev-run', *device_args, '-i', "%s=%s" % (dev, ioctl), '--'] + wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER') return umockdev + (wrapper.split(' ') if wrapper else []) + [sys.executable]