From 71a8029607b54259f28ac1fc0627c7f1e6db586a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 24 Mar 2022 11:52:35 +0100 Subject: [PATCH] test-systemctl-enable: make shellcheck happy Quoting is not necessary in many places, but I think it's nicer to use it consistently. (cherry picked from commit 84fdced62c740a3b07656e84747dd721ad6a30c5) Related: #2082131 --- test/test-systemctl-enable.sh | 76 +++++++++++++++++------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh index 45f3513de3..3b30f090a5 100644 --- a/test/test-systemctl-enable.sh +++ b/test/test-systemctl-enable.sh @@ -19,10 +19,10 @@ islink() { test "$(readlink "$1")" = "$2" || return 2 } -: ------enablement nonexistent-------------------------------- +: '------enable nonexistent------------------------------------' "$systemctl" --root="$root" enable test1.service && { echo "Expected failure" >&2; exit 1; } -: ------basic enablement-------------------------------------- +: '------basic enablement--------------------------------------' mkdir -p "$root/etc/systemd/system" cat >"$root/etc/systemd/system/test1.service" <>"$root/etc/systemd/system/test1.service" <&2; exit 1; } islink "$root/etc/systemd/system/default.target.wants/test1.service" "../test1.service" islink "$root/etc/systemd/system/test1-goodalias.service" "test1.service" @@ -90,7 +90,7 @@ test ! -h "$root/etc/systemd/system/default.target.wants/test1.service" test ! -h "$root/etc/systemd/system/special.target.requires/test1.service" test ! -h "$root/etc/systemd/system/test1-goodalias.service" -: -------also units------------------------------------------- +: '-------also units-------------------------------------------' cat >"$root/etc/systemd/system/test2.socket" <&2; exit 1; } @@ -130,65 +130,65 @@ EOF "$systemctl" --root="$root" link '/link1.path' islink "$root/etc/systemd/system/link1.path" "/link1.path" -: -------link already linked same path------------------------ +: '-------link already linked same path------------------------' SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" link '/link1.path' # this passes islink "$root/etc/systemd/system/link1.path" "/link1.path" -: -------link already linked different path------------------- +: '-------link already linked different path-------------------' mkdir "$root/subdir" cp "$root/link1.path" "$root/subdir/" "$systemctl" --root="$root" link '/subdir/link1.path' && { echo "Expected failure" >&2; exit 1; } islink "$root/etc/systemd/system/link1.path" "/link1.path" -: -------link bad suffix-------------------------------------- +: '-------link bad suffix--------------------------------------' cp "$root/link1.path" "$root/subdir/link1.suffix" "$systemctl" --root="$root" link '/subdir/link1.suffix' && { echo "Expected failure" >&2; exit 1; } test ! -e "$root/etc/systemd/system/link1.suffix" -: -------unlink by unit name---------------------------------- +: '-------unlink by unit name----------------------------------' "$systemctl" --root="$root" disable 'link1.path' test ! -e "$root/etc/systemd/system/link1.path" -: -------unlink by path--------------------------------------- +: '-------unlink by path---------------------------------------' "$systemctl" --root="$root" link '/link1.path' test -h "$root/etc/systemd/system/link1.path" "$systemctl" --root="$root" disable '/link1.path' test ! -e "$root/etc/systemd/system/link1.path" -: -------unlink by wrong path--------------------------------- +: '-------unlink by wrong path---------------------------------' "$systemctl" --root="$root" link '/link1.path' test -h "$root/etc/systemd/system/link1.path" "$systemctl" --root="$root" disable '/subdir/link1.path' # we only care about the name test ! -e "$root/etc/systemd/system/link1.path" -: -------link and enable-------------------------------------- +: '-------link and enable--------------------------------------' "$systemctl" --root="$root" enable '/link1.path' islink "$root/etc/systemd/system/link1.path" "/link1.path" islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path" -: -------enable already linked same path---------------------- +: '-------enable already linked same path----------------------' "$systemctl" --root="$root" enable '/link1.path' islink "$root/etc/systemd/system/link1.path" "/link1.path" islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path" -: -------enable already linked different path----------------- +: '-------enable already linked different path-----------------' "$systemctl" --root="$root" enable '/subdir/link1.path' && { echo "Expected failure" >&2; exit 1; } islink "$root/etc/systemd/system/link1.path" "/link1.path" islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path" -: -------enable bad suffix------------------------------------ +: '-------enable bad suffix------------------------------------' cp "$root/link1.path" "$root/subdir/link1.suffix" "$systemctl" --root="$root" enable '/subdir/link1.suffix' && { echo "Expected failure" >&2; exit 1; } test ! -e "$root/etc/systemd/system/link1.suffix" test ! -e "$root/etc/systemd/system/paths.target.wants/link1.suffix" -: -------disable by unit name--------------------------------- +: '-------disable by unit name---------------------------------' "$systemctl" --root="$root" disable 'link1.path' test ! -e "$root/etc/systemd/system/link1.path" test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path" -: -------disable by path-------------------------------------- +: '-------disable by path--------------------------------------' "$systemctl" --root="$root" enable '/link1.path' test -h "$root/etc/systemd/system/link1.path" test -h "$root/etc/systemd/system/paths.target.wants/link1.path" @@ -197,7 +197,7 @@ test ! -e "$root/etc/systemd/system/link1.path" test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path" -: -------link then enable------------------------------------- +: '-------link and enable-------------------------------------' "$systemctl" --root="$root" link '/link1.path' islink "$root/etc/systemd/system/link1.path" "/link1.path" test ! -h "$root/etc/systemd/system/paths.target.wants/link1.path" @@ -210,7 +210,7 @@ islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path" islink "$root/etc/systemd/system/link1.path" "/link1.path" islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path" -: -------manual link------------------------------------------ +: '-------manual link------------------------------------------' cat >"$root/link3.suffix" <&2; exit 1; } "$systemctl" --root="$root" enable '/etc/systemd/system/masked.service' && { echo "Expected failure" >&2; exit 1; } -: -------enable on masked alias------------------------------- +: '-------enable on masked alias-------------------------------' test -h "$root/etc/systemd/system/masked.service" ln -s "masked.service" "$root/etc/systemd/system/masked-alias.service" "$systemctl" --root="$root" enable 'masked-alias.service' && { echo "Expected failure" >&2; exit 1; } "$systemctl" --root="$root" enable '/etc/systemd/system/masked-alias.service' && { echo "Expected failure" >&2; exit 1; } -: -------issue 22000: link in subdirectory-------------------- +: '-------issue 22000: link in subdirectory--------------------' mkdir -p "$root/etc/systemd/system/myown.d" cat >"$root/etc/systemd/system/link5-also.service" <"$root/etc/systemd/system/templ1@.service" <"$root/etc/systemd/system/templ1@.service" <"$root/etc/systemd/system/templ2@.service" <"$root/etc/systemd/system/link4.service" <"$root/etc/systemd/system/link4.service" <"$root/etc/systemd/system/link5.service" <"$root/link5copy.service" <"$root/etc/systemd/system/link5@.path" <"$root/etc/systemd/system/multilink.mount" <"$root/etc/systemd/system/some-some-link6@.socket" <&2; exit 1; } -: -------specifiers in WantedBy------------------------------- +: '-------specifiers in WantedBy-------------------------------' # We don't need to repeat all the tests. Let's do a basic check that specifier # expansion is performed. @@ -642,7 +642,7 @@ test ! -h "$root/etc/systemd/system/another-target2@.target.requires/some-some-l # TODO: repeat the tests above for presets -: -------SYSTEMD_OS_RELEASE relative to root------------------ +: '-------SYSTEMD_OS_RELEASE relative to root-------------------' # check that os-release overwriting works as expected with root test -e "$root/etc/os-release"