From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] sysctl/sysctl02: Add new regression test for overflow file-max
Date: Fri, 21 Jun 2019 09:26:19 +0800 [thread overview]
Message-ID: <5D0C323B.5020505@cn.fujitsu.com> (raw)
In-Reply-To: <20190620120122.GB31382@dell5510>
> Hi,
>
> LGTM, below are just small formatting issues.
> I'm going to merge it with these changes below.
>
>> Signed-off-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> ---
>> runtest/commands | 1 +
>> testcases/commands/sysctl/sysctl02.sh | 96 +++++++++++++++++++++++++++
>> 2 files changed, 97 insertions(+)
>> create mode 100755 testcases/commands/sysctl/sysctl02.sh
> ...
>> +sysctl_test_overflow()
>> +{
>> + local old_value=$(cat "$dir""$name")
>> +
>> + sysctl -w "fs.file-max"=$1>/dev/null 2>&1
>> +
>> + local test_value=$(cat "$dir""$name")
> again, why 2 stings instead of one?
> local test_value=$(cat "$dir$name")
Hi Petr
I use 2 strings because sysctl uses "fs.file-max" but cat uses "fs/file-max" file.
Your big changes look good to me. Thanks for your changes.
>> +
>> + echo ${test_value} |grep -q ${old_value}
>> + if [ $? -eq 0 ]; then
>> + tst_res TPASS "file-max overflow, reject it and keep old value."
> Please don't use dot
>
>> + else
>> + tst_res TFAIL "file-max overflow and set it to ${test_value}."
> Here as well.
>
>> + fi
>> + cleanup
>> +}
>> +
>> +sysctl_test_zero()
>> +{
>> + sysctl -w "fs.file-max"=0>/dev/null 2>&1
> Please use -q option instead of redirecting.
>> + [ ! -f "$syms_file" ]&& tst_brk TCONF \
>> + "$syms_file was not supported"
>> + cat $syms_file |grep kasan_report>/dev/null 2>&1
>> + if [ $? -eq 0 ]; then
> Also grep has -q, no need to use pipe:
>
> if grep -q kasan_report $syms_file; then
>
>> + dmesg | grep "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax">/dev/null
> -q here as well.
>
>> + if [ $? -eq 0 ]; then
>> + tst_res TFAIL "file-max is set 0 and trigger a KASAN error"
>> + else
>> + tst_res TPASS \
>> + "file-max is set 0 and doesn't trigger a KASAN error"
> Probably can be on single line.
>
>> + fi
>> + else
>> + tst_res TCONF "kernel doesn't support KASAN"
>> + fi
>> +}
>> +
>> +cleanup()
>> +{
>> + sysctl -w "fs.""$name"=${orig_value}>/dev/null 2>&1
> It's safe not quote string ($name is safe, but you can of course)
> sysctl -q -w fs.$name=$orig_value
>
>> +}
>> +
>> +tst_run
>
> .
>
next prev parent reply other threads:[~2019-06-21 1:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 10:31 [LTP] [PATCH] sysctl/sysctl02: Add new regression test for overflow file-max Yang Xu
2019-06-06 10:41 ` Yang Xu
2019-06-06 10:45 ` [LTP] [PATCH v2] " Yang Xu
2019-06-06 11:41 ` Cyril Hrubis
2019-06-10 8:51 ` [LTP] [PATCH v3] " Yang Xu
2019-06-20 12:01 ` Petr Vorel
2019-06-21 1:26 ` Yang Xu [this message]
2019-07-03 14:42 ` Petr Vorel
2019-07-04 1:40 ` Yang Xu
2019-06-20 12:52 ` Petr Vorel
2019-06-10 9:06 ` [LTP] [PATCH v2] " Yang Xu
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=5D0C323B.5020505@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/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