tests: Skip busctl tests when not available

Signed-off-by: Brian Norris <briannorris@chromium.org>
This commit is contained in:
Brian Norris 2020-06-25 13:22:01 -07:00 committed by Jouni Malinen
parent 2818e9ca90
commit 4dbba548ae

View file

@ -9,6 +9,7 @@ import logging
logger = logging.getLogger() logger = logging.getLogger()
import subprocess import subprocess
import time import time
import shutil
import struct import struct
import sys import sys
@ -5354,6 +5355,8 @@ def test_dbus_introspect(dev, apdev):
raise Exception("Unexpected Introspect response") raise Exception("Unexpected Introspect response")
def run_busctl(service, obj): def run_busctl(service, obj):
if not shutil.which("busctl"):
raise HwsimSkip("No busctl available")
logger.info("busctl introspect %s %s" % (service, obj)) logger.info("busctl introspect %s %s" % (service, obj))
cmd = subprocess.Popen(['busctl', 'introspect', service, obj], cmd = subprocess.Popen(['busctl', 'introspect', service, obj],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,