]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/cgroup: Fix string comparison in write_test
authorHongfu Li <lihongfu@kylinos.cn>
Mon, 11 May 2026 01:39:57 +0000 (09:39 +0800)
committerTejun Heo <tj@kernel.org>
Mon, 11 May 2026 01:54:12 +0000 (15:54 -1000)
Use string comparison (!=) instead of numeric comparison (-ne) for
cpuset values like "0-1".
For example:
$ [[ "0-1" != "2-3" ]] && echo "true" || echo "false"
true
$ [[ "0-1" -ne "2-3" ]] && echo "true" || echo "false"
false

Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/testing/selftests/cgroup/test_cpuset_v1_base.sh

index 42a6628fb8bc3edc286fb17407f5ba3ac84ccd79..1c0444729e707d412c20753dc8dd67f64156e9da 100755 (executable)
@@ -18,7 +18,7 @@ write_test() {
        echo "testing $interface $value"
        echo $value > $dir/$interface
        new=$(cat $dir/$interface)
-       [[ $value -ne $(cat $dir/$interface) ]] && {
+       [[ "$value" != "$new" ]] && {
                echo "$interface write $value failed: new:$new"
                exit 1
        }