linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Axel Rasmussen <axelrasmussen@google.com>
Cc: Shuah Khan <shuah@kernel.org>,
	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
Date: Fri, 22 Apr 2022 14:54:56 -0700	[thread overview]
Message-ID: <20220422145456.1e9f22220b1ad502aa56628d@linux-foundation.org> (raw)
In-Reply-To: <20220421224928.1848230-1-axelrasmussen@google.com>

On Thu, 21 Apr 2022 15:49:27 -0700 Axel Rasmussen <axelrasmussen@google.com> 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 <axelrasmussen@google.com>
> ---
>  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 "-----------------"
_



  parent reply	other threads:[~2022-04-22 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 22:49 Axel Rasmussen
2022-04-21 22:49 ` [PATCH 2/2] selftests: vm: fix shellcheck warnings in run_vmtests.sh Axel Rasmussen
2022-04-22 21:54 ` Andrew Morton [this message]
2022-04-22 22:06   ` [PATCH 1/2] selftests: vm: refactor run_vmtests.sh to reduce boilerplate Axel Rasmussen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220422145456.1e9f22220b1ad502aa56628d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox