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: 13580821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C25CC54E4A for ; Mon, 4 Mar 2024 15:59:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48FE86B0080; Mon, 4 Mar 2024 10:59:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4400D6B0081; Mon, 4 Mar 2024 10:59:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32EC56B0082; Mon, 4 Mar 2024 10:59:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 243EB6B0080 for ; Mon, 4 Mar 2024 10:59:20 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D00ABA103B for ; Mon, 4 Mar 2024 15:59:19 +0000 (UTC) X-FDA: 81859816038.26.5B3E059 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf11.hostedemail.com (Postfix) with ESMTP id 2E0304000A for ; Mon, 4 Mar 2024 15:59:17 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Ic2QKeqC; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf11.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709567958; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=uHeCw6yfcJYTOU9ieSZ5STUfFs4EL/lIE8x96JBswcM=; b=zdeJ+YiKPzpYlfgMn1JsGxG6g710dNfpEo3VHrwnn2tivz0ZQU4ETGm9RFuM1H414U0Rru xB26vE44x526ni1CTNEil7N04nePvGpR/GDr9eJj2xNStj0KEgvYKui31DGH+CYmc2ZJpQ xOs8795/M2Zn0447L8KwcYHUxrAbFJs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Ic2QKeqC; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf11.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709567958; a=rsa-sha256; cv=none; b=ATHhs5OvUuzS8nxTTYuc9jhMHBrUI9i7Fq/QSBjVHHKV8gK+kfYkS/KZVLqrV8lKHG5fLv jJM/gIoEWEakMn9A43ce2qDYU9v2mWWoMa4XXmYsAF5qa9OBzbmPjQbL/MK8IIR5/7Zq39 P2m7ff0NydZYds234AH1Vb9LtYdI8vQ= 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 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2E0304000A X-Stat-Signature: be8aw9nxctt8izne93cfgwadddfswaak X-HE-Tag: 1709567957-670728 X-HE-Meta: U2FsdGVkX1+hOBQTBR31ypCbyeILY1m4UAAkUS8eSDZe0kvskWKw1QqbEKt6Tisl8YSvUUuCECeLbq4rZgi7aF7YoSnjeqIWRielqT6kkZDVM/K1go8/Bfi3qaGjqwpD4Y8OH1MCVjKfXk/c0Zo5sbjkZ/9+PplLiZXYCIxwn4BZqK/DNExspzR1+z8d+vMmf8M0eC+biBCenx2EYFLsRSQq1qh5I23YpCh0J+2kq0pwfYyp9UxFwPs1/RvtB/EpN4NwwFB8Z3Qrq0sLL2FlPXBKZ0oekeMAlUt74jQf3bkRjWrtj8PfYJ0NW2Q/501D/8tWw9xejmv5kxuBS27I7icgx9bXRw6xr/1m145GJ3esFPJ/Upd6VJ3fmuzKH3PHM9Dh9B5m8sj/sALvcmt7JusL9ge6yJLnup9sGFv82/+LorWgmqlIetvaxjouwnx4lbSxBU339QyQPkaM90j7RZyAwq/WZlbkfdMYDZqrdrI2HEsVWWvq1QRB4CCCIQfAcvFCaBLgquoaze2Qo/1cz/MlitJ6LRDzg4k9l4UYlBI0wAb3QSLFwB0LGFWgHAroWyByygIkpXGHKwTi26TVN/Mhw0q7VR5Bln8z7svHCtcZuwvRlfYgXd62teeI6pbFyabl4sgEJDIvUlYDzWarxuE2bkCxIiL+f0SjMG8RBEeXHu0zsviXsDrC05GY3lM+ZqKDCaf5XD+Sxo2arAe286vb5JKgckQqpbv/RLvlnZ2JuRJc+g7ovl+O/uTwFuskKp2diR50f5An5aCuAnK5O8PWCmTrk2YDEitOpz9kpWx7Jj7Itfi9jGDOwFpUfeeUbvZPo01gvmvJaAnwJPe/OilkuAz/o8bH5ItCNpxJCHzeZ9qGmD1TqeG4SfD307JFUa/F7yL6hcMRf4uQ2hBgFlazr7SvrZrcVUVyGR7Qt/tPN0REyHGCRx491W6tWP+X X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Reviewed-by: Kees Cook --- 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))