From 5aa751eaf3145f68cc604bd41b161f3ea5fd8e76 Mon Sep 17 00:00:00 2001 From: Jonathan Afek Date: Thu, 23 Jun 2016 20:16:35 +0300 Subject: [PATCH] tests: Add general filter for remote tests execution Add a new function decorator for the test functions so that they can be marked as remote compatible tests. Add a general filter to the remote tests execution script to only execute tests that are remote compatible. Signed-off-by: Jonathan Afek --- tests/hwsim/remotehost.py | 4 ++++ tests/remote/run-tests.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index 39d7253a6..ce676a3cd 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -10,6 +10,10 @@ import threading logger = logging.getLogger() +def remote_compatible(func): + func.remote_compatible = True + return func + def execute_thread(command, reply): cmd = ' '.join(command) logger.debug("thread run: " + cmd) diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py index fea73f54e..b43881542 100755 --- a/tests/remote/run-tests.py +++ b/tests/remote/run-tests.py @@ -191,6 +191,10 @@ def main(): # setup hwsim_test we should run if requested_hwsim_tests[0] == "all": hwsim_tests_to_run = hwsim_tests + elif requested_hwsim_tests[0] == "remote": + hwsim_tests_to_run = [t for t in hwsim_tests + if hasattr(t, "remote_compatible") and + t.remote_compatible] else: for test in requested_hwsim_tests: t = None