Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp311874lqs; Tue, 5 Mar 2024 02:50:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXX/A9lzX9kg6hGj/nTIgcGVOxTp0QQwYfMFFHS2DQaC8TZ0Bb6lZHpDI8sdlgUAhRiSVh48/ol1xrcxwobt2Ug5zKmDHOdpfKH87rldA== X-Google-Smtp-Source: AGHT+IF+aV5zRHJRmHwh9w3zBV4p5tJha45qvoyB9pNstAigGA+XsLqxFq0XqhEXzPX3XMXM0hd4 X-Received: by 2002:a05:6870:7a8:b0:21f:2a0:17b8 with SMTP id en40-20020a05687007a800b0021f02a017b8mr1535388oab.6.1709635806225; Tue, 05 Mar 2024 02:50:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709635806; cv=pass; d=google.com; s=arc-20160816; b=nHbE66SCax1dFoNu7VLSfrpzedAYUUGq3f74fl64Qz9cFJaqwccQ5FDIFLKhSzFYsd q8qw5YZoOdcHQZj0Qgw9QjYK+S6c+C8jzieuuMeo0zer9UwbVhvp1zVOl20Wh4bHiPDT 9InKSGeTMbGvfrOpBkyph0EYxnRFAzTEjqlmZZvztH3GKBtXa5P7bebvS+T5tmd7F3QF zglLSrYLZam8yboemZqIR7uj04vCS6IGuWEhJ0oxu0DOvFD4sg7vhDRSz4Kg49IRxy+n mlr//I/25PoryA3HubBZsH0pGb4DiIHm8uBvZON5Xqi7lesFHVMYd6HSTmLE2/QbmwLR LAKg== 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=NsHf3LpBigcWlPBHnHK/MZlKokEq2m019fo/U/zc0NA=; fh=gM1fTaWoK9TL7webZ8yB3tcO8X47vwS7DNlJ3C0B/Lk=; b=zBMtlxHEtoGXB0Vc3xNBramLonU7HboLuU/ZeAz7wW0hshkLx0JAtAGETnnXYCEOiF PnyOIRlFAZfrXSWmCXVpxqSuCS4L+1CaGUyw7YOqfWTIvlJ9r4JeuUVLLgUNi5n963fw +t9/eKNqfolAqJM2uS4+ZNBnXbbflXvypSvsOpzJwj+zANwbnhWYVs0reBR5wlw9mU0w kqEXZZzoggCWQQ/aq4XeJksc+V06iDxo7mCk0Sz+FAF/nJCHuvVH8gTEF+5uzLtmTkzg 8dKBU2I7yoD1FCnfIRSW0CQkdSrcpYnZCKkfNDj4umwGSijMeArK8JriAeyBS7ZcEiXn w3kA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L5MpYPos; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92161-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j32-20020a635520000000b005dc918631dfsi10010874pgb.122.2024.03.05.02.50.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 02:50:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92161-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=L5MpYPos; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92161-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 D9EA1285534 for ; Tue, 5 Mar 2024 10:50:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B92125CDF9; Tue, 5 Mar 2024 10:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L5MpYPos" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D76405CDE2; Tue, 5 Mar 2024 10:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635374; cv=none; b=OMJSFxHLlUdqOzqAZyPjfg87jLR+yGxTnyKhM0DX8Bnaf4OitZK8KX1Lx2adsao9qQukDcJT2q+DSwbOEmBHYgnEwGgOBqHW6/ZF06jpUqx4uxTyPxz7ogjWmc+VnRYvaJunJSJeNhQ3KE/hs9DzbyEScoRePYtSqTdZrwRAo/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635374; c=relaxed/simple; bh=JN2dNESh/y3tfb0TsFQ2avl51emLgu5m25nFtJpTifo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pB26cyLLorLgx62ihAGa3xB7lTeUooD8V0U/9kLRTD2327s45vBKYGPnMQ7xEQv/Vtt3lG4dLkd2OL8E3Rs9e3t7U3JwZjQ6bMAHPU8J+BlDzOcD0c4ew9IlgDMNM6qG1fTAxUzwAdm07cmMA94n27QNbo00PYZ/YibK7jaepYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L5MpYPos; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6016C433C7; Tue, 5 Mar 2024 10:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709635373; bh=JN2dNESh/y3tfb0TsFQ2avl51emLgu5m25nFtJpTifo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=L5MpYPosyRXNolZOet8a+ciMnpda+ZzNAs9DfQSQ/qlwcWSm5kqw+QIlk7EiAIiLZ kw3v27npw2QhlXWcZeQjA0uIqDlT5L5Td9JZrJpIiajkVHs88KA4DfINqG/Vey3nif hRthsTXXSYlYyauk8Yme94l5Sb0guziUfgzPAxF01IqA91r8+EVnXHmd/qykgYIZuZ agmABV/uFoGztuv97AwtpwH+XXWfTMyCxNI1FwGn0Vmd5djQk17Z59ED18Xe1ueKhL VB0w9HOO0a3CbFkflifWVKtFRsNUUQXQirPTTwdk1o30FuiA6ukVztEFm47vCN/twd vfioCAuroaKcQ== From: "Matthieu Baerts (NGI0)" Date: Tue, 05 Mar 2024 11:42:33 +0100 Subject: [PATCH net-next 03/13] selftests: mptcp: add mptcp_lib_check_output helper 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: 7bit Message-Id: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-3-66618ea5504e@kernel.org> References: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> In-Reply-To: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1473; i=matttbe@kernel.org; h=from:subject:message-id; bh=nZs0x809wzr+eJddUt9MlJGJF47PT8cW7Q1w0vMKvSs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl5vccRBX23YStuLEegcwd5kODJJ0cB6NBjHla5 hSM+45062yJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeb3HAAKCRD2t4JPQmmg cwkSEAC7l+udkR6ZJEU8Uc0QWmX9JHZO+S59qOkADmlikuTekT+1y1xstVxwn3eEp+HU85aA9ti YB9UEIeLGl7pPR7bG/CJxwSCvsLBFcbfQIc1e0g8hxgxW03qA7H35FqRChb9Q5rLMW+IlTp7Mcw Bo9euarfevIHqhScSJliohAxv/kXhxACF5P5uZupd3kHbKDiw6bmmYEVIKv64goTfpLXyKXKlt2 NM8kqnaZbwAYAB0OT8ADAleCIncBvHFP/3MUj55r4OWXVFE6Ht0wWw8g+bd9KYtpxUJT+2FY/iH m8KYnwL684jNoufB4kHked6PyOQziJge64xBhmHBUWoSb+vL3ffXjmVnT4ekU5NebbGTFC4vXjY ss9K75epheEiZj6P/vtisHagfuY3QBkQRj4sOWoC5J30Z9fWZ2mYwpEOLLcIAWoiN3qJjU9ah57 /mAtlAVnCTLJvyzQXWu39wo4Xpz3/17GVoSkIZ26xWPk5VitVYNcEbTH06IEip4UktiXMUgG1r2 Urd4X7JdcOUdXbksJAe5IginpdN9STEQN7X+n34a41BXlROGFnC72au2nUpIKqYV825p8sv7zUR Ss4bqNtA/SVvc+NFm7Brdr/dtrB65dj9ucyRTJHl4TPpVbL1bW8vYSi73cCbaLUR9tXw8ePZiJE cLXluGV2PUyY+xw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang Extract the main part of check() in pm_netlink.sh into a new helper named mptcp_lib_check_output in mptcp_lib.sh. This helper will be used for userspace dump addresses tests. Co-developed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index b1fe354cfe96..ed86bb0bab49 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -373,3 +373,26 @@ mptcp_lib_check_tools() { esac done } + +mptcp_lib_check_output() { + local err="${1}" + local cmd="${2}" + local expected="${3}" + local cmd_ret=0 + local out + + if ! out=$(${cmd} 2>"${err}"); then + cmd_ret=${?} + fi + + if [ ${cmd_ret} -ne 0 ]; then + mptcp_lib_print_err "[FAIL] command execution '${cmd}' stderr" + cat "${err}" + return 2 + elif [ "${out}" = "${expected}" ]; then + return 0 + else + mptcp_lib_print_err "[FAIL] expected '${expected}' got '${out}'" + return 1 + fi +} -- 2.43.0