Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1947311rdb; Wed, 31 Jan 2024 14:21:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFd1hauxKhZuPRK/diYjWCu9OdLHCVHn+nK/ElvDtPDNNgN8TO0LOK5B0I8mfbQwdHRU6VA X-Received: by 2002:aa7:c1d9:0:b0:55e:f024:a327 with SMTP id d25-20020aa7c1d9000000b0055ef024a327mr392139edp.31.1706739696448; Wed, 31 Jan 2024 14:21:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706739696; cv=pass; d=google.com; s=arc-20160816; b=fws1bDPVeeEtklf3kkRcyqhVNMRnPCLV5wu2S9datXJKz1DbQ1L1Qydf314xOkqERS aLGtQfz6OiYMMpKj+1tuvf+h5jz6KJXnag9VgH2v32enzVqBnWLZ1YdcubPwTdgrGmfE O5yR5IR0ZJGVQtKPXEFqVRFguDR9KOvDQ0QUHlI7zdngIlxsgsYxh2kIzFi4fuD0kfSS Pt6wHrTm7QLBF/w2VTIKK+UnUxe1kO7rLOS3BS8dws6N+bEAlQhDefBco1GWa90E9qli nDUWDUOFn+tTmvCg5u2VLQvEAa8LSr3Z9GPP1pFOB9gjBGQ02BPcAfpB6EAhfbnpRfPl oEwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=9yRa9uTd3ZClYsdBfWcq0gGPl9RPFC95WWlUOwJzAkU=; fh=tieoW88lnO0Rb7CDjOjarvn4cGhxqzZl5C4+J0O9M+0=; b=o1NEpItcIkkt4VpsJqTgg1bQR4QJGXjm/9/HVDEYeDS5I/z08qQmw/AbE835vv3NxZ 1eU+I2TvPY2xHhDrs16wPNAcMDwdsZTJFli3fZF03S1jrhIvaIZ8e7Z1wIpMTdXW6TBL S6B3RRvUmG621O1pWo701fZXWm9+TOdwfipP6f/eLCaWfBUZMi3JHu2X6g+rPvBQ+5zq cC6KAsmMjk3Vmw1xl/ujSugG/L1wtB/7m9whbjMk2aCUXL35TmeunDxOhcImAAYEirJd 4bDQSgMCAddKUQNCD91q5nB0xDVzQeoSQq+cKpV70DO+4n8BEQ4Oub+dLUUqlR6mr55N v5zA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hGRcnElc; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-47230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCUJnBKmHgXUneOPoVsfB8KhgE7F0xFV6ZsvyKE1JbLYXhq36JEcCEpkbAlatdl4M98yEqwhIV51K3coXjbhYdQNU+6ss5cL3RpJwwqR7w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t2-20020a50d702000000b0055f0279a223si3469460edi.357.2024.01.31.14.21.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:21:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hGRcnElc; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-47230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9DA5C1F2AFC8 for ; Wed, 31 Jan 2024 22:05:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E391D3A8DE; Wed, 31 Jan 2024 22:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="hGRcnElc" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 9976E39FEB; Wed, 31 Jan 2024 22:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738693; cv=none; b=ni0eLyavlVvnfXdBFIam/KiWCqNHb7+ZnQj59s8P3Qq2AUXkSGKOiHYUgIV8rUs9jL7RozdlfACDRWSFNm2lDYrZ9DNBbfBGx79rUvZKsCYYGydqOesZCaE1PX8vDj13Jfs9NpYBduq+JaRNyedhbciwuP1T8/ckbISNs1otC0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738693; c=relaxed/simple; bh=7H9VGfXJR9jYnYxJzHccdVf3uGEU5Tce0GliskDOlpA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WAZqcox2EoIGma9yPxMYe1sxYQQIBBtOuUkotfiHhWs1UMaRdQcR+KyMN1PBB4vLP62fn9bv3KKkWeyLK1m8Wq3qZ82MduYEA4GPkXaplHh5U0D1HVDGss5hBTUxGXVJidHnDW7Rdr3kKJ4js/9m1A1eUmxR5qj7o1DZcBnti+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=hGRcnElc; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706738690; bh=7H9VGfXJR9jYnYxJzHccdVf3uGEU5Tce0GliskDOlpA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hGRcnElcLWWFhlSNdkDPPLRXd0t/SdjYrXdPbyiWPnTX9+SEnjNnwsj3zqz2lj0ST RTZBZ7zmAA16SXyZgT/lliY505s34/IkpN/YxVBuUK43SDZDcQoifT/LqkaJL5vhyW 45ApgmiWh65o4FlspKls0TPWGOA0XZB1Ois5i/ZIm2gE6kSlf4AzNH2njrqyEYZVax Foo9pwx34h+qMDxvRwRd7g4OMVateTMd8mHB9g3AFQ39AagmV94qiMcAfwC/1uZuxG WjcUMvLbGiZTteoyLVtq0+A7iXQOqHNggr71QeomKnPSmUHR3SZjQU197vVXmyyFIt 9W2zYr160W0iw== Received: from [192.168.1.211] (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D595C3782079; Wed, 31 Jan 2024 22:04:48 +0000 (UTC) From: =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= Date: Wed, 31 Jan 2024 17:02:43 -0500 Subject: [PATCH 4/4] selftests: ktap_helpers: Add a helper to finish the test Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240131-ktap-sh-helpers-extend-v1-4-98ffb468712c@collabora.com> References: <20240131-ktap-sh-helpers-extend-v1-0-98ffb468712c@collabora.com> In-Reply-To: <20240131-ktap-sh-helpers-extend-v1-0-98ffb468712c@collabora.com> To: Shuah Khan Cc: kernel@collabora.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Laura Nao , =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= X-Mailer: b4 0.12.4 Similar to the C counterpart, keep track of the number of test cases in the test plan and add a helper function to be called at the end of the test to print the results and exit with the corresponding exit code. Signed-off-by: NĂ­colas F. R. A. Prado --- tools/testing/selftests/kselftest/ktap_helpers.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index 87f93c6900c5..f2fbb914e058 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -15,6 +15,8 @@ KSFT_XFAIL=2 KSFT_XPASS=3 KSFT_SKIP=4 +KSFT_NUM_TESTS=0 + ktap_print_header() { echo "TAP version 13" } @@ -25,9 +27,9 @@ ktap_print_msg() } ktap_set_plan() { - num_tests="$1" + KSFT_NUM_TESTS="$1" - echo "1..$num_tests" + echo "1..$KSFT_NUM_TESTS" } ktap_skip_all() { @@ -94,6 +96,16 @@ ktap_exit_fail_msg() { exit "$KSFT_FAIL" } +ktap_finished() { + ktap_print_totals + + if [ $(("$KTAP_CNT_PASS" + "$KTAP_CNT_SKIP")) -eq "$KSFT_NUM_TESTS" ]; then + exit "$KSFT_PASS" + else + exit "$KSFT_FAIL" + fi +} + ktap_print_totals() { echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0" } -- 2.43.0