Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp499877lqp; Thu, 21 Mar 2024 07:32:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU452r+kwgTNTL6Am8EzKINgqBqq8ocjexuLcgTJHlM7/33yF5ynpzu3z8YTHApKxw4A8Qr64tNyjev9aalCurwU10wxLBrafZWd+Znuw== X-Google-Smtp-Source: AGHT+IHsxoTNJugnoGMfDM7ccrx3eXEAaw/noGi/mXAFJclRqMW1++RqP7uIcaUyc8/a9I8TMasx X-Received: by 2002:a17:90a:db8c:b0:29c:7641:5b8f with SMTP id h12-20020a17090adb8c00b0029c76415b8fmr4043852pjv.20.1711031552091; Thu, 21 Mar 2024 07:32:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711031552; cv=pass; d=google.com; s=arc-20160816; b=DSk5BycsBWQEZmVNQKuJ+jb/hDf6Np3D43NuwFVzOOSuDupU+0QOF2fVmKepbxQAx9 pDgF/SskuHva/0CY1UcNXEQQs9A8UGgKUjxvIYTGqRL210AIOki0fScNHX5z/v+uAOjn 8kh5gTSGfxtYkVp4cawfMQXyuh4LX6eZ3aEk1e2kThCfJYBLezy3FdvfzU+7SiBOxEkL e577io8/gBB9QVrsT3YYtpUJRcZzNfhxTj0+dc/GMRJEtd7SGYelqzGCYyFf4BE+1wnu Uvfa2lU0t3Q7aXqpsYSHUUOWwB/w/7hHl1yAa27MFOqZdf8Yw3SgSufv3y9Nlo9iXnqp gprw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=opktTlYedBuiFJS9SkEYMhhDffMkisjcFzlEk+KgS4A=; fh=3J00Rtx16pIPacixoIXuc8PlgUSmKJN+tpvBIYw7L2I=; b=G/18JKGytaicsFHpTolv2DxhuIXJPmyJgd4Uxv4D0HY4+7OnWs5x8rMWIupAWKr0s/ ixvh72BawNeBUNt8MUHEQ1cx59ryVr/Unywsc8RWvOmzUzipi7YWAvfgDp/ptBbzvtqZ RlG4PbLWaj+Yl8siz+FkrWy+6Ova1tk8stoVHZdDUrxdjU4DH64J7UaPo8ujge2Ns8rE tU4+oWAxgq9FDz3XbK4i0RB+b4z9FJ51Epx1vRAwiyS62aPRJPLNTa1h7uYI6Mo9ESz8 aW0t1+lsGuV/cbR1l0Dys1rF3bKbA4yitWD/vj+zlMqFgdz5TEKZQgCVj99A/qFQAcW8 xLkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gxyfMzWZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-nfs+bounces-2430-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2430-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f24-20020a637558000000b005eb028e2887si3326900pgn.709.2024.03.21.07.32.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 07:32:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2430-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gxyfMzWZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-nfs+bounces-2430-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2430-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A4AF228387C for ; Thu, 21 Mar 2024 14:32:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FEC01EB3B; Thu, 21 Mar 2024 14:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gxyfMzWZ" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A34D41E489 for ; Thu, 21 Mar 2024 14:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711031548; cv=none; b=nUBVOVuDTtVeLM+FxYuWPWTnx6tmE4vkFD8lqz8PlvEuYm6CEQMlT5z8YtxbLBGGYIxzFb8au4wGURbgXp//PCizhz0dyQCyIX+Vh6ZXvTGGCHWZWaQZZsv+p/QUiM8SlHBUieuvH3DaSP8Xd+gmGDlyGd3wcnT77bAIr8H3hF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711031548; c=relaxed/simple; bh=rmyBKjRwybGP8ae7JytbCpxOElnrm3Qb3RW3sVx3vAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gPsUxgr3YUqkO1hKj5z5N+/UC/4ejCpd2QPZARN6s2W6OWoSBQCnTL1EpM+Ji/fp6LsUuUw9MaY2GPnvx02GGMVoobf0fc/VIPE3QGYVa00Wex1fKFLr4yiNeuSXWRNNSRLC0un3unxbOVS0gLjtSu/4OfNX9LYaIBG+3w3I67I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gxyfMzWZ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711031545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=opktTlYedBuiFJS9SkEYMhhDffMkisjcFzlEk+KgS4A=; b=gxyfMzWZdbVsy93e7MbW8d8Dtlbr7kpP9vzs3taQagUJO8FCcbvbrRm04I/AWMbLNznreR tAAupk9gMWVPLUFCfFiqUMWItaLOrIR1NbQ6gRWW7FB+5mK7voKR8PZ+Xai6nwQJ0i4fvh +7t+Dltx2y74dLDCV3oIeIgSCyJkm8Q= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-YTf9g2OPPWmoeMXjwSMCLA-1; Thu, 21 Mar 2024 10:32:21 -0400 X-MC-Unique: YTf9g2OPPWmoeMXjwSMCLA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4BC43C0E44F; Thu, 21 Mar 2024 14:32:20 +0000 (UTC) Received: from aion.redhat.com (unknown [10.22.32.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A464B40C6CB5; Thu, 21 Mar 2024 14:32:20 +0000 (UTC) Received: from aion.redhat.com (localhost [IPv6:::1]) by aion.redhat.com (Postfix) with ESMTP id 2D3E912E0F7; Thu, 21 Mar 2024 10:32:00 -0400 (EDT) From: Scott Mayhew To: brendanhiggins@google.com, davidgow@google.com Cc: rmoar@google.com, npache@redhat.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-nfs@vger.kernel.org Subject: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test Date: Thu, 21 Mar 2024 10:32:00 -0400 Message-ID: <20240321143200.1854489-1-smayhew@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Commit c72a870926c2 added a mutex to prevent kunit tests from running concurrently. Unfortunately that mutex gets locked during module load regardless of whether the module actually has any kunit tests. This causes a problem for kunit tests that might need to load other kernel modules (e.g. gss_krb5_test loading the camellia module). So check to see if there are actually any tests to run before locking the kunit_run_lock mutex. Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") Reported-by: Nico Pache Signed-off-by: Scott Mayhew --- lib/kunit/test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/kunit/test.c b/lib/kunit/test.c index 1d1475578515..b8514dbb337c 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ { unsigned int i; + if (num_suites == 0) + return 0; + if (!kunit_enabled() && num_suites > 0) { pr_info("kunit: disabled\n"); return 0; -- 2.43.0