From 8f712c6ed98191ed5a711bc98c3999bbc233a6d2 Mon Sep 17 00:00:00 2001 From: Jimi Chen Date: Wed, 19 Mar 2025 14:35:15 +0000 Subject: [PATCH] Add apf_ram_at_least decorator to restrict multi-device tests to the given minimum apf ram size capable device. Test: TH Change-Id: I1042fd0662695e9bc71833eb24311f4436b2676c --- staticlibs/testutils/host/python/apf_utils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/staticlibs/testutils/host/python/apf_utils.py b/staticlibs/testutils/host/python/apf_utils.py index 3c97d446d8..3fee99f269 100644 --- a/staticlibs/testutils/host/python/apf_utils.py +++ b/staticlibs/testutils/host/python/apf_utils.py @@ -447,6 +447,24 @@ def at_least_B(): return wrapper return decorator +def apf_ram_at_least(size): + def decorator(test_function): + @functools.wraps(test_function) + def wrapper(self, *args, **kwargs): + asserts.abort_class_if( + (not hasattr(self, 'clientDevice')) or (not hasattr(self, 'client_iface_name')), + "no valid client attribute" + ) + + caps = get_apf_capabilities(self.clientDevice, self.client_iface_name) + asserts.skip_if( + caps.apf_ram_size < size, + f'APF rame size {caps.apf_ram_size} < {size}' + ) + return test_function(self, *args, **kwargs) + return wrapper + return decorator + class AdbOutputHandler: def __init__(self, ad, cmd): self._ad = ad