Re: [PATCH v3 5/5] lib/test_sysctl: support testing of sysctl. boot parameter

From: Vlastimil Babka
Date: Mon May 11 2020 - 07:05:29 EST



On 4/27/20 8:39 PM, Luis Chamberlain wrote:
> On Mon, Apr 27, 2020 at 08:04:33PM +0200, Vlastimil Babka wrote:
> Nice, also we could just require
>
> diff --git a/tools/testing/selftests/sysctl/config b/tools/testing/selftests/sysctl/config
> index 6ca14800d755..34461cc99a2b 100644
> --- a/tools/testing/selftests/sysctl/config
> +++ b/tools/testing/selftests/sysctl/config
> @@ -1 +1,3 @@
> CONFIG_TEST_SYSCTL=y
> +CONFIG_IKCONFIG=y
> +CONFIG_IKCONFIG_PROC=y
>
> tools/testing/selftests/firmware/fw_lib.sh then has a kconfig_has()
> which can verify the exact config.

Hmm but it also has a (firmware area specific) fallback for case where
IKCONFIG_PROC doesn't exist. So it's simpler to just keep checking the module
dir, IMHO, as that would be the fallback.

>> +
>> + echo -n "Testing if $TARGET is set to 1 ..."
>> + ORIG=$(cat "${TARGET}")
>
> This would fail if someone uses this script to test an older kernel, and
> the scripts in selftests are supposed to work with older kernels.

Oh, I didn't know that it's supposed to.

> One
> way to address this would be to just see if the file exists first and
> ignore the test if the $SYSCTL directory exists but the file $TARGET
> does not.
>
> For now we can just do this:
>
> if [ ! -d $TARGET ]; then
> echo "Skipping test for $TARGET as it is not present ..."
> return 0
> fi

OK, just the -d test needs to be fixed :) Andrew can you please apply:

----8<----