From mboxrd@z Thu Jan 1 00:00:00 1970 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 8D770C433F5 for ; Fri, 22 Apr 2022 21:55:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EFE56B0073; Fri, 22 Apr 2022 17:55:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09FAA6B0074; Fri, 22 Apr 2022 17:55:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA92A6B0075; Fri, 22 Apr 2022 17:55:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id DE5FA6B0073 for ; Fri, 22 Apr 2022 17:55:00 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BF330FC3 for ; Fri, 22 Apr 2022 21:55:00 +0000 (UTC) X-FDA: 79385870760.28.A8D7C69 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf31.hostedemail.com (Postfix) with ESMTP id F2FA62002C for ; Fri, 22 Apr 2022 21:54:55 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45AECB82A42; Fri, 22 Apr 2022 21:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4A48C385A4; Fri, 22 Apr 2022 21:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1650664497; bh=BHXV0YOJHr2WM2YchlEQurnNcQ9G+9t5xI2geAAdRgY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iGGqtTPs/Shjsut4v8AhxTjmcP0yty7k0GpImOSyAPTRxxD261KW9ru192wle1d/g adYtTm/zXG/dElLaOgX66EwhRPAZb0wlWlW9e0weRuVHMTfsNlfjyoW0DybS5Q4tol pXMW/S6T5UanpnUXjYtXemKFzxfpHNEHTX/b0vV4= Date: Fri, 22 Apr 2022 14:54:56 -0700 From: Andrew Morton To: Axel Rasmussen Cc: Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] selftests: vm: refactor run_vmtests.sh to reduce boilerplate Message-Id: <20220422145456.1e9f22220b1ad502aa56628d@linux-foundation.org> In-Reply-To: <20220421224928.1848230-1-axelrasmussen@google.com> References: <20220421224928.1848230-1-axelrasmussen@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: F2FA62002C X-Stat-Signature: ga5eqe3radi5xiwg69sp3uix34gq7xcg Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=iGGqtTPs; dmarc=none; spf=pass (imf31.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1650664495-616813 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 21 Apr 2022 15:49:27 -0700 Axel Rasmussen wrote: > Previously, each test printed out its own header, dealt with its own > return code, etc. By just putting this standard stuff in a function, we > can delete > 300 lines from the script. > > This also makes adding future tests easier. And, it gets rid of various > inconsistencies that already exist: > > - Some tests correctly deal with ksft_skip, but others don't. > - Some tests just print the executable name, others print arguments, and > yet others print some comment in the header. > - Most tests print out a header with two separator lines, but not the > HMM smoke test or the memfd_secret test, which only print one. > - We had a redundant "exit" at the end, with all the boilerplate it's an > easy oversight. > > Signed-off-by: Axel Rasmussen > --- > tools/testing/selftests/vm/run_vmtests.sh | 459 +++------------------- > 1 file changed, 64 insertions(+), 395 deletions(-) Well that's nice. There were a bunch of changes already pending in this file but I think with this patch, they become unneeded. So I just reverted them all. please double check? --- a/tools/testing/selftests/vm/run_vmtests.sh~revert-1 +++ a/tools/testing/selftests/vm/run_vmtests.sh @@ -162,32 +162,22 @@ echo "---------------------------------- echo "running: gup_test -u # get_user_pages_fast() benchmark" echo "------------------------------------------------------" ./gup_test -u -ret_val=$? - -if [ $ret_val -eq 0 ]; then - echo "[PASS]" -elif [ $ret_val -eq $ksft_skip ]; then - echo "[SKIP]" - exitcode=$ksft_skip -else +if [ $? -ne 0 ]; then echo "[FAIL]" exitcode=1 +else + echo "[PASS]" fi echo "------------------------------------------------------" echo "running: gup_test -a # pin_user_pages_fast() benchmark" echo "------------------------------------------------------" ./gup_test -a -ret_val=$? - -if [ $ret_val -eq 0 ]; then - echo "[PASS]" -elif [ $ret_val -eq $ksft_skip ]; then - echo "[SKIP]" - exitcode=$ksft_skip -else +if [ $? -ne 0 ]; then echo "[FAIL]" exitcode=1 +else + echo "[PASS]" fi echo "------------------------------------------------------------" @@ -195,16 +185,11 @@ echo "# Dump pages 0, 19, and 4096, usin echo "running: gup_test -ct -F 0x1 0 19 0x1000 # dump_page() test" echo "------------------------------------------------------------" ./gup_test -ct -F 0x1 0 19 0x1000 -ret_val=$? - -if [ $ret_val -eq 0 ]; then - echo "[PASS]" -elif [ $ret_val -eq $ksft_skip ]; then - echo "[SKIP]" - exitcode=$ksft_skip -else +if [ $? -ne 0 ]; then echo "[FAIL]" exitcode=1 +else + echo "[PASS]" fi echo "-------------------" @@ -306,16 +291,11 @@ echo "-------------------" echo "running mremap_test" echo "-------------------" ./mremap_test -ret_val=$? - -if [ $ret_val -eq 0 ]; then - echo "[PASS]" -elif [ $ret_val -eq $ksft_skip ]; then - echo "[SKIP]" - exitcode=$ksft_skip -else +if [ $? -ne 0 ]; then echo "[FAIL]" exitcode=1 +else + echo "[PASS]" fi echo "-----------------" _