From patchwork Mon Mar 4 23:36:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13581350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDB09C48BF6 for ; Mon, 4 Mar 2024 23:36:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F32186B0075; Mon, 4 Mar 2024 18:36:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE2436B007B; Mon, 4 Mar 2024 18:36:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA9846B007D; Mon, 4 Mar 2024 18:36:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CA9366B0075 for ; Mon, 4 Mar 2024 18:36:31 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 94C5B140CE2 for ; Mon, 4 Mar 2024 23:36:31 +0000 (UTC) X-FDA: 81860968182.30.F97AB12 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf01.hostedemail.com (Postfix) with ESMTP id 775DE4000B for ; Mon, 4 Mar 2024 23:36:28 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hwTfVa4N; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of kuba@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=kuba@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709595389; a=rsa-sha256; cv=none; b=kfReeJF/CBoa/tfsGA6I28QkCFnMM4EjQ5mQloN5frl5v0r0EbXFYtqCE0vyUW4OKp7TEb wL6rfSdVLn2HH1IQlJEJr0esSOdhxpofGj2tc00JZ5ubYyvIUYhuk2MQiFTGcrf8edoSy0 38cNKddjWt0rIL9j/7y4N+RHANDpGCM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hwTfVa4N; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of kuba@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=kuba@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709595389; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Gkcer2J6UECaoB1PAfaZSGWckrZdc7o8hI7w9K2yrAA=; b=0B76IL759/e4G3yUGL/gFXh5ZXTzFahqJF9/HLnvaSWNMUu2Vk1002HRb40Yjiwhyn/muP db86NFo0ryXXVWbxW5rF3x2rTqmVqtsCxtaohafJtLkP5roi4CYjhj2mkq35I+0L3AJvtS 23vLL8LlJIw06dkPerjZLWpw8AKqhc4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 49DB5CE1812; Mon, 4 Mar 2024 23:36:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 062A2C433C7; Mon, 4 Mar 2024 23:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709595383; bh=zD4aQTIVjooBfUJtU0BUb2mrLEa7n8Z7akmW+sGwu6Y=; h=From:To:Cc:Subject:Date:From; b=hwTfVa4N1x+M/8qizFnFCv7/A77ZIWGs5rtYbDMiKHp7CLe5HaxJSa9pwEaZxA/4H 3/LZuV+ReNHz5wY+Nzc87pXzlizRGNDfsxWisYCOPXlXbnzVHreTLvQdrlGTZYGldC wdal9IEsQkO8AojOG1phQGI5ZfzO3NMrQC2HTJ2gcQi5wmk9vaJuL8c1VDaISTanPT pnLD+D/WKt496woFqUK5xkKBC8rUtrcUamUamzYi6SKwVQXtUD+i+LgLAXTh3C0oph Ud2VMLoV+qFOa5ytIn2/leeqFMaBdYf4kljco1nXZmFsmYMYtu4qZqQDB2NkQhET5j An/4tgXibCzzQ== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, Jakub Kicinski , Mark Brown , ivan.orlov0322@gmail.com, perex@perex.cz, tiwai@suse.com, shuah@kernel.org, jglisse@redhat.com, akpm@linux-foundation.org, keescook@chromium.org, linux-sound@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH net-next] selftests: avoid using SKIP(exit()) in harness fixure setup Date: Mon, 4 Mar 2024 15:36:20 -0800 Message-ID: <20240304233621.646054-1-kuba@kernel.org> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 775DE4000B X-Stat-Signature: qabfya8t65e9x6pa7fb938hfgjboce1r X-HE-Tag: 1709595388-600919 X-HE-Meta: U2FsdGVkX189SL//2xdAxcYYFlnJfsEmUuVXvhuo0wX/XqYYbg+BgVpRxCfsLtXUaGZEDEsrj8hOjwM45mpw83jRfS0xcXgcoCoTd2ywkLFPEIFObspc/2NUUa+ekYOHAzpRH/rz7cLCBShCr2pWz6S5kkR8Potafgz8FmKpsEbIZzCnjf3ysljSbKP7bvirw4Ie69kBw6bs9xgSdeuZ76KjWJWlhyPbXmTtHcMO7prxzB8KsGgtKWEZvA8YX8975jdt7ABedXKqTKdbt4lcCdjOTEp6NRed3Hl/zt5EoIl667E4jXyhTbPlNyBV6vgBHTMXZ1z+OCyGQ9sQOIokfFAkb0Qg4/KaZGidN3+hN65hTDXEloE8p8fA2rcbG+7oOi8oSiSdzfgkoUMlPnsYeXe43e5kK6zJBxY8yEghHiDL1CtQz8sc3Q+lKoofL5x0eEbBvgok8V5KCFGQAKOlmdkYmiLMcyHATnWVQSATmBuokQnAIt9LMEuskiTwe9pKoTIJ4wxS03yisWy/x57pP7ya9SwmLXfgtXBNsC9F1dUX2WFr6qrGjPPHeOGXxU+tfwUKpBbFdQo/nOqjqKJjaon8+jdWVTSJq5b00dFlue6hToMwmpRqkLoXtMgBwM8qicHu1iKRMfMhpV1rq7LJLqA35s1qn77axa/7NGSwhO0Nqq7NvgdeG5gMKaRjOEG0+aob7xdfI9i7gONiPRyfSYoJrNI4rsnayuJafx3TwA/ZyDtz3hng/GA0p36gVXBmoNaw99ilvBsg8kx50fxMKmhi8mdvurSdf5yu5gQsOYVcQUvMG6qzvQ2izDxvC5lecGIfKKNDPixVd5EvMaABiU67HvZ8G1q7x8g+mobwaGHBjAf1/nq1EHl+DqzvxzS8OXfBGFwPAoWqxNoaUaosAdOPVSu6FzmFnfyfn9aLBN6cPAVvzFsen7gYsVonCehNYn7dA6GpTK3E3CQVZTf U50l2bGB tYzNHEioAP6pGK3ZzUnAx6jiIZA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: selftest harness uses various exit codes to signal test results. Avoid calling exit() directly, otherwise tests may get broken by harness refactoring (like the commit under Fixes). SKIP() will instruct the harness that the test shouldn't run, it used to not be the case, but that has been fixed. So just return, no need to exit. Note that for hmm-tests this actually changes the result from pass to skip. Which seems fair, the test is skipped, after all. Reported-by: Mark Brown Link: https://lore.kernel.org/all/05f7bf89-04a5-4b65-bf59-c19456aeb1f0@sirena.org.uk Fixes: a724707976b0 ("selftests: kselftest_harness: use KSFT_* exit codes") Signed-off-by: Jakub Kicinski Reviewed-by: Kees Cook Reviewed-by: Mark Brown Tested-by: Mark Brown Reviewed-by: Przemek Kitszel --- This needs to go to net-next because that's where the breaking patch was (mis?)-applied. CC: ivan.orlov0322@gmail.com CC: perex@perex.cz CC: tiwai@suse.com CC: broonie@kernel.org CC: shuah@kernel.org CC: jglisse@redhat.com CC: akpm@linux-foundation.org CC: keescook@chromium.org CC: linux-sound@vger.kernel.org CC: linux-kselftest@vger.kernel.org CC: linux-mm@kvack.org --- tools/testing/selftests/alsa/test-pcmtest-driver.c | 4 ++-- tools/testing/selftests/mm/hmm-tests.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c index a52ecd43dbe3..ca81afa4ee90 100644 --- a/tools/testing/selftests/alsa/test-pcmtest-driver.c +++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c @@ -127,11 +127,11 @@ FIXTURE_SETUP(pcmtest) { int err; if (geteuid()) - SKIP(exit(-1), "This test needs root to run!"); + SKIP(return, "This test needs root to run!"); err = read_patterns(); if (err) - SKIP(exit(-1), "Can't read patterns. Probably, module isn't loaded"); + SKIP(return, "Can't read patterns. Probably, module isn't loaded"); card_name = malloc(127); ASSERT_NE(card_name, NULL); diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c index 20294553a5dd..d2cfc9b494a0 100644 --- a/tools/testing/selftests/mm/hmm-tests.c +++ b/tools/testing/selftests/mm/hmm-tests.c @@ -138,7 +138,7 @@ FIXTURE_SETUP(hmm) self->fd = hmm_open(variant->device_number); if (self->fd < 0 && hmm_is_coherent_type(variant->device_number)) - SKIP(exit(0), "DEVICE_COHERENT not available"); + SKIP(return, "DEVICE_COHERENT not available"); ASSERT_GE(self->fd, 0); } @@ -149,7 +149,7 @@ FIXTURE_SETUP(hmm2) self->fd0 = hmm_open(variant->device_number0); if (self->fd0 < 0 && hmm_is_coherent_type(variant->device_number0)) - SKIP(exit(0), "DEVICE_COHERENT not available"); + SKIP(return, "DEVICE_COHERENT not available"); ASSERT_GE(self->fd0, 0); self->fd1 = hmm_open(variant->device_number1); ASSERT_GE(self->fd1, 0);