1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-08-25 13:50:12 +03:00

test: use assertions in sysctl tests

This commit is contained in:
Yu Watanabe
2022-08-17 05:33:18 +09:00
parent 3f75892dd2
commit 86fc149c69

View File

@ -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