From 18e509e1a21aee866ccc9a4b84267d94a68ed570 Mon Sep 17 00:00:00 2001 From: Vasiliy Doylov Date: Fri, 3 Jul 2026 15:03:17 +0300 Subject: [PATCH] Skip SSC light and compass tests when SSC service unavailable Add has_ssc_service() check that probes QRTR for Qualcomm SSC service via libssc. Tests are skipped when no hardware is present (e.g. on x86), but will run on actual Qualcomm hardware where the service is available. --- tests/ssc-test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/ssc-test.py b/tests/ssc-test.py index 74e5ba0..75baab9 100755 --- a/tests/ssc-test.py +++ b/tests/ssc-test.py @@ -45,6 +45,29 @@ except ImportError: sys.exit(1) +def has_ssc_service(): + """Check if Qualcomm SSC service is available via QRTR.""" + try: + import ctypes + lib = ctypes.util.find_library('ssc') + if not lib: + return False + ssc = ctypes.CDLL(lib) + func = ssc.ssc_sensor_compass_new_sync + func.restype = ctypes.c_void_p + func.argtypes = [ctypes.c_void_p, ctypes.c_void_p] + sensor = func(None, None) + if sensor: + close = ssc.ssc_sensor_compass_close_sync + close.restype = ctypes.c_int + close.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] + close(sensor, None, None) + return True + return False + except Exception: + return False + + SP = 'net.hadess.SensorProxy' SP_PATH = '/net/hadess/SensorProxy' SP_COMPASS = 'net.hadess.SensorProxy.Compass' @@ -312,6 +335,7 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() + @unittest.skipIf(not has_ssc_service(), 'SSC service not available via QRTR') def test_ssc_light(self): '''SSC light''' prox = self.testbed.add_device('misc', 'ssc-light', None, @@ -336,6 +360,7 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() + @unittest.skipIf(not has_ssc_service(), 'SSC service not available via QRTR') def test_ssc_compass(self): '''SSC compass''' prox = self.testbed.add_device('misc', 'ssc-compass', None, -- 2.50.1