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 86374C433EF for ; Fri, 22 Apr 2022 22:07:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E047E6B0073; Fri, 22 Apr 2022 18:07:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1226B0074; Fri, 22 Apr 2022 18:07:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C50DB6B0075; Fri, 22 Apr 2022 18:07:27 -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 B34316B0073 for ; Fri, 22 Apr 2022 18:07:27 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 8775B80DF3 for ; Fri, 22 Apr 2022 22:07:27 +0000 (UTC) X-FDA: 79385902134.22.4F81C96 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by imf15.hostedemail.com (Postfix) with ESMTP id 4C576A0027 for ; Fri, 22 Apr 2022 22:07:24 +0000 (UTC) Received: by mail-io1-f44.google.com with SMTP id y85so10028603iof.3 for ; Fri, 22 Apr 2022 15:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YNHylfXe0yuI3nWPKEVPbWc3jAVoQ9y+hq0D/Seu+wY=; b=lZeOnkWJfpNbpL47S03ry8Z3kSVOMOveo/jk2nJZUCVzPXBnjFkIA5qcm5wo/j9wal dToQD7czP+VDPM078c7el16Q1aZe6nbNwzGDLS1XDXYwpVkpsNJqwJypOn7+to3xdWR8 3oKX/drZ7bmJalyV/wnad3jVhzCaQtJWOxf3Bm0ia6JFeq+CqiBT5j8Fw1M2JQ+4ETxm QXwZMqup8qvcM15nXfDB1he5rvr4FY7BMBGzR2W4HvnyM4XtqFs6HzlCI7+q84UnMcKm 6XhvjRcKaCUidgoN7Z7ZOSeAKGYbwmIvKM8UEM2menTjD9cXKxT3sYopxGDu0HM62RIb sEPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YNHylfXe0yuI3nWPKEVPbWc3jAVoQ9y+hq0D/Seu+wY=; b=T0D74eS7gQN5RE7ktz9hzZY3Ms5z7dcTuM3fZoUzfi4ZQNUL/O1Y+r4aSV38I2Up5t oSziJV710XiG+0Dqld1DUOMFTvFe2gbEI4rFRKAmdh2P+oLd3IOMwweiRsZsgsuDrCfP lRJS2XzxWRnpcLoet5sg/CmCNNDCrI095JMzIiNt/m43OYz2QeMiPE9BSpzdQPKeIySy PuhO4I6otZbfWQ7DkBwDJgZetgx73qdoH8xaok1whc/z9CmVSUC7UpXb+G+nte4F1vyZ F4aojQLbSN7y38Mjc7Pmj3sDRIfh/L7MhH8qaCOntOGjXmcmFa49SwMM+gaMQ4qFGUdx n+PQ== X-Gm-Message-State: AOAM531C7HVfvcnVzedt2a1FFVMQ1woGYIGbqEwRvLynAiKcYKz7MZle gUEc/wy1W0p9qaavL6Z9xJs0SxmM444wyMx6DS/kNA== X-Google-Smtp-Source: ABdhPJwo+ze5pPYHakIgsi/peB9ZO2hJVC0Rs6hOgkZCZ+dBJmbZPicpRp+7K8Orccv9dtaFx0imB8ejZX4fb+fg/c8= X-Received: by 2002:a05:6638:12cb:b0:323:da89:2caa with SMTP id v11-20020a05663812cb00b00323da892caamr2971436jas.314.1650665246174; Fri, 22 Apr 2022 15:07:26 -0700 (PDT) MIME-Version: 1.0 References: <20220421224928.1848230-1-axelrasmussen@google.com> <20220422145456.1e9f22220b1ad502aa56628d@linux-foundation.org> In-Reply-To: <20220422145456.1e9f22220b1ad502aa56628d@linux-foundation.org> From: Axel Rasmussen Date: Fri, 22 Apr 2022 15:06:49 -0700 Message-ID: Subject: Re: [PATCH 1/2] selftests: vm: refactor run_vmtests.sh to reduce boilerplate To: Andrew Morton Cc: Shuah Khan , Linux MM , Linuxkselftest , LKML Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: 1suf8akpqnjsf8y3ngnzq4wkcupra1wd X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4C576A0027 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lZeOnkWJ; spf=pass (imf15.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.44 as permitted sender) smtp.mailfrom=axelrasmussen@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-HE-Tag: 1650665244-192835 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: Since this is a revert, I guess the diff is "backwards" -- meaning, others were proposing *adding* $ksft_skip handling to some tests? if that's the case, then I agree none of those diffs are needed, my change should properly handle $ksft_skip for all tests now and in the future. On Fri, Apr 22, 2022 at 2:55 PM Andrew Morton wrote: > > 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 "-----------------" > _ >