public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 05/12] selftests/mm: fix invocation of tests that are run via shell scripts
Date: Fri, 2 Jun 2023 17:36:09 -0400	[thread overview]
Message-ID: <ZHpgybHDDAMFsADT@x1n> (raw)
In-Reply-To: <e31f1411-1986-c25d-af74-05ad73a53c8d@nvidia.com>

On Fri, Jun 02, 2023 at 12:19:17PM -0700, John Hubbard wrote:
> On 6/2/23 08:34, Peter Xu wrote:
> > On Thu, Jun 01, 2023 at 06:33:51PM -0700, John Hubbard wrote:
> > > We cannot depend upon git to reliably retain the executable bit on shell
> > > scripts, or so I was told several years ago while working on this same
> > > run_vmtests.sh script. And sure enough, things such as test_hmm.sh are
> > > lately failing to run, due to lacking execute permissions.
> > > 
> > > A nice clean way to fix this would have been to use TEST_PROGS instead
> > > of TEST_FILES for the .sh scripts here. That tells the selftest
> > > framework to run these (and emit a warning if the files are not
> > > executable, but still run them anyway).
> > > 
> > > Unfortunately, run_vmtests.sh has its own run_test() routine, which does
> > > *not* do the right thing for shell scripts.
> > > 
> > > Fix this by explicitly adding "bash" to each of the shell script
> > > invocations. Leave fixing the overall approach to another day.
> > 
> > Is it possible someone just doesn't have "bash" at all?  I used to only use
> 
> Well, maybe [1]. But that someone won't be running these tests as-is, because
> the tests explicitly require bash, even before this patch.
> 
> > "sh" without bash installed I think, but that was not on Linux, so I'm not
> > sure how much that applies..
> 
> sh invocations are for when you want to express that this script should
> avoid using bash-specific things, in order to ensure portability to
> other environments.
> 
> But here, the run_vmtests.sh file requires bash already, as per the
> first line:
> 
>     #!/bin/bash
> 
> ...which is ultimately why I decided to use bash, rather than sh here.

That one can be easily override with $XXX run_vmtests.sh, hard-coded "bash"
in Makefiles can't, afaiu.

> 
> > 
> > Maybe use $(SHELL)?  I saw a bunch of usage in the tree too.
> > 
> 
> That's more of a Makefile construct that you are seeing, and only in a
> few odd Makefiles. Recall that in Make, $(SHELL) has the same effect
> that ${SHELL} has in bash/sh, by the way: dereferencing a variable.
> 
> And Make's "$(shell ...)" command is what is normally used to *run* a
> shell command, in the kernel's build system.
> 
> Having said all that, I will take a quick look at what it would take
> to shift over to the selftest framework's run_test() instead, in
> order to avoid this ugly "fix".

Just to mention that I was not talking about $(shell ...), but the
environment var $(SHELL), or "env | grep SHELL".

Please feel free to have a look at tools/perf/arch/x86/Makefile.

Thanks,

-- 
Peter Xu


  reply	other threads:[~2023-06-02 21:37 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02  1:33 [PATCH 00/12] A minor flurry of selftest/mm fixes John Hubbard
2023-06-02  1:33 ` [PATCH 01/12] selftests/mm: fix uffd-stress unused function warning John Hubbard
2023-06-02  9:58   ` David Hildenbrand
2023-06-02 15:25   ` Peter Xu
2023-06-02  1:33 ` [PATCH 02/12] selftests/mm: fix unused variable warning in hugetlb-madvise.c John Hubbard
2023-06-02 10:01   ` David Hildenbrand
2023-06-02 18:38     ` John Hubbard
2023-06-02  1:33 ` [PATCH 03/12] selftests/mm: fix unused variable warning in migration.c John Hubbard
2023-06-02 10:02   ` David Hildenbrand
2023-06-02 18:39     ` John Hubbard
2023-06-02  1:33 ` [PATCH 04/12] selftests/mm: fix a char* assignment in mlock2-tests.c John Hubbard
2023-06-02 10:04   ` David Hildenbrand
2023-06-02 15:24     ` Peter Xu
2023-06-02 18:52       ` John Hubbard
2023-06-05 15:38         ` Peter Xu
2023-06-05 18:45           ` John Hubbard
2023-06-02  1:33 ` [PATCH 05/12] selftests/mm: fix invocation of tests that are run via shell scripts John Hubbard
2023-06-02 10:05   ` David Hildenbrand
2023-06-02 20:38     ` John Hubbard
2023-06-02 15:34   ` Peter Xu
2023-06-02 19:19     ` John Hubbard
2023-06-02 21:36       ` Peter Xu [this message]
2023-06-02 21:46         ` John Hubbard
2023-06-02  1:33 ` [PATCH 06/12] selftests/mm: .gitignore: add mkdirty, va_high_addr_switch John Hubbard
2023-06-02 10:06   ` David Hildenbrand
2023-06-02  1:33 ` [PATCH 07/12] selftests/mm: set -Wno-format-security to avoid uffd build warnings John Hubbard
2023-06-02 10:15   ` David Hildenbrand
2023-06-02 21:22     ` John Hubbard
2023-06-02  1:33 ` [PATCH 08/12] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h John Hubbard
2023-06-02 10:16   ` David Hildenbrand
2023-06-02  1:33 ` [PATCH 09/12] selftests/mm: move psize(), pshift() into vm_utils.c John Hubbard
2023-06-02 10:19   ` David Hildenbrand
2023-06-02 21:58     ` John Hubbard
2023-06-02  1:33 ` [PATCH 10/12] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c John Hubbard
2023-06-02 15:59   ` Peter Xu
2023-06-02 22:11     ` John Hubbard
2023-06-02 22:38       ` Peter Xu
2023-06-02 22:52         ` John Hubbard
2023-06-03  0:43           ` John Hubbard
2023-06-03  1:18             ` Peter Xu
2023-06-03  1:39               ` John Hubbard
2023-06-02  1:33 ` [PATCH 11/12] selftests/mm: fix missing UFFDIO_CONTINUE_MODE_WP and similar build failures John Hubbard
2023-06-02 10:23   ` David Hildenbrand
2023-06-02 22:20     ` John Hubbard
2023-06-03  8:27       ` David Hildenbrand
2023-06-03 23:48         ` John Hubbard
2023-06-02 16:25   ` Muhammad Usama Anjum
2023-06-02 22:24     ` John Hubbard
2023-06-02  1:33 ` [PATCH 12/12] selftests/mm: fix uffd-unit-tests.c build failure due to missing MADV_COLLAPSE John Hubbard
2023-06-02 10:23   ` David Hildenbrand
2023-06-02 16:34   ` Muhammad Usama Anjum
2023-06-02 22:26     ` John Hubbard
2023-06-02  9:32 ` [PATCH 00/12] A minor flurry of selftest/mm fixes David Hildenbrand
2023-06-02 17:51   ` John Hubbard

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=ZHpgybHDDAMFsADT@x1n \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nathan@kernel.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