tests: Skip umockdev based test for missing dependencies

Also print a warning if umockdev-run is too old. Note that we still try
to run the unreliable tests as they are still useful for development.
This commit is contained in:
Benjamin Berg 2019-11-18 21:09:50 +01:00
parent 33530d62c7
commit 951d482bc6

View file

@ -10,6 +10,18 @@ import subprocess
if len(sys.argv) != 2: if len(sys.argv) != 2:
print("You need to specify exactly one argument, the directory with test data") print("You need to specify exactly one argument, the directory with test data")
# Check that umockdev is available
try:
umockdev_version = subprocess.check_output(['umockdev-run', '--version'])
version = tuple(int(_) for _ in umockdev_version.split(b'.'))
if version < (0, 13, 2):
print('umockdev is too old for test to be reliable, expect random failures!')
print('Please update umockdev to at least 0.13.2.')
except FileNotFoundError:
print('umockdev-run not found, skipping test!')
print('Please install umockdev.')
sys.exit(77)
edir = os.path.dirname(sys.argv[0]) edir = os.path.dirname(sys.argv[0])
ddir = sys.argv[1] ddir = sys.argv[1]