diff options
| author | Cheng-Han Wu <hank20010209@gmail.com> | 2026-06-07 17:57:32 +0800 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2026-07-30 07:55:37 -0600 |
| commit | 649ba27dfac784427a01f9c95c09ecbcb88900d8 (patch) | |
| tree | 6e214da956b8347ea573e5fced6e8a59a3384640 /tools | |
| parent | 20f01a5565ce79923b75a2ac8e8ef2a1d7adf517 (diff) | |
| download | linux-next-649ba27dfac784427a01f9c95c09ecbcb88900d8.tar.gz linux-next-649ba27dfac784427a01f9c95c09ecbcb88900d8.zip | |
selftests/zram: fix kernel_gte() for POSIX sh
Commit fc4eb486a59d ("selftests/zram: Skip max_comp_streams
interface on newer kernel") added kernel_gte() to zram_lib.sh.
The function uses the bash-specific [[ ... ]] conditional, but
zram selftests source this file while running under /bin/sh.
On systems where /bin/sh is dash, such as Debian, the following
test fails:
dash -c '
kernel_major=6; kernel_minor=1; major=6; minor=0
if [ $kernel_major -gt $major ]; then
echo ok
elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then
echo ok
fi'
with:
dash: 5: [[: not found
Use separate POSIX test expressions joined by && instead.
Fixes: fc4eb486a59d ("selftests/zram: Skip max_comp_streams interface on newer kernel")
Signed-off-by: Cheng-Han Wu <hank20010209@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/testing/selftests/zram/zram_lib.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh index 21ec1966de76..0d44d83888f9 100755 --- a/tools/testing/selftests/zram/zram_lib.sh +++ b/tools/testing/selftests/zram/zram_lib.sh @@ -37,7 +37,7 @@ kernel_gte() if [ $kernel_major -gt $major ]; then return 0 - elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then + elif [ $kernel_major -eq $major ] && [ $kernel_minor -ge $minor ]; then return 0 fi |
