From patchwork Mon Mar 4 15:59:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 209633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1530206dyc; Mon, 4 Mar 2024 08:25:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUSJvPUy4G1I0f74KIlzZLeD3pWGopT4HiBLUevusaKwf6/EpMpdkHrBPLPA4/RDZmUj1EINHvl7Gi0C+A8n7FkJbUWdQ== X-Google-Smtp-Source: AGHT+IGk4Z63krxzogH+Zl6o3vHOaJzeVUDhxdyXQpVMBdOSzvuAREBAUOy47MH5iGfUFBo+fkB2 X-Received: by 2002:a05:6a20:1584:b0:1a0:fd53:740c with SMTP id h4-20020a056a20158400b001a0fd53740cmr12214407pzj.22.1709569558544; Mon, 04 Mar 2024 08:25:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709569558; cv=pass; d=google.com; s=arc-20160816; b=w6IeB0qLrXK7CqIvvzFSYcHBCWb8wlQt/kxcpav9b2ctL7+0mJFh5rzw2vrROZYixU OnonrjnBpnj8v8NeVJ9n/SXZngQhGU1YznB+btwNgan8TZZLl/lPBuJCx2uHOjPHT64Y 1V/P0omNqzCn3WeLaLA+8ps1dApmiECFn28gsu5BSfBaD343Zw41Jf5mPI/KrPPgHLIh ZxIZY5vBZ5PHp4SyeZhvHOv/JuwpZFE1GCPBkxZNL0xZ4lXRhMdDlN+NMnYadFLuvJht 3SiuRgGX4AIHdnUwOBdSYwExxthlm1sEs+B/PxrZH5ugNdANNFOBFXmezEMNeI4kQodc TIkQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=uHeCw6yfcJYTOU9ieSZ5STUfFs4EL/lIE8x96JBswcM=; fh=kIvWet5rGarCnyuEpkp6O8UZulXxc4w/bHj1na/Uhm4=; b=vJtdPvsLCzyviHRhVGTVirW04Ha6jHDP1k1CH+rutOvnAoz9PXQWlxgGbTwk8cvLpj EkMAf6fZG+FtlUxncx3wk+83BZZfyUFNG1FoJMhixAt+iBxbgP9JUq9SC1OIvIOFd6JW l2Z2ObXcYHzJW5fzrsijmeiO54h5RS4sNQgJrUW8Dd4QD1ES4ZLVJJENyynAa0c8uNSQ xmPdTthySGRgZcZiQCdiG7f6Oo0xDn+DdFgbyRouk91h1Mzl+0MPdWfPI9lwT8nm16VU H61jHx7LD6Oaw23LlS30n1YAd2LhMq4kp5rOhHt+PdSSGBi90vZmmEpi+5PcKy1ggZR9 GWig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Ic2QKeqC; 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-90884-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90884-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d10-20020a63990a000000b005dcbb75b1fdsi8216304pge.218.2024.03.04.08.25.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90884-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=Ic2QKeqC; 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-90884-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90884-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 D3A84B2338C for ; Mon, 4 Mar 2024 15:59:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7354148CDC; Mon, 4 Mar 2024 15:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Ic2QKeqC" 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 59A811B273; Mon, 4 Mar 2024 15:59:18 +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=1709567959; cv=none; b=FkoUSALjyKmjIt44shNiE85tWRIyYhzgxfhsGk6PwR8sT9Idu9CxGSe6BnUCDrSrZu5dXUcF5AaMDrmVAMB/vXyXVkWXNdvhZSCfjSSBIWiqmWKjL1RYTaMMZVhnSAdoNsu+M9Dawa7L5CsLJBy3X1IcgWLotL4BVRtMy7LYILs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709567959; c=relaxed/simple; bh=ZjZh6MK4cK0nPO2xkcbSCU48Cy25SeM0mup4wcmCJx0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=iUQBmHQGC/+N//hpzz6ill+cqw/i/Xh3GMMb05OVMf1MordFaTH1cRsN/E/bYCzdxkyL0+kZBgDgpgp8mLo7Ckw3Xr6oJZjhCLL5hC8lZYtW65td2w3qVGqHUeGpZcpR9981wqLUU/RIoUNoG8E0kVz8J4qSWj6+Quxpvy28c5M= 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=Ic2QKeqC; 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=1709567956; bh=ZjZh6MK4cK0nPO2xkcbSCU48Cy25SeM0mup4wcmCJx0=; h=From:To:Cc:Subject:Date:From; b=Ic2QKeqCWnv2YCtCbqdlmm6TQXqw+vJJ4o9Y/hkzs526iD/Xg6sjTT2v2rfRalK5r E9RIMd9iBKWZlKh4PJXTDUWMAoOt6qrAJvjk+qpQi4TE0Cc/IN3ifJvt38WogftARr cTyMSY/7nqGn60ybvTZgWfZdsjT5qBpMJk/69S9M5JUHwmvOdGH9GkTCVdBmLDfB4E cOIrZCquDjSTNw5Vm6cVjXuOVrJ+/YbfrjHo8bMEvb/itiKb6+LgALQqcypmQ7AfwF FOiYdUEOiwrnOjX9t8VcCWwgPbUcuLCw0ArSnkoj66tIqoAJ2f38jAs8jvzCgpSm7g kxkM1qltBck7g== Received: from localhost.localdomain (broslavsky.collaboradmins.com [68.183.210.73]) (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: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 04BA037820D7; Mon, 4 Mar 2024 15:59:13 +0000 (UTC) From: Muhammad Usama Anjum To: Shuah Khan , Eric Biederman , Kees Cook , Muhammad Usama Anjum Cc: kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] selftests/exec: Add the overall result line accourding to TAP Date: Mon, 4 Mar 2024 20:59:23 +0500 Message-Id: <20240304155928.1818928-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792613609772383831 X-GMAIL-MSGID: 1792613609772383831 The following line is missing from the test's execution. Add it to make it fully TAP conformant: # Totals: pass:27 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/exec/binfmt_script.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/exec/binfmt_script.py b/tools/testing/selftests/exec/binfmt_script.py index 05f94a741c7aa..2c575a2c0eab4 100755 --- a/tools/testing/selftests/exec/binfmt_script.py +++ b/tools/testing/selftests/exec/binfmt_script.py @@ -16,6 +16,8 @@ SIZE=256 NAME_MAX=int(subprocess.check_output(["getconf", "NAME_MAX", "."])) test_num=0 +pass_num=0 +fail_num=0 code='''#!/usr/bin/perl print "Executed interpreter! Args:\n"; @@ -42,7 +44,7 @@ foreach my $a (@ARGV) { # ... def test(name, size, good=True, leading="", root="./", target="/perl", fill="A", arg="", newline="\n", hashbang="#!"): - global test_num, tests, NAME_MAX + global test_num, pass_num, fail_num, tests, NAME_MAX test_num += 1 if test_num > tests: raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)" @@ -80,16 +82,20 @@ def test(name, size, good=True, leading="", root="./", target="/perl", if good: print("ok %d - binfmt_script %s (successful good exec)" % (test_num, name)) + pass_num += 1 else: print("not ok %d - binfmt_script %s succeeded when it should have failed" % (test_num, name)) + fail_num = 1 else: if good: print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)" % (test_num, name, proc.returncode)) + fail_num = 1 else: print("ok %d - binfmt_script %s (correctly failed bad exec)" % (test_num, name)) + pass_num += 1 # Clean up crazy binaries os.unlink(script) @@ -166,6 +172,8 @@ test(name="two-under-trunc-arg", size=int(SIZE/2), arg=" ") test(name="two-under-leading", size=int(SIZE/2), leading=" ") test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ") +print("# Totals: pass:%d fail:%d xfail:0 xpass:0 skip:0 error:0" % (pass_num, fail_num)) + if test_num != tests: raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d" % (test_num, tests)) From patchwork Mon Mar 4 15:59:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 209622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6299:b0:17c:1df7:5ed3 with SMTP id se25csp287585rwb; Mon, 4 Mar 2024 08:07:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWFhuvZFqeoySuCLggDQZNohes3jlJBW8u/siaecMKktb73zfbTDJiRxLCyBqkgaug/X6bCASbduxL0YDhQaXn0AVyuQ== X-Google-Smtp-Source: AGHT+IEjAMVirup5jqQdg+tIMg4ibTdhtTKVZayRnxQBVNeoj65MHvnTlognyXaefLnCisG+vZbO X-Received: by 2002:a17:906:264b:b0:a43:d1a5:e907 with SMTP id i11-20020a170906264b00b00a43d1a5e907mr6251408ejc.58.1709568441560; Mon, 04 Mar 2024 08:07:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568441; cv=pass; d=google.com; s=arc-20160816; b=eC303MpRbN1wo39k10w3oe+DmLbw68JsZEEaZ0g8gZSPLYPZGNsPMoFt0vSmouXWjW /KyP7DP7SWUkdtUNSpfDT85LGMeebQ4+f6QUb7e5JiUVXep5H8IJ0TKETDiLbI14iRQh 48iSORIn5Pe9EoL2vEivBMFCxPEtb2fBz0ycD1xtr3scDSJf1C0EW5t+VMLobhgUVozL +qK2HrxI3wncd3VA6q2rNfTydoeyvjpKkHX2kbXKVow55/PgqWjQauOfXkXkzUXl0IHB GyOY+dxgmh0zqT5CiGwMMxFNne79NWNMExYDr7hrJJnfW0fBbSY8GGeb26ad5mu3m5Bh b/jg== 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=QlAYY2DWT18yifXEUSrja72p7Ld+z3uDQmu3W7C2rk8=; fh=1Jfmq3vZr7PtBvoeUFB4e3RsVLj7M6kTr4UK8fn0TwA=; b=SuUJPuuQ1n3ayD7/sG6ZYP1Ljfl4B8TYlX/hCV+l8MPG7VBRQeLKtotiohD0ZN+Rzd zJA90xHv8zol3z49WlorPLOCkz7WPUGVcJ5SyDOsNETvRxZirL+UOa5BfCSRs+Pa7cvy iOPOLrXXngIcf+G05RjHLOfMiJAatNRWM1qX7ZAl5Zb6dqQ10d5NMbohw+wuRC47UPuE pzs32SgYrM0u+1FHLWixWbO2AaX1jmLehYQ8i6Tl0ERXZLCboLsqTJv/lSqCHHX5kD23 g5dd5sew9HzH9DuLaKx62uqPzooeXwYoD173jNYp8a28MI83jf7f4x6FmkGMLo8f3CxF EzVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="V/ymKtbU"; 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-90885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i20-20020a170906265400b00a3e82455348si4121058ejc.858.2024.03.04.08.07.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:07:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90885-ouuuleilei=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="V/ymKtbU"; 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-90885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90885-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0E6181F23BDC for ; Mon, 4 Mar 2024 15:59:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70774482D4; Mon, 4 Mar 2024 15:59:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="V/ymKtbU" 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 7C4FC1B273; Mon, 4 Mar 2024 15:59:25 +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=1709567967; cv=none; b=sS1P2xgyUFweKoJS0LGBw3XbeVHuhhTLpE9afmtOEdThJReXymTTNRsVvmZ6f8x45s1dQ0wDFWSbEIzCBPrVRYzXI3MdKJZ/r8NnJDLG9bTBzNImCfAGHsl0Pw/bbEs7bSvZiwFJMayxlpqWj4m7DWJpsxCTo6yg2aNs3gC7zPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709567967; c=relaxed/simple; bh=hDJ+1B+zZE31bqNelWnsX1xAb8MS/M4MyzfsBFhvn0g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Vj7XAAj9vrtj/odxcur8MjuD0z3FpYgmCc0076TFesbb69+47ioVeA1oDmNLl+b+qqjgjGcaosFgfgYvCFeri90oOzmcOVnHg29CcXr9Hq9kKf1gGzdBNTJoY/vfHwWp+Hmzye0zfYCaNyo/WUaz6GaNC9udO6FTdlr1y2seNY4= 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=V/ymKtbU; 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=1709567964; bh=hDJ+1B+zZE31bqNelWnsX1xAb8MS/M4MyzfsBFhvn0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/ymKtbUVUuWevduols2PiqD0visrQxCth/3JhrOkjWaLAuxTr5rxoPzc3FBvSxZp zZHjXYn4gPIAxXkAZ4z3X8GvHlVCUut1SeVVLiXMsxfaNyK5xD81+dcd/LYDCPkk5S soBoo+MYi2+OG5twAke5IaDJFVqvc7p02lisrN4W9HWC4IPV7iX071RMrdUWEDTYWn bwwgA3V8a4RBfVc6O7lcgJztC4PrQ1VjJqiR/Frlniw2jHhdekeGHKkZjOKwuS3aRy Z31/kE+ikR8kxkOqG0sUPQ04iIXeV+4Gml/X3rEUn2PC2avw9wsu7uqrlH5pdUjFlO nU2PAjOIIiVoA== Received: from localhost.localdomain (broslavsky.collaboradmins.com [68.183.210.73]) (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: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 8644C37820CB; Mon, 4 Mar 2024 15:59:19 +0000 (UTC) From: Muhammad Usama Anjum To: Eric Biederman , Kees Cook , Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] selftest/exec: conform test to TAP format output Date: Mon, 4 Mar 2024 20:59:24 +0500 Message-Id: <20240304155928.1818928-2-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240304155928.1818928-1-usama.anjum@collabora.com> References: <20240304155928.1818928-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792612438181713642 X-GMAIL-MSGID: 1792612438181713642 Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/exec/load_address.c | 34 +++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tools/testing/selftests/exec/load_address.c b/tools/testing/selftests/exec/load_address.c index d487c2f6a6150..17e3207d34ae7 100644 --- a/tools/testing/selftests/exec/load_address.c +++ b/tools/testing/selftests/exec/load_address.c @@ -5,6 +5,7 @@ #include #include #include +#include "../kselftest.h" struct Statistics { unsigned long long load_address; @@ -41,28 +42,23 @@ int main(int argc, char **argv) unsigned long long misalign; int ret; + ksft_print_header(); + ksft_set_plan(1); + ret = dl_iterate_phdr(ExtractStatistics, &extracted); - if (ret != 1) { - fprintf(stderr, "FAILED\n"); - return 1; - } + if (ret != 1) + ksft_exit_fail_msg("FAILED: dl_iterate_phdr\n"); - if (extracted.alignment == 0) { - fprintf(stderr, "No alignment found\n"); - return 1; - } else if (extracted.alignment & (extracted.alignment - 1)) { - fprintf(stderr, "Alignment is not a power of 2\n"); - return 1; - } + if (extracted.alignment == 0) + ksft_exit_fail_msg("FAILED: No alignment found\n"); + else if (extracted.alignment & (extracted.alignment - 1)) + ksft_exit_fail_msg("FAILED: Alignment is not a power of 2\n"); misalign = extracted.load_address & (extracted.alignment - 1); - if (misalign) { - printf("alignment = %llu, load_address = %llu\n", - extracted.alignment, extracted.load_address); - fprintf(stderr, "FAILED\n"); - return 1; - } + if (misalign) + ksft_exit_fail_msg("FAILED: alignment = %llu, load_address = %llu\n", + extracted.alignment, extracted.load_address); - fprintf(stderr, "PASS\n"); - return 0; + ksft_test_result_pass("Completed\n"); + ksft_finished(); } From patchwork Mon Mar 4 15:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 209625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6299:b0:17c:1df7:5ed3 with SMTP id se25csp289204rwb; Mon, 4 Mar 2024 08:09:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQF/tBGp+7UHTY0kkAwqrYxlGcuDoueGQdEbJJV9d128+NnHcnoYNyyaEH6IVUUu/6ckd3awAVMp+p3YPWUnxBdWJKbQ== X-Google-Smtp-Source: AGHT+IHkKmHZ63MmeGUjYr1cDuc6kW6cSnqF6epH/on56a4Xj3XseccwXb41aC2V9oDb7TgfrRGQ X-Received: by 2002:a17:906:2c0a:b0:a45:4d62:7805 with SMTP id e10-20020a1709062c0a00b00a454d627805mr2002361ejh.50.1709568466814; Mon, 04 Mar 2024 08:07:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568466; cv=pass; d=google.com; s=arc-20160816; b=EvjMIURFbaCHuwmFhAALx5ejTAeAEuF+4rz85fXHam48mBDjlRdJKhCJo4j1HuSCSD x1WBVXjAboSETHrGs/mf0r/HQ0ZIzu1qD2eBh5ia6vqYpzy9/osB+T7P0vsjwTO2xv43 tydCBFf9DTvEPnSbXTis0BmgDV0GiwmrJe4ku7phXSWwdXfN4vj164ufskNYR4aFGOnb pGy6KG7TVp9vHtt3oyoO9TW2ihP5cik/uA8mxHmzwxu7WEXuqTwLTaZ6Xp9+AlQMGz4B BaF/wx+e4ineo2mqTCf0rz3ZqilrQJCHvH5+iO48djfhilo/kZrHqxTSFgdQJ4WLk+Om ZAeg== 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=7c7o/Wu06wTnWl7K+nmSgnzNtSgOafrm4EubGl9SSrg=; fh=1Jfmq3vZr7PtBvoeUFB4e3RsVLj7M6kTr4UK8fn0TwA=; b=LISZIwHJsMv3WwEnbQnl2br9c1r8RnvoOMf026dl95MjrP6ZwGwXj/t0fMtQm1EScM EcgyexJSHiva7Lcv6BWr78hRUBWUkUYvb3p1FvwpWsxpf/z5ePpXgBZWhkNr03e5IQvI 1jqeRe6iFNLP7Ebqf2D+jZPD55nKtcs1F0AXrA/dzAKSRwwNwUiXTllUibhrzgbHuhmL TcEC5HQygnVBIuU6ETD2OGMbEGE43mRypOTZYYbNN9rjmJhvsSCcdjsx2nIuRQ5WTC3w wyIlVVrVhqF9ypD8BmSnnFntqRPpaMhseBO8R1G2ODgVCdI1aDmixDi/NZ+8RfWB6ZPH gtoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="rIV/+q9Q"; 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-90886-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90886-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ec14-20020a170906b6ce00b00a455711ad06si798132ejb.170.2024.03.04.08.07.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:07:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90886-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="rIV/+q9Q"; 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-90886-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90886-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 am.mirrors.kernel.org (Postfix) with ESMTPS id CB5ED1F269B9 for ; Mon, 4 Mar 2024 16:00:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77CDF4CB36; Mon, 4 Mar 2024 15:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="rIV/+q9Q" 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 65AA44C630; Mon, 4 Mar 2024 15:59:34 +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=1709567976; cv=none; b=KDIMecZKBdOFCoH1tB1LoI9vrkgbYMZ8laR/8ZWSY7o4vgULV6C+XcQMANP4t41Kat3nFCXlnINO/VkAn0A+9A3CvsuAgORAezDIdMwOhLywRy0m5W0roFixdvU3+QnmS1QGGw9SXnP01Yc+1L5X6tk8mpKLzWuEGL34p/7uuec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709567976; c=relaxed/simple; bh=kWwhagXSgzGBOzzHe1+SkKphXDZuQxr2VZJ2zSGNr7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N+Zdr5zBUr09DO/N7jyS/HWKl7MIsp8EXMgDjN0htqlsC5Wq4dcdiW/tQT7eLE5OM6G4an9mq2tx0P2Y7Eix5LALjv/zh3HJ7YTRtB0GeEB4V9qfXtlFvq7O7Kwnme17t3LFnDrJGrJZ6ev6V8MRTX+JaV5dS3lZdA9IiLhd1HM= 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=rIV/+q9Q; 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=1709567972; bh=kWwhagXSgzGBOzzHe1+SkKphXDZuQxr2VZJ2zSGNr7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIV/+q9QuURjC8AzXzjygtQmgYWce2d1gTJp7ei1RAGregxwsWFdzbRILE0UdcLKd 88Fqq5uusnT7lSkf6ryw8INw7HHA1mwyhgUapWWjRdrAdQYvXUtjERJlv0G/xJ6JvB 2cUcXz36Xy9fhPAQohalbcgem08UdrxH1P1J952O4sDtQUeE+6ieiSTOi52sgsFFoQ 7dWTaFlRKTdqgv3EztYRiQvkQvBaADzN/5zYlOCkto0W3cBw7LCA1XfE2HSASXsFyL d6E4HHMjmVh/00QERi/PY4PfMBcHzNe+joUirI1yK8TnHMkufKlNi8GnEzqrtXlzh1 yaYxLDe6g+asA== Received: from localhost.localdomain (broslavsky.collaboradmins.com [68.183.210.73]) (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: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 3D72237820CC; Mon, 4 Mar 2024 15:59:26 +0000 (UTC) From: Muhammad Usama Anjum To: Eric Biederman , Kees Cook , Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] selftests/exec: conform test to TAP format output Date: Mon, 4 Mar 2024 20:59:25 +0500 Message-Id: <20240304155928.1818928-3-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240304155928.1818928-1-usama.anjum@collabora.com> References: <20240304155928.1818928-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792612464382777726 X-GMAIL-MSGID: 1792612464382777726 Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. While at it, do minor cleanups like move the declarations of the variables on top of the function. Signed-off-by: Muhammad Usama Anjum --- .../testing/selftests/exec/recursion-depth.c | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/tools/testing/selftests/exec/recursion-depth.c b/tools/testing/selftests/exec/recursion-depth.c index 2dbd5bc45b3ed..b2f37d86a5f62 100644 --- a/tools/testing/selftests/exec/recursion-depth.c +++ b/tools/testing/selftests/exec/recursion-depth.c @@ -23,45 +23,44 @@ #include #include #include +#include "../kselftest.h" int main(void) { + int fd, rv; + + ksft_print_header(); + ksft_set_plan(1); + if (unshare(CLONE_NEWNS) == -1) { if (errno == ENOSYS || errno == EPERM) { - fprintf(stderr, "error: unshare, errno %d\n", errno); - return 4; + ksft_test_result_skip("error: unshare, errno %d\n", errno); + ksft_finished(); } - fprintf(stderr, "error: unshare, errno %d\n", errno); - return 1; - } - if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) == -1) { - fprintf(stderr, "error: mount '/', errno %d\n", errno); - return 1; + ksft_exit_fail_msg("error: unshare, errno %d\n", errno); } + + if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) == -1) + ksft_exit_fail_msg("error: mount '/', errno %d\n", errno); + /* Require "exec" filesystem. */ - if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) { - fprintf(stderr, "error: mount ramfs, errno %d\n", errno); - return 1; - } + if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) + ksft_exit_fail_msg("error: mount ramfs, errno %d\n", errno); #define FILENAME "/tmp/1" - int fd = creat(FILENAME, 0700); - if (fd == -1) { - fprintf(stderr, "error: creat, errno %d\n", errno); - return 1; - } + fd = creat(FILENAME, 0700); + if (fd == -1) + ksft_exit_fail_msg("error: creat, errno %d\n", errno); + #define S "#!" FILENAME "\n" - if (write(fd, S, strlen(S)) != strlen(S)) { - fprintf(stderr, "error: write, errno %d\n", errno); - return 1; - } + if (write(fd, S, strlen(S)) != strlen(S)) + ksft_exit_fail_msg("error: write, errno %d\n", errno); + close(fd); - int rv = execve(FILENAME, NULL, NULL); - if (rv == -1 && errno == ELOOP) { - return 0; - } - fprintf(stderr, "error: execve, rv %d, errno %d\n", rv, errno); - return 1; + rv = execve(FILENAME, NULL, NULL); + ksft_test_result(rv == -1 && errno == ELOOP, + "execve failed as expected (ret %d, errno %d)\n", rv, errno); + ksft_finished(); }