test: silence more shellcheck warnings

(cherry picked from commit 89bddce9875de8ac5b18520cb771029b82b6c354)
This commit is contained in:
Yu Watanabe
2026-10-16 17:24:51 +01:00
committed by Luca Boccassi
parent 365cb58058
commit 6f11f24642
7 changed files with 8 additions and 10 deletions
@@ -11,6 +11,7 @@ set -o pipefail
IFNAME=test-netif-foo
# shellcheck disable=SC2329
at_exit() {
set +e
+1
View File
@@ -11,6 +11,7 @@ set -o pipefail
# This is a test case for issue #34637.
# shellcheck disable=SC2329
at_exit() (
set +e
+1 -1
View File
@@ -30,7 +30,7 @@ EOF
systemctl reload systemd-udevd.service
}
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
teardown() {
set +e
+1 -1
View File
@@ -16,7 +16,7 @@ test_property() {
assert_eq "$(udevadm info --query property --property "$2" --value "$1")" "$3"
}
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
cleanup() {
set +e
+1
View File
@@ -7,6 +7,7 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
# shellcheck disable=SC2329
at_exit() (
set +e
+1 -1
View File
@@ -8,7 +8,7 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
cleanup() {
cd /
rm -rf "${workdir}"
+2 -7
View File
@@ -11,7 +11,7 @@ FSTYPE=$(stat --file-system --format "%T" /usr)
shopt -s nullglob
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
at_exit() {
set +ex
@@ -97,20 +97,15 @@ prepare_root() {
prepend_trap "cleanup_os_release ${root@Q}"
}
# shellcheck disable=SC2317,SC2329
cleanup_os_release() {
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
local root=${1:-}
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
rm -f "$root/usr/lib/os-release"
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
if [[ -e $root/usr/lib/os-release.orig ]]; then
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
mv "$root/usr/lib/os-release.orig" "$root/usr/lib/os-release"
fi
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
if [[ -e $root/etc/os-release.orig ]]; then
# shellcheck disable=SC2317 # It is not unreachable, used in a trap couple lines above.
mv "$root/etc/os-release.orig" "$root/etc/os-release"
fi
}