Message ID | 1641461121-2212-4-git-send-email-xuyang2018.jy@fujitsu.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2,1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function | expand |
Hi! > @@ -20,15 +20,14 @@ TST_CLEANUP=cleanup > TST_CNT=4 > TST_NEEDS_ROOT=1 > TST_NEEDS_CMDS="sysctl" > +TST_NEEDS_KCONFIGS="CONFIG_SYSCTL=y, CONFIG_PROC_FS=y" Is there a good reason to check for PROC_FS? I doubt that modern system without CONFIG_PROC_FS will even boot. > sys_name="fs.file-max" > sys_file="/proc/sys/fs/file-max" > -syms_file="/proc/kallsyms" > > . tst_test.sh > > setup() > { > - [ ! -f "$sys_file" ] && tst_brk TCONF "$sys_file not enabled" > orig_value=$(cat "$sys_file") > } > > @@ -61,17 +60,15 @@ sysctl_test_overflow() > > sysctl_test_zero() > { > - [ ! -f "$syms_file" ] && tst_brk TCONF "$syms_file not enabled" > + tst_check_kconfigs "CONFIG_KALLSYMS=y" "CONFIG_KALLSYMS_ALL=y" "CONFIG_KASAN=y" \ > + || tst_brk TCONF "kconfig doesn't meet test's requirement!" > + > ROD sysctl -w -q $sys_name=0 > > - if grep -q kasan_report $syms_file; then > - if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then > - tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" > - else > - tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" > - fi > + if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then > + tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" > else > - tst_res TCONF "kernel doesn't support KASAN" > + tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" > fi > } > > -- > 2.23.0 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril > Hi! >> @@ -20,15 +20,14 @@ TST_CLEANUP=cleanup >> TST_CNT=4 >> TST_NEEDS_ROOT=1 >> TST_NEEDS_CMDS="sysctl" >> +TST_NEEDS_KCONFIGS="CONFIG_SYSCTL=y, CONFIG_PROC_FS=y" > > Is there a good reason to check for PROC_FS? I doubt that modern system > without CONFIG_PROC_FS will even boot. I just think some autotest framework ie lkp will start kernel with random config (to find compile bug), so I add PROC_FS to it. Best Regards Yang Xu > >> sys_name="fs.file-max" >> sys_file="/proc/sys/fs/file-max" >> -syms_file="/proc/kallsyms" >> >> . tst_test.sh >> >> setup() >> { >> - [ ! -f "$sys_file" ]&& tst_brk TCONF "$sys_file not enabled" >> orig_value=$(cat "$sys_file") >> } >> >> @@ -61,17 +60,15 @@ sysctl_test_overflow() >> >> sysctl_test_zero() >> { >> - [ ! -f "$syms_file" ]&& tst_brk TCONF "$syms_file not enabled" >> + tst_check_kconfigs "CONFIG_KALLSYMS=y" "CONFIG_KALLSYMS_ALL=y" "CONFIG_KASAN=y" \ >> + || tst_brk TCONF "kconfig doesn't meet test's requirement!" >> + >> ROD sysctl -w -q $sys_name=0 >> >> - if grep -q kasan_report $syms_file; then >> - if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then >> - tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" >> - else >> - tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" >> - fi >> + if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then >> + tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" >> else >> - tst_res TCONF "kernel doesn't support KASAN" >> + tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" >> fi >> } >> >> -- >> 2.23.0 >> >> >> -- >> Mailing list info: https://lists.linux.it/listinfo/ltp >
diff --git a/testcases/commands/sysctl/sysctl02.sh b/testcases/commands/sysctl/sysctl02.sh index 3964a9829..1c444268a 100755 --- a/testcases/commands/sysctl/sysctl02.sh +++ b/testcases/commands/sysctl/sysctl02.sh @@ -20,15 +20,14 @@ TST_CLEANUP=cleanup TST_CNT=4 TST_NEEDS_ROOT=1 TST_NEEDS_CMDS="sysctl" +TST_NEEDS_KCONFIGS="CONFIG_SYSCTL=y, CONFIG_PROC_FS=y" sys_name="fs.file-max" sys_file="/proc/sys/fs/file-max" -syms_file="/proc/kallsyms" . tst_test.sh setup() { - [ ! -f "$sys_file" ] && tst_brk TCONF "$sys_file not enabled" orig_value=$(cat "$sys_file") } @@ -61,17 +60,15 @@ sysctl_test_overflow() sysctl_test_zero() { - [ ! -f "$syms_file" ] && tst_brk TCONF "$syms_file not enabled" + tst_check_kconfigs "CONFIG_KALLSYMS=y" "CONFIG_KALLSYMS_ALL=y" "CONFIG_KASAN=y" \ + || tst_brk TCONF "kconfig doesn't meet test's requirement!" + ROD sysctl -w -q $sys_name=0 - if grep -q kasan_report $syms_file; then - if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then - tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" - else - tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" - fi + if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then + tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error" else - tst_res TCONF "kernel doesn't support KASAN" + tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error" fi }
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- testcases/commands/sysctl/sysctl02.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)