diff options
author | Yang Xu <xuyang2018.jy@fujitsu.com> | 2022-01-27 17:11:37 +0800 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2022-01-27 10:59:02 -0700 |
commit | 01dabed20573804750af5c7bf8d1598a6bf7bf6e (patch) | |
tree | d1c679b38dea0998a5b39d957019eb5a713d1230 /tools/testing/selftests/zram/zram.sh | |
parent | d18da7ec3719559d6e74937266d0416e6c7e0b31 (diff) | |
download | linux-stable-01dabed20573804750af5c7bf8d1598a6bf7bf6e.tar.gz linux-stable-01dabed20573804750af5c7bf8d1598a6bf7bf6e.tar.bz2 linux-stable-01dabed20573804750af5c7bf8d1598a6bf7bf6e.zip |
selftests/zram: Adapt the situation that /dev/zram0 is being used
If zram-generator package is installed and works, then we can not remove
zram module because zram swap is being used. This case needs a clean zram
environment, change this test by using hot_add/hot_remove interface. So
even zram device is being used, we still can add zram device and remove
them in cleanup.
The two interface was introduced since kernel commit 6566d1a32bf7("zram:
add dynamic device add/remove functionality") in v4.2-rc1. If kernel
supports these two interface, we use hot_add/hot_remove to slove this
problem, if not, just check whether zram is being used or built in, then
skip it on old kernel.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/zram/zram.sh')
-rwxr-xr-x | tools/testing/selftests/zram/zram.sh | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh index 232e958ec454..b0b91d9b0dc2 100755 --- a/tools/testing/selftests/zram/zram.sh +++ b/tools/testing/selftests/zram/zram.sh @@ -2,9 +2,6 @@ # SPDX-License-Identifier: GPL-2.0 TCID="zram.sh" -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - . ./zram_lib.sh run_zram () { @@ -18,14 +15,4 @@ echo "" check_prereqs -# check zram module exists -MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko -if [ -f $MODULE_PATH ]; then - run_zram -elif [ -b /dev/zram0 ]; then - run_zram -else - echo "$TCID : No zram.ko module or /dev/zram0 device file not found" - echo "$TCID : CONFIG_ZRAM is not set" - exit $ksft_skip -fi +run_zram |