]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use assertions in sysctl tests
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Aug 2022 20:33:18 +0000 (05:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Aug 2022 05:30:20 +0000 (14:30 +0900)
test/units/testsuite-76.sh

index 3095b8fc342da4b972bfe4b068310a53c7dc0c0e..2149d725c08f64a8d9c2dfa21c07da9879199c16 100755 (executable)
@@ -3,14 +3,17 @@
 set -eux
 set -o pipefail
 
+# shellcheck source=test/units/assert.sh
+. "$(dirname "$0")"/assert.sh
+
 export SYSTEMD_LOG_LEVEL=debug
 
 echo "foo.bar=42" > /tmp/foo.conf
-[[ $(/usr/lib/systemd/systemd-sysctl /tmp/foo.conf)$? -eq 0 ]]
-[[ $(/usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf)$? -ne 0 ]]
+assert_rc 0 /usr/lib/systemd/systemd-sysctl /tmp/foo.conf
+assert_rc 1 /usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf
 
 echo "-foo.foo=42" > /tmp/foo.conf
-[[ $(/usr/lib/systemd/systemd-sysctl /tmp/foo.conf)$? -eq 0 ]]
-[[ $(/usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf)$? -eq 0 ]]
+assert_rc 0 /usr/lib/systemd/systemd-sysctl /tmp/foo.conf
+assert_rc 0 /usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf
 
 touch /testok