From patchwork Wed Aug 23 20:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magali Lemes X-Patchwork-Id: 1825126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=p8pl+MwP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RWWqG5vjcz1ygJ for ; Thu, 24 Aug 2023 15:29:29 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qZ2uB-00039E-Ie; Thu, 24 Aug 2023 05:29:15 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qYuKw-0008Bw-Kc for kernel-team@lists.ubuntu.com; Wed, 23 Aug 2023 20:20:18 +0000 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 6AFE73F32D for ; Wed, 23 Aug 2023 20:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1692822018; bh=9OUE2DXjzWBssNXY8Xtk+T9vtmrZhWKrmkn+v3nf+vc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p8pl+MwPLjLj2E7GiDM4X57rTbLSAIoK72giOQIm0Mxg/VpMFyhz2xjURF3kMYmX7 WfeUvWaHX7j2kmD2AczSrXs/8exSUdUJ1UiaiYtCklv9O3UehReA8GyA7TH5gTtW96 UuHGw7vm5VfhB60Ljxy/NDy7FL2ZqEU0aq4y1huoEIGJG56bOIz8ghckFvSFo3xH+y 5f0Ev6CE+dssCXa5iP8/Gc+d0+E7WObt6sWURrOhmACZG1Vb5wQMV2iqUNKGI8jLXM 7t9FbWOehv6US4Wq99czXTUa3gqI0WlCTiUFe3UiLT84GiB88UzKFgrhgiEXQJVbHk R96j3y9UEiULw== Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6bc7b12ee26so6800009a34.0 for ; Wed, 23 Aug 2023 13:20:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692822017; x=1693426817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9OUE2DXjzWBssNXY8Xtk+T9vtmrZhWKrmkn+v3nf+vc=; b=i+a3JoBjEKsZy2SsjUTcrgbYG6yam0r+lzw/LaONplXQAagX00bO3pEbCQObLiJOOg A94o947p87MlflGHU/t9o/TOTJ3wlE/18ZiCq+QIR2FYAHv0S55osiKQzGwkfDyhqbty X5G9smjyL6yNNBXOhbKXXMNSYTFKd/tHX+i50kWnfnb7U1PMElYitxxHMciyH1D9xvpq oVW4MEcEFRTrWZhEqynBGcMF00PelZDGtbkdpGUkpJUslgE0T8ovp049tJpskWU/Q3bK niYAZsGdJH4eU15zszJZwMS8S0YwURUXFsECwlmlHZSF4XkPc8eHiSG9+OM5Ve+nV8LY z9Tg== X-Gm-Message-State: AOJu0YyDuegPZ2r5vzj7lnTA8TPmSI/tL9jPrvXtsuTL70qsIFCVWVGI 9JN80xjvROb+qtu1wz85wuYn1zQHPuFIsyQKE90G9UnUO3DZU8qHmkfmK3O/N92pMCho++HSnhz 3Kz1627+wkGOVRFrIp6lItV7Cc9Honi4qv5XasUc70XzBhzIejg== X-Received: by 2002:a9d:4d09:0:b0:6bc:e055:bc50 with SMTP id n9-20020a9d4d09000000b006bce055bc50mr345184otf.20.1692822016808; Wed, 23 Aug 2023 13:20:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFC0EcEpVHK23fOgsHucwVFNb4kpcsw869vX3OvHswV178p5WF0vspfyLejBIfdyJQvK7SvMQ== X-Received: by 2002:a9d:4d09:0:b0:6bc:e055:bc50 with SMTP id n9-20020a9d4d09000000b006bce055bc50mr345176otf.20.1692822016506; Wed, 23 Aug 2023 13:20:16 -0700 (PDT) Received: from magali.. ([2804:7f0:b441:c26e:859:2d03:8834:2228]) by smtp.gmail.com with ESMTPSA id y1-20020a056830208100b006ba864f5b37sm5970503otq.12.2023.08.23.13.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 13:20:15 -0700 (PDT) From: Magali Lemes To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH v2 1/3] selftests/harness: allow tests to be skipped during setup Date: Wed, 23 Aug 2023 17:20:08 -0300 Message-Id: <20230823202010.652027-2-magali.lemes@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230823202010.652027-1-magali.lemes@canonical.com> References: <20230823202010.652027-1-magali.lemes@canonical.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 24 Aug 2023 05:29:14 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2019868 Before executing each test from a fixture, FIXTURE_SETUP is run once. When SKIP is used in FIXTURE_SETUP, the setup function returns early but the test still proceeds to run, unless another SKIP macro is used within the test definition, leading to some code repetition. Therefore, allow tests to be skipped directly from the setup function. Suggested-by: Jakub Kicinski Signed-off-by: Magali Lemes Signed-off-by: Jakub Kicinski (backported from commit 372b304c1e517c4d3e5b6ca6c9cfb20f027c3b03) [magalilemes: a clean cherry-pick would require 63e6b2a4 ("selftests/harness: Run TEARDOWN for ASSERT failures"). However, it suffices to just manually change the if condition that conflicts.] Signed-off-by: Magali Lemes --- tools/testing/selftests/kselftest_harness.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index 11779405dc80..72272272fac4 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -244,7 +244,7 @@ /** * FIXTURE_SETUP() - Prepares the setup function for the fixture. - * *_metadata* is included so that EXPECT_* and ASSERT_* work correctly. + * *_metadata* is included so that EXPECT_*, ASSERT_* etc. work correctly. * * @fixture_name: fixture name * @@ -270,7 +270,7 @@ /** * FIXTURE_TEARDOWN() - * *_metadata* is included so that EXPECT_* and ASSERT_* work correctly. + * *_metadata* is included so that EXPECT_*, ASSERT_* etc. work correctly. * * @fixture_name: fixture name * @@ -383,7 +383,7 @@ memset(&self, 0, sizeof(FIXTURE_DATA(fixture_name))); \ fixture_name##_setup(_metadata, &self, variant->data); \ /* Let setup failure terminate early. */ \ - if (!_metadata->passed) \ + if (!_metadata->passed || _metadata->skip) \ return; \ fixture_name##_##test_name(_metadata, &self, variant->data); \ fixture_name##_teardown(_metadata, &self); \