linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Orson Zhai <orson.zhai@linaro.org>
To: Shuah Khan <shuah@kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH V3] tools/testing/selftests/sysctl: Add pre-check to the value of writes_strict
Date: Sat, 24 Jun 2017 01:40:50 +0800	[thread overview]
Message-ID: <CAPPenn_cLRFSZbtLGKGHtyh58E_7EYHx5Cv_AGX03rYE_dAh8g@mail.gmail.com> (raw)
In-Reply-To: <1bc754dd-26e0-e88e-7db8-29509c763d69@kernel.org>

On 23 June 2017 at 23:55, Shuah Khan <shuah@kernel.org> wrote:
> Hi Orson,
>
> On 06/22/2017 10:24 PM, Orson Zhai wrote:
>> Sysctl test will fail in some items if the value of /proc/sys/kernel
>> /sysctrl_writes_strict is 0 as the default value in kernel older than v4.5.
>>
>> Make this test more robust and compatible with older kernels by checking and
>> update sysctrl_writes_strict value and restore it when test is done.
>>
>> Signed-off-by: Orson Zhai <orson.zhai@linaro.org>
>> Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
>> Tested-by: Sumit Semwal <sumit.semwal@linaro.org>
>
> This patch failed to apply on linux-kselftest next. Could you please
> rebase and send it.

No problem. I will do that with V4.

Orson

>
> thanks,
> -- Shuah
>
>> ---
>>  tools/testing/selftests/sysctl/common_tests     | 22 ++++++++++++++++++++++
>>  tools/testing/selftests/sysctl/run_numerictests |  2 +-
>>  tools/testing/selftests/sysctl/run_stringtests  |  2 +-
>>  3 files changed, 24 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/sysctl/common_tests
>> b/tools/testing/selftests/sysctl/common_tests
>> index 17d534b1b7b4..dfb1fcfc3142 100644
>> --- a/tools/testing/selftests/sysctl/common_tests
>> +++ b/tools/testing/selftests/sysctl/common_tests
>> @@ -24,6 +24,14 @@ verify()
>>         return 0
>>  }
>>
>> +exit_test()
>> +{
>> +       if [ ! -z ${old_strict} ]; then
>> +               echo ${old_strict} > ${WRITES_STRICT}
>> +       fi
>> +       exit $rc
>> +}
>> +
>>  trap 'set_orig; rm -f "${TEST_FILE}"' EXIT
>>
>>  rc=0
>> @@ -63,6 +71,20 @@ else
>>         echo "ok"
>>  fi
>>
>> +echo -n "Checking write strict setting ... "
>> +WRITES_STRICT="${SYSCTL}/kernel/sysctl_writes_strict"
>> +if [ ! -e ${WRITES_STRICT} ]; then
>> +       echo "FAIL, but skip in case of old kernel" >&2
>> +else
>> +       old_strict=$(cat ${WRITES_STRICT})
>> +       if [ "$old_strict" = "1" ]; then
>> +               echo "ok"
>> +       else
>> +               echo "FAIL, strict value is 0 but force to 1 to continue" >&2
>> +               echo "1" > ${WRITES_STRICT}
>> +       fi
>> +fi
>> +
>>  # Now that we've validated the sanity of "set_test" and "set_orig",
>>  # we can use those functions to set starting states before running
>>  # specific behavioral tests.
>> diff --git a/tools/testing/selftests/sysctl/run_numerictests
>> b/tools/testing/selftests/sysctl/run_numerictests
>> index 8510f93f2d14..e6e76c93d948 100755
>> --- a/tools/testing/selftests/sysctl/run_numerictests
>> +++ b/tools/testing/selftests/sysctl/run_numerictests
>> @@ -7,4 +7,4 @@ TEST_STR=$(( $ORIG + 1 ))
>>
>>  . ./common_tests
>>
>> -exit $rc
>> +exit_test
>> diff --git a/tools/testing/selftests/sysctl/run_stringtests
>> b/tools/testing/selftests/sysctl/run_stringtests
>> index 90a9293d520c..857ec667fb02 100755
>> --- a/tools/testing/selftests/sysctl/run_stringtests
>> +++ b/tools/testing/selftests/sysctl/run_stringtests
>> @@ -74,4 +74,4 @@ else
>>         echo "ok"
>>  fi
>>
>> -exit $rc
>> +exit_test
>> --
>> 2.12.2
>>
>>
>

      reply	other threads:[~2017-06-23 17:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  4:24 [PATCH V3] tools/testing/selftests/sysctl: Add pre-check to the value of writes_strict Orson Zhai
2017-06-23 15:55 ` Shuah Khan
2017-06-23 17:40   ` Orson Zhai [this message]

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=CAPPenn_cLRFSZbtLGKGHtyh58E_7EYHx5Cv_AGX03rYE_dAh8g@mail.gmail.com \
    --to=orson.zhai@linaro.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=sumit.semwal@linaro.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;
as well as URLs for NNTP newsgroup(s).