From patchwork Fri Dec 9 07:08:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 120690 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43E6FA0093; Fri, 9 Dec 2022 09:05:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FA2442D2F; Fri, 9 Dec 2022 09:05:04 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id E964242D27 for ; Fri, 9 Dec 2022 09:05:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670573102; x=1702109102; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=oPj4J4P3I2rrjTEZL7GMs71M/nw1Bc4MKv45ikYVlUA=; b=I7tiOultUi1sFaX8KbBTM63yURF7B4T4dK+rHMdyk8avDGlzwm/+7HhH 6mefU0cyC3krj3EyHoCBhMhIGpqv11SoltyAKq9mBojC4kP5GMj5v5jk2 rGdBMrzTqsMawBWMZLHW5tZjeaAICJSNum3GGuC+Nw3CGp0j062ASe5l+ Z4I8Q3Kqxsw4twxAyjoHKdHwacPPi+AU3x9vf3+iD/cj3CaiRIC3lCHJ9 fN3fmvnJPAuNHVFkDgbfCquOFU3+hA5BNQ3264gppfzBzGO3KpJONzlHA 7d0LnzTU1FqhGH2WqNJalLDoQVIe3btc2CeMTXuUfcX8clrml61BGylwo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="305051974" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="305051974" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 00:05:01 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="678074603" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="678074603" Received: from unknown (HELO localhost.localdomain) ([10.239.252.99]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 00:05:00 -0800 From: Lingli Chen To: dts@dpdk.org Cc: zhiminx.huang@intel.com, Lingli Chen Subject: [dts][PATCH V2 4/5] framework/test_case: add skip_unsupported_host_driver decorator Date: Fri, 9 Dec 2022 02:08:06 -0500 Message-Id: <20221209070807.1134-5-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209070807.1134-1-linglix.chen@intel.com> References: <20221209070807.1134-1-linglix.chen@intel.com> X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org add decorator Signed-off-by: Lingli Chen --- V2: reformat framework/test_case.py framework/test_case.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/framework/test_case.py b/framework/test_case.py index 2831cb36..86f5bbbf 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -606,3 +606,25 @@ def check_supported_nic(nics): return wrapper return decorator + + +def skip_unsupported_host_driver(drivers): + """ + Skip case which are not supported by the host driver(vfio-pci/igb_uio etc.) + """ + if isinstance(drivers, str): + drivers = [drivers] + + def decorator(func): + @wraps(func) + def wrapper(*args, **kwargs): + test_case = args[0] + if test_case.drivername in drivers: + raise VerifySkip( + "{} do not support this case".format(test_case.drivername) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator