Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1946753rdb; Wed, 31 Jan 2024 14:20:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGGjD0RRmpQ8k7zHYkFagZivoQ/mz73jUqEAP9GPlnS7kcBe8751nup3QlABX8jqgTR7tH X-Received: by 2002:a05:6a20:3c91:b0:19c:7672:af4f with SMTP id b17-20020a056a203c9100b0019c7672af4fmr3427230pzj.61.1706739617001; Wed, 31 Jan 2024 14:20:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706739616; cv=pass; d=google.com; s=arc-20160816; b=VZiqQMcOoTZD8YczQG+xd1F/TNUVhxhDDYPrnwecViG1VyiFDh/liQMWcJuMPAOBO8 CJj3sSmf0nBsTj49q94Dj2wFJvsWN5v7a6vc31whbwRyMF6eeI+FJlHEgConHbmO9sR+ Ga2CSoCAF69Hx8owZ1gMnFzCmPoOGRhcahELIla8Vitz2tOgj8mx6vsabYAvHY9Da1WE bO8RkYA24rZBv9OGEN+QG7woZ+ULsGuaO0kb+DF8OQ8/Ol2XzPuhFvxV8lrT42yJ/MTs NfY3AXW9iRPCIc/mr1y4zRpFFyqQGJo3akd0yudOpNewHlBLELzkKE12B1TBV354QKSs AsJA== 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=oUc51RHJUgnpLwW/5WiIGxyj3CloQcll3AaOZTqye6E=; b=a75xu8Ajo1SHwYSfaR83m56oGtKjdllPPlfbAmvnkDlaroEpBj1iaMD7AEvitDGHNp 9OIiqU0D3LrOjTv8lgZN/SOT3ihTxMkJlDvBCs0qLWNFDBG4QZYdW0RaG3hSlITkYf/F UpaIEEHkefpxp03M2CmCeOZkf2TWzZyVE0lfWR2zjKtfnvxdc+mAvWFkjLhgG+LrMQBS N2B2Y84YC584iVJj5GezHNFXZ0QOX6C55NUEU1gCvjHrpovoi9nvj3UljLRjnXM3hRl2 DlZNkJwpCQcQO3+OMT/XC+9NeUKWY8lfE3vKZ9zLcxDLTnu7MxiOrJzgyoisOw+ZcMhe 2rhg==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47228-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; AJvYcCWWpQE9l7vUJnBrHU8ZRBH33qLTS7zvp8p61Z03K7A1Lm7vktle1yBf2Vu9p7ymkHmX8i5JHacAV9OxrcdcUWxtvvMrZ9/JAs4z/FUMEQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d24-20020a656218000000b005d8bb454c27si4264629pgv.446.2024.01.31.14.20.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:20:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47228-linux.lists.archive=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=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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47228-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1653EB24008 for ; Wed, 31 Jan 2024 22:05:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC2913A1C5; Wed, 31 Jan 2024 22:04:50 +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?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= X-Mailer: b4 0.12.4 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" } -- 2.43.0