Re: [PATCH 05/12] selftests/mm: fix invocation of tests that are run via shell scripts

From: John Hubbard
Date: Fri Jun 02 2023 - 17:46:28 EST


On 6/2/23 14:36, Peter Xu wrote:
...
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.

Yes, but then you'd have to deal with the rest of the kernel, and bash
is just completely woven into the whole thing. Just in the selftests
alone, there are dozens or hundreds of direct invocations.

$ git grep -w bash | wc -l
1146

$ cd tools/testing/selftests/

$ git grep -w bash | wc -l
560

$ git grep -w bash | grep -v '/bin' | wc -l
113

That ship really has sailed: it's not practical to expect that kind
of portability here.

...
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.

Yes, but that is a *Makefile*. (And only one out of 145, the others do
not use this.) There is no use of SHELL outside of Makefiles, nor in
fact anywhere in the kernel.


thanks,
--
John Hubbard
NVIDIA