]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: remove unneeded $ in arithmetic expressions
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Fri, 10 Apr 2026 18:38:34 +0000 (14:38 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Mon, 4 May 2026 11:31:10 +0000 (07:31 -0400)
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
tests/ts/blkid/low-probe
tests/ts/fadvise/drop
tests/ts/flock/flock
tests/ts/ipcs/limits
tests/ts/libmount/lock
tests/ts/mkswap/mkswap
tests/ts/sfdisk/resize
tests/ts/swaplabel/swaplabel
tests/ts/swapon/fixsig
tests/ts/wipefs/wipefs

index 56a7949e3506125b0e148177f151d14c47e5efc3..2961052970435519b4fb6b86e3ccccf60c8692ff 100755 (executable)
@@ -47,7 +47,7 @@ for img in $(find "$TS_SELF"/images-fs/ -maxdepth 1 -name "*.img.xz" | sort); do
                        | sed 's/-$//g')
                for off in $sessions; do
                        ts_init_subtest $name-$off
-                       $TS_CMD_BLKID --probe --output udev $outimg --hint session_offset=$(( $off * 2048 )) \
+                       $TS_CMD_BLKID --probe --output udev $outimg --hint session_offset=$(( off * 2048 )) \
                                2> "$TS_ERRLOG" | sort > "$TS_OUTPUT"
                        ts_finalize_subtest
                done
index 162ffb6941f50051ae698bfaf4151499c9711be5..928c80620be5f1fad33c4df1bcd73a19d2748011 100755 (executable)
@@ -46,21 +46,21 @@ do_fincore() {
 
     create_file
     echo "offset: $(( 2 * $BS ))"
-    "$TS_CMD_FADVISE" --offset $(( 2 * $BS )) "$FILE"
+    "$TS_CMD_FADVISE" --offset $(( 2 * BS )) "$FILE"
     echo status: $?
     do_fincore
     echo
 
     create_file
     echo "length: $(( 4 * $BS ))"
-    "$TS_CMD_FADVISE" --length $(( 4 * $BS )) "$FILE"
+    "$TS_CMD_FADVISE" --length $(( 4 * BS )) "$FILE"
     echo status: $?
     do_fincore
     echo
 
     create_file
     echo "offset: $(( 2 * $BS )), length: $(( 4 * $BS )) fd: 42"
-    "$TS_CMD_FADVISE" --offset $(( 2 * $BS )) --length $(( 4 * $BS )) --fd 42 42<"$FILE"
+    "$TS_CMD_FADVISE" --offset $(( 2 * BS )) --length $(( 4 * BS )) --fd 42 42<"$FILE"
     echo status: $?
     do_fincore
     echo
index 2f5b3cd34508fcad29c5343aa7b3d1e7dc70e89c..516c657420bd64f518569063490072900e8c9d16 100755 (executable)
@@ -125,7 +125,7 @@ for api in flock fcntl ; do
        # inmterval <3,5>.
        #
        ts_init_subtest "${subtest_prefix}time-check"
-       TIMEDIFF=$(( $END - $START ))
+       TIMEDIFF=$(( END - START ))
        if [ $TIMEDIFF -lt 3 ]; then
                ts_log "general lock failed [$TIMEDIFF sec]"
        elif [ $TIMEDIFF -gt 5 ]; then
index 1a6d40e36ce9c29e26f5352bc0f17ac7b22b679b..a8dd75d85cb3910c4ea26e684e0940cd43288730 100755 (executable)
@@ -34,12 +34,12 @@ ts_lock "ipcslimits"
 
 ts_log "load original values"
 for i in $IPCS_IDX; do
-       SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]})
+       SHM_ORG[i]=$(cat ${IPCS_PROCFILES[i]})
 done >> "$TS_OUTPUT"
 
 ts_log "maximize kernel setting"
 for i in $IPCS_IDX; do
-       echo ${IPCS_LIMITS[$i]} >> ${IPCS_PROCFILES[$i]}
+       echo ${IPCS_LIMITS[i]} >> ${IPCS_PROCFILES[i]}
 done >> "$TS_OUTPUT"
 
 ts_log "check for difference between kernel and IPC"
@@ -47,7 +47,7 @@ ipcs_limits_check >> "$TS_OUTPUT"
 
 ts_log "write original values to kernel"
 for i in $IPCS_IDX; do
-       echo ${SHM_ORG[$i]} >> ${IPCS_PROCFILES[$i]}
+       echo ${SHM_ORG[i]} >> ${IPCS_PROCFILES[i]}
 done >> "$TS_OUTPUT"
 
 ts_finalize
index ed69dd927f3a426ea85f4a11b0bd667a15eab5b6..f0567454527a0116bcf6bf89a7e6674f30b82856 100755 (executable)
@@ -32,7 +32,7 @@ NPROCESSES=50
 echo 0 > "$TS_OUTPUT"
 SYNCTIME=$(( $(date +%s) + 5 ))
 
-for id in $(seq 0 $(( $NPROCESSES - 1 ))); do
+for id in $(seq 0 $(( NPROCESSES - 1 ))); do
        ts_run $TESTPROG --lock --synctime $SYNCTIME "$TS_OUTPUT" $NLOOPS >> "$TS_OUTPUT".debug 2>&1 &
 done
 
index 2b0eb178829aa7677b906c1ae4cf850427939d6f..342d6679a53ef4c38b190e5c7b526b4d7033777b 100755 (executable)
@@ -85,7 +85,7 @@ rm -f "$outimg"
 truncate -s $(( 4096 * 10 )) "$outimg" > "$TS_ERRLOG" 2>&1
 
 rm -f "$outimg.offset"
-truncate -s $(( 4096 * 10 + $offset )) "$outimg.offset" > "$TS_ERRLOG" 2>&1
+truncate -s $(( 4096 * 10 + offset )) "$outimg.offset" > "$TS_ERRLOG" 2>&1
 
 "$TS_CMD_MKSWAP" -q -U "$UUID" -p 4096 "$outimg" \
        >> "$TS_OUTPUT" 2>/dev/null \
index 297eecc476abf61817463169b94323d3f8cc9223..8ecf187a99d59e0077913c2b5c02ec63cc3a10e8 100755 (executable)
@@ -80,8 +80,8 @@ function test_label_resize {
 
        for idx in $(seq 0 $(( ${#COMM[*]} - 1 ))); do
 
-               cmd=${COMM[$idx]}
-               name=${NAME[$idx]}
+               cmd=${COMM[idx]}
+               name=${NAME[idx]}
 
                ts_init_subtest "$label-$idx-$name"
                echo -e "$cmd\n" >> "$TS_OUTPUT"
@@ -97,7 +97,7 @@ function test_label_resize {
        echo ',10M,L' | $TS_CMD_SFDISK --no-reread --append ${TS_DEVICE} &> /dev/null
        udevadm settle
 
-       idx=$(( $idx + 1 ))
+       idx=$(( idx + 1 ))
        ts_init_subtest "$label-$idx-reduce-midle"
        cmd=',-5M'
        echo -e "$cmd\n" >> "$TS_OUTPUT"
@@ -106,7 +106,7 @@ function test_label_resize {
        udevadm settle
        ts_finalize_subtest
 
-       idx=$(( $idx + 1 ))
+       idx=$(( idx + 1 ))
        ts_init_subtest "$label-$idx-max-last"
        cmd='-5M,+'
        echo -e "$cmd\n" >> "$TS_OUTPUT"
index 08d44a5625f41801b3b624fa1b4c4e96fd770950..889fc377b04bf98ec52ec0d903e5e6cd6c123dfe 100755 (executable)
@@ -26,12 +26,12 @@ ts_check_test_command "$TS_CMD_FALLOCATE"
 IMAGE=${TS_OUTDIR}/${TS_TESTNAME}.file
 
 PAGE_SIZE=$($TS_HELPER_SYSINFO pagesize)
-PAGE_SIZE_KB=$(( $PAGE_SIZE / 1024 ))
-MIN_SWAP_SIZE=$(( 10 * $PAGE_SIZE ))
+PAGE_SIZE_KB=$(( PAGE_SIZE / 1024 ))
+MIN_SWAP_SIZE=$(( 10 * PAGE_SIZE ))
 MIN_SWAP_SIZE_KB=$(( MIN_SWAP_SIZE / 1024 ))
 
 rm -f $IMAGE
-$TS_CMD_FALLOCATE --posix --length $(( $MIN_SWAP_SIZE - 1 )) $IMAGE 2> /dev/null
+$TS_CMD_FALLOCATE --posix --length $(( MIN_SWAP_SIZE - 1 )) $IMAGE 2> /dev/null
 $TS_CMD_MKSWAP \
        --label 1234567890abcdef \
        --uuid 12345678-abcd-abcd-abcd-1234567890ab \
@@ -49,8 +49,8 @@ $TS_CMD_MKSWAP \
        --uuid 12345678-abcd-abcd-abcd-1234567890ab \
        $IMAGE >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
 
-sed -i -e "s/ $(( $MIN_SWAP_SIZE_KB - $PAGE_SIZE_KB )) KiB/ 9 pages/" \
-    -e "s/($(( $MIN_SWAP_SIZE - $PAGE_SIZE )) bytes)/(9xPGSZ bytes)/" \
+sed -i -e "s/ $(( MIN_SWAP_SIZE_KB - PAGE_SIZE_KB )) KiB/ 9 pages/" \
+    -e "s/($(( MIN_SWAP_SIZE - PAGE_SIZE )) bytes)/(9xPGSZ bytes)/" \
     -e "s:$IMAGE:<swapfile>:g" \
     -e "s/insecure permissions [0-9]*/insecure permissions <perm>/g" \
     "$TS_OUTPUT" "$TS_ERRLOG"
index ad66ee45fac457ccf573e99218000f6e42122b2b..f640fc7359ae7317e60c7649ef37d8efa1e4b681 100755 (executable)
@@ -32,7 +32,7 @@ ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
 #
 echo "S2SUSPEND " > "$TS_OUTPUT".signature
 dd if="$TS_OUTPUT".signature of=$DEVICE \
-       seek=$(( $PAGESIZE - 10 )) count=10 bs=1 conv=notrunc &> /dev/null
+       seek=$(( PAGESIZE - 10 )) count=10 bs=1 conv=notrunc &> /dev/null
 
 ts_device_has "TYPE" "swsuspend" $DEVICE || ts_die "Cannot find swsuspend on $DEVICE"
 
index fef60d6f0091974f53fbc45ea152a3c38c25967f..41a712c09b0637fbf85a46d296507e1fb5d29994 100755 (executable)
@@ -24,7 +24,7 @@ $TS_CMD_WIPEFS --all --backup="${backups}" ${img} &>/dev/null || ts_die "wipefs
 #there should be just one magic string/backup file in this case
 INFILE=$(find "$backups/" -iname "wipefs-$(basename "${img}")-*.bak")
 OFFT=$(echo $INFILE | sed 's/^.*-\(.*\).bak$/\1/')
-dd if=$INFILE of=$img bs=1 conv=notrunc seek=$(($OFFT)) &>/dev/null
+dd if=$INFILE of=$img bs=1 conv=notrunc seek=$((OFFT)) &>/dev/null
 
 #the bytes should be copied back, check if wipefs can recognize it
 $TS_CMD_WIPEFS -a ${img} > $TS_OUTDIR/out 2>/dev/null