From patchwork Wed Jan 31 22:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 194985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp52011dyc; Wed, 31 Jan 2024 14:05:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEE+ERqLzRJTD/HcDNm4hEKYw2bK73QIZGMmrCIBSccDVr8UUkXXD8e0FFwbpVpIn0j/fuX X-Received: by 2002:a05:620a:628f:b0:783:f6d9:b94a with SMTP id ov15-20020a05620a628f00b00783f6d9b94amr917778qkn.13.1706738755803; Wed, 31 Jan 2024 14:05:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706738755; cv=pass; d=google.com; s=arc-20160816; b=rMi0Kji92kEF0NdJAOfd0VdI+ibhq06YagcZ2/vKMf0RKRtv3h3HGaW3RWzASJlWaH h1w8w2mQRaiBLQTSytsDU0UIPVUJudWEDdRsWUtqXtpaUll5xG9PLSpW7QQ23f8F1SPv 2d2EmXEFuC216AmA1PaKbxexr1floA+qrrt0SRY0NsppKg8OQAsLcvpMHMVfkwR0J6Z1 ZZUu2khYgH0sjLbU3IS5pBgvcLonQSgy7+mu3lQVOyaCq8W4EHzn6D2lyeRpsxCzAQnp /GU9yRQoS+tLDu9rtGSX2Daw0o64ntHJlqhJltL0vORRwHu01NGHKdUbQ3IAIzaGoHEE /5Ww== 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=AKF/ICoyH8xf6/xhhSJuonppFXGq/dawu7fmVUNchnI=; fh=e6hE0lBx4Zf1Q6WoZv4zj/bPRR4pQm0TbHUWXzbuZdI=; b=iIKyRU9LHhc59UDElSmFUZ/EslcR7wufoda1yRjm/d/r1JEPpVACpLuUZA/SjOVhxq blsBs7ZSt9gA+xQy3nCmUmYnjFbnfcKQ71ZHGKXiFT57WJrltQSAurwE+fQEe5BXplYu i/5ww+sEHPSrwDrhXxAvEdzv3o9nn3YqApmzLPMN/GQmXedmN5ipmvJgMSx8PyKeRKbR YgmTsNYE4ID0uctnQVRPhDjyG7270jyVLG5qdXUa1fS2nncZxEsbhr0CVGrd1qjpjErI 6qnw91u79Fttwu9Bpb/U3HbSj5goqfYmJoqBddzDw2lVkvzoucG+BTSy4qFifwRZ+qoG 1MfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=1Yd2X8KM; 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-47227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47227-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCXsLYneS4T4ROOTlb+qZetwpGDuczVTk6k/Q8cYScg4VOi4vroZ+iyKAL2uTCZ3Q68JhCsMjgLqUxj/0tyaYFLVMk7nZA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z11-20020a05620a260b00b00785346d8124si3822120qko.595.2024.01.31.14.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:05:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=1Yd2X8KM; 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-47227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47227-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7003A1C23A48 for ; Wed, 31 Jan 2024 22:05:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CDCF3A262; Wed, 31 Jan 2024 22:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="1Yd2X8KM" 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 2E91639FDA; Wed, 31 Jan 2024 22:04:46 +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=1706738688; cv=none; b=GmNzCFyNM7RLXD0crhmLQC0MaOLOvKzII4QmDI/DTYwRo4xo2Gt2YZSxteT4me+jUI4tEddGRVF5lMGHTvqzOXZ//Djm2Ddt8s7qP4XTvdEA2H9xUeVnA83QfvuVIcALDOHREx4uRX4fh4+NVpUXAOTeSyTqUqB8q2tBHaW6kac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738688; c=relaxed/simple; bh=HbsXRGtiyi3ELSqaY6WtU/YJy+Gt0wI2oltVvs97Qqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s8mkDK4/vAD3SBUj2rtYgH8n/MGdGh90Pc94r/N/XiT+SZVSvIqUbCE++g3Pd0v2ENDmKW7+owGccgLfx1zDwqHUX9roJTzrq3pwcnjVZ1pl7eaiBiOoLWYr0w12IBYiCx+H2xEwc0bzLv5o/pFBIue2sZOEMgrMnpHyp1tmM4o= 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=1Yd2X8KM; 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=1706738685; bh=HbsXRGtiyi3ELSqaY6WtU/YJy+Gt0wI2oltVvs97Qqo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=1Yd2X8KMheYZZSLs3DvbOYoyRERViAlV050nb0292K+2NBfP1VkoX6cxCz7ZfAPHG h3612R3SVAmQNm9Eun7sY4vWlD7ssLWWYt4BmuGWsBap7p91RDoZsVQxyzc7zB0mMn 0TrZmND1+B4IZqppCM8WA1JBnvzt5xjwaYqCqHMVQi16NXDmppyb4ATCfYa5xxAHks UM5AbPWafILt4NSiEKT7NM9Q3PB2JknDFx/qs4mEtioi0ZCx4AXDJvlVCU+WI96yw8 Hhp0YheQ6IxFOyYOWC/ZkXXfwypMvMgwSkYp92sJAcozoeiqMELREWkvulnpyEUzKv w99qTwnM+rkCA== 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 77272378206C; Wed, 31 Jan 2024 22:04:44 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Wed, 31 Jan 2024 17:02:40 -0500 Subject: [PATCH 1/4] selftests: ktap_helpers: Add helper to print diagnostic messages Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240131-ktap-sh-helpers-extend-v1-1-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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789645297446276518 X-GMAIL-MSGID: 1789645297446276518 Similar to the C counterpart, add a helper to print a diagnostic message. Signed-off-by: Nícolas F. R. A. Prado --- tools/testing/selftests/kselftest/ktap_helpers.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index dd79d96f3b5a..ecc1413c22cd 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -19,6 +19,11 @@ ktap_print_header() { echo "TAP version 13" } +ktap_print_msg() +{ + echo "#" $@ +} + ktap_set_plan() { num_tests="$1" From patchwork Wed Jan 31 22:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 194986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp52082dyc; Wed, 31 Jan 2024 14:06:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgWs996lCYxGB/ZOD5h/Bt9IvpZycORwkX9JeUg97s7PT6YjOqa5QQ4jUCWgfTzFm6CHsd X-Received: by 2002:a17:90b:1093:b0:295:adc4:6456 with SMTP id gj19-20020a17090b109300b00295adc46456mr3040077pjb.34.1706738765880; Wed, 31 Jan 2024 14:06:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706738765; cv=pass; d=google.com; s=arc-20160816; b=cibQpsdX8Z0WZPwdYFVS8tq3Xa03CYvM1Jy97Xd88904NMpJexN1xrnatPhaj3eod3 8Vp7UrAKXFDKkBO80msg+zlheWSkHSL6SZuePj4qmLZ94NmWWFGLS+V9UC2M26XpH6pU Jg/JjERBhtfm4TABUNqOydoUbuwg8pHvD0VfvLwc6KKbWP4WWHqQHl3vDLvjQEhDZfcz PMGfa0oYoKaaSUNSrRL7MZb0nB5BZIhQLZwDCmrlbWK9QkoBps3hvrVlqOTDxuf1RRWx x9Fww3BmVbhQWgkAogWZgiEewVuE2P95j0bOr1okKGoAVk1Co1A7msSkQGDBIn+UxnWh QWzA== 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=i7fc++t9OiGO5sKcCaBqgJTw5o3WzLwe3yPFeZ6UxHE=; fh=KmnYBsRWNkCCAO5vwS3ymPjHhjQaOsp4w76XQ/tMPd8=; b=e5/0E66KLIXc+3i1mQAsjQjpqcMSyJvUHJBY3kGf6IvJlLJQGLTS/kQHl0PBgUnjJZ FldrCt8qEcrkTcsSh6o6bqL5KdkAAdkWhlw3bTOTuVJxEqD90Hv/faEuR/ldDybdgX5M 7y6XIh7iwLtPZoTu+6MGVWaD3lrUpWXsg+hZifze0aJzwoTaiCXCx6ic5gPCI9pKcitg 9xAsR/Eu/TqR7YSp9HanpX5Fo2U40NRvMDrG/IWGwaIj4CpGLR0FYRzUVEDcV/iI0vIe wKjf73TQeVN4u9toTHo5derkZoWvwt+KpkeEUXt4ibYAW44l8xiVuyVU4Bmgyn1/lAPx 65Qg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SLBTpbOa; 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-47228-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47228-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCVbKAfyNm8b3ychPoiaRl0Wm6WoM9VMkOLS6pjy8P6mDDvJuH8Nc80QXZDmGwZG5JEJLzBiLktGuLLH2yah9hUHj46O+A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ck15-20020a17090afe0f00b00290eec87a13si2046934pjb.17.2024.01.31.14.06.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:06:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47228-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SLBTpbOa; 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-47228-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47228-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4AC4D28E740 for ; Wed, 31 Jan 2024 22:05:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2D483A8CB; Wed, 31 Jan 2024 22:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="SLBTpbOa" 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 72CFC39AFD; Wed, 31 Jan 2024 22:04:48 +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=1706738690; cv=none; b=Z20sPkT940nCrIrSRLxtDZM/oJbtYIZHkrPTvNnZ4vGJFvCt+Uf+ES2X/lcgXGKmBVDasf45tr7wUZp4C/RxoYwzY4r7M1SEZXy0l2YPs5OZ1S03ZQ6243Q5FBfFzV9Ev1lpBu8VIpEXjbS4+VyLjQTZePO0UvhsjOBY8yg3UDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738690; c=relaxed/simple; bh=UlyYLaTBCOQnHnPC0g51OMnV2sy7LcHXFVG1g/sGiv4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TX4dH5X6DpTPFt+ZIrdyBrkBqbrtusaAG7rwcKevK10jnMqeXgaNFPD/wR0ZDrTxXLSJqXQubbqnjJowPsFKXtGWGhtBSbeJYokhWZUiHQL5Vuwo+VcaGxvWXSx4IfRj/NjUcbGOUz5dWNGcCmdrazR05NtcoOkIjM0xU2OSu6Y= 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=SLBTpbOa; 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=1706738686; bh=UlyYLaTBCOQnHnPC0g51OMnV2sy7LcHXFVG1g/sGiv4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SLBTpbOahFRgDA2g4UORL3cKOUb7KPhbu87Goi3Mk93GIealgJaJy5G0Q0997PkZw Z+wtxdSPccPCdBfr9lp2WO3zYeNhR3m9I16lsbkAsyPxNUaIkgA6HDU0ryoBYCf3Dg HLLud3FIU/VSAG4+I92ZmcTLMN9ddTrzQYHyVRlJNOMzzYR2x0N8g5+o21evSnSVlD jL72fnOVoQKWsZnsoZ3vHtkxlvV06umziQXZY7Yxv+6jByUy5oonjhhe3K5Z2VMX7e LHNvml6cC8XLZxbX1o3gKXQGuo3zSHJxxzEvnHum3Ey0vp5sTaEVjKe00iGC2nM7C5 j0UU2NiBUUxNA== 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 D0576378206F; Wed, 31 Jan 2024 22:04:45 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Wed, 31 Jan 2024 17:02:41 -0500 Subject: [PATCH 2/4] selftests: ktap_helpers: Add helper to pass/fail test based on exit code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240131-ktap-sh-helpers-extend-v1-2-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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789645308524536785 X-GMAIL-MSGID: 1789645308524536785 Similar to the C counterpart, add a helper function that runs a command and passes or fails the test based on the result. Signed-off-by: Nícolas F. R. A. Prado --- tools/testing/selftests/kselftest/ktap_helpers.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index ecc1413c22cd..29107924f5c2 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -76,6 +76,17 @@ ktap_test_fail() { KTAP_CNT_FAIL=$((KTAP_CNT_FAIL+1)) } +ktap_test_result() { + description="$1" + shift + + if $@; then + ktap_test_pass "$description" + else + ktap_test_fail "$description" + fi +} + ktap_print_totals() { echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0" } From patchwork Wed Jan 31 22:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 194988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp59508dyc; Wed, 31 Jan 2024 14:21:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhXquxBRIUBj4T1FyYwZ8xhG8cCwo2SNvSRuakfZKXMl3dP79t3Ln4RNG6y2ikfdFGWKe8 X-Received: by 2002:a05:6a20:4c27:b0:19c:2a8d:8b75 with SMTP id fm39-20020a056a204c2700b0019c2a8d8b75mr327447pzb.28.1706739686401; Wed, 31 Jan 2024 14:21:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706739686; cv=pass; d=google.com; s=arc-20160816; b=E4d1fu7wcUZEmWj/geunro0DSHg5yxwBs0hCFxBzh4NZ+zMbfI2Kg6naRDHEZNX5Am ViDwkFKsAAzMYUxUGQFqEEPlUwzj8zq67T6YLmoB3MZj43QwepktNf8Of10KP3Mr46kf P2t3TsK42tOoEi9tnTyfng4ufHFClPiNEUF7PX9EYRototZgf9LpAy7SwbQY98L8CMoL PsonnSrE3jw1hRYhA5fOz+U+ew/VuDU375i1gEV5hWE4LKa+9fHgqrvrlBHgzfWqbwwj BXX3Hyk6+K3hUrYpbYrW4dd9kb1DX3g+5PAfDj030aDHzpFUwjuhs3ku8iImKYBQfSuN c3lA== 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=qBxx+/qSHlX73p2ExbQpYc2eXgqbksKGLMsLqfDLPR4=; fh=b/Vb9A6gzmpv/f+HM3cL4eTMq8yvpqrtgaJ1HbubhTM=; b=BLthQzsbIH7QN33bBfqCFMXnbeoa1evVgkOqvROwNv8XDUxdzA5fYbbLVmJAXksnRr GtgIbESlytbkWH6srml4rtT/C4Et6VDCMsrtYcjM9PVr1jtrqoiZ8D7ZbsvvRStHcUIB v/Snc4UtGwgDDKvpbcPsVLQ/gUOneP2kz4dJ1yrRnrXEIaPZX3pItxW8oDAijYnWM+oR ms/wl4I5B2CItZxZ1Z+G8QVurpK2DuiH+p6+QtXs8erF40+X9qrkxAhG7/YIvySVp7bP Xan3sf8jKrtx4s6Hf95pYYV8MzXGLDPfSdbT8bBuWCOGF+XI0D2gwBd62s7mCaJt3Aya lX8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aImREWYd; 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-47229-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47229-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCVh3gjXp8BCrOEE8ATt8iZRWoQcgD632rrFNijn8qaRwx6UqfRF6C7B0ZJmog32JKghk8NasfTa3M+rMCQl7hweXCSmDg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v15-20020aa7850f000000b006dd984fcea1si10463256pfn.337.2024.01.31.14.21.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:21:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47229-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aImREWYd; 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-47229-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47229-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F10F5B261F6 for ; Wed, 31 Jan 2024 22:06:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80B593A8EC; Wed, 31 Jan 2024 22:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="aImREWYd" 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 3BA9C3A1AB; Wed, 31 Jan 2024 22:04:49 +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=1706738691; cv=none; b=pNXlYhkL8lSrPA37GJV+YJBRW+VZytUp9bRXIaet+XAjy9U/JfCIDA/pRHQAtDZRFAK5JUlL3354Yy2QyPqPY/PX7Q7jnFVxIqYd6Mr73o/r6Z5IUQkJTakG8JWVRG8Mi6g6oSCiZLmHcL4y12HnXjPnIrrIIbLI7m2nYDaLsNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738691; c=relaxed/simple; bh=ppHfbf9qGqvGLoKdV8hXyPGwjYwRrEFpDWQkMI0RS/Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dtw8PWEM+51yc0XbFsaKWHAq9uUiJww6S7wBZMknu88v1LnNnGfh1LdbO12XSPjyAOZKwsL5XrHcjeF7rCeoLoFFYO9Rig6vh5MrHbapXXwaA09680V3Fv6kqgeIGax5w8KVgxndDyymK3hdSHMK9o1e7F67X5QhLjwoESLA37Y= 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=aImREWYd; 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=1706738688; bh=ppHfbf9qGqvGLoKdV8hXyPGwjYwRrEFpDWQkMI0RS/Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aImREWYd/iXeOoZvTIRwYZeAqDtmwpg/dRn+p8kBsTwKT64NB3moS/b79jXi+cQk0 OdwQdJSEUFX2MM/USzRpnkw0t/RuShOOIXmakPI4qPqpKoWdTaZoE6/4CtafaRHFds rDSVbWoooMZh6WkqbM1zNYHFdp6xQ18iHXRZ/8JbYm2z4ojCx8EVme7V7DVhjEfQKZ hN6N0n6o0/mOSe+kcEtrV6WHEawuozYdrwKH8HGFQy+uFjfgt0t1AN+nsAZkY4kZ6+ dh+0KsYRaB7vOeb0DoV/NZpri1Qj28qt3AaRlaRH6zzx6FTe9Ew8DfYtc391cMMBcI +pt66XoatbaYw== 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 2961C3782074; Wed, 31 Jan 2024 22:04:47 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Wed, 31 Jan 2024 17:02:42 -0500 Subject: [PATCH 3/4] selftests: ktap_helpers: Add a helper to abort the test Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240131-ktap-sh-helpers-extend-v1-3-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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789646272898318275 X-GMAIL-MSGID: 1789646272898318275 Similar to the C counterpart, add a helper function to abort the remainder of the test. Signed-off-by: Nícolas F. R. A. Prado --- tools/testing/selftests/kselftest/ktap_helpers.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index 29107924f5c2..87f93c6900c5 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -87,6 +87,13 @@ ktap_test_result() { fi } +ktap_exit_fail_msg() { + echo "Bail out! " $@ + ktap_print_totals + + exit "$KSFT_FAIL" +} + ktap_print_totals() { echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0" } From patchwork Wed Jan 31 22:02:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 194989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp59614dyc; Wed, 31 Jan 2024 14:21:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiEzOXSSbr6DBLm0it+OTT8/D7V/l3ohvo6/c2lHavhHQWpYbHs1EFhbqgJ7MF2b32U4oa X-Received: by 2002:a05:6820:1d8c:b0:59a:12e1:c3c3 with SMTP id cw12-20020a0568201d8c00b0059a12e1c3c3mr3002975oob.4.1706739699972; Wed, 31 Jan 2024 14:21:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706739699; cv=pass; d=google.com; s=arc-20160816; b=rGQP4Aexzw9x6teMySLCe298ID4jXC1sZOVdNSDmf3NAYTa8HISQnS/Hlef4GoNeVU tyPBIsAOHSWYm9GTuQwH+XHfP8FAhryGts0Mub7RRmz5ngRzXAdR9bHAMboS35uDw3TR yPAQmmNbzenOi0Rqv5dnxuPJe0XI7L1s6stLy6YYNhdnJ5zVlGvi8jrma3TtPqk6r+YC SoRujQl6qy7mFWiytqB5x8j3LS71zR5/czEh2PRhUbhuK5Kta77KSZNZfVTKq+baNJbH +usfvVFgkiEzbymq85VOuh6c/36YD6hZcUZeljPobau+g5KUbWWkg7qf9KyUMEbQe5QW 7DyQ== 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=MxeZktAyNN2YBvoaOgcDSofbHpEIyPNhJE7nRNOARUY=; b=TeBd0ebMh5PV1ewFV0/HjOZc7Dzk4+5fNnJokP5qrdmt5Qde8f2oTl6cpJaFe5nxSs ryR26XuaKqI0P3nS6hrM91RrYLgirSeTg/2ckRLH/SsVuTe01PcDvC15jAuDp8cDNMmp 4gN/SnTpfi3MxhD8h5WHqduAmCCJJ1wIFU0hjs31fJ3S2VGoSV7qTWTL7DkW+C7riRK1 j3po3IGehDQetlzcsia8/2AnmN4v73tWZcEWI8pW1SUvUkLGXWmMThj9g3EqsObvV1hm 0Vog06xKuipdVpLjWH256oU1rB96I654OWizRaKoitRD8EUzSnDhdqT1EMzbU0lPUdw6 UmOA==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47230-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCXZaxdminf3hmEm4zc8Q3V3+HSVT3b64X1kIBSymnErW/xZOh23yo6bxcxMg+o2WQyfS2/o/v0YjBTsgezX5jBolmX7bA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n186-20020a6327c3000000b005d8bb0cd292si8340604pgn.797.2024.01.31.14.21.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47230-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47230-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 39E0DB287DE for ; Wed, 31 Jan 2024 22:06:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C80883AC08; Wed, 31 Jan 2024 22:04:55 +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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= 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 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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789646287367920016 X-GMAIL-MSGID: 1789646287367920016 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" }