1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

test: use trap RETURN

This commit is contained in:
Yu Watanabe 2022-06-14 21:08:04 +09:00
parent 4627fb80bf
commit 6243063824
2 changed files with 4 additions and 16 deletions

View File

@ -91,7 +91,7 @@ test_suspend_on_lid() {
fi
KILL_PID=
trap test_suspend_tear_down EXIT
trap test_suspend_tear_down RETURN
# create fake suspend
mkdir -p /run/systemd/system/systemd-suspend.service.d
@ -184,9 +184,6 @@ EOF
echo "logind crashed" >&2
exit 1
fi
test_suspend_tear_down
trap - EXIT
}
test_shutdown() {
@ -269,7 +266,7 @@ test_session() {
return
fi
trap test_session_tear_down EXIT
trap test_session_tear_down RETURN
# add user
useradd -s /bin/bash logind-test-user
@ -361,9 +358,6 @@ EOF
getfacl -p "$dev" >&2
exit 1
fi
test_session_tear_down
trap - EXIT
}
: >/failed

View File

@ -23,7 +23,7 @@ test_timezone() {
mv /etc/timezone /tmp/timezone.bak
fi
trap restore_timezone EXIT
trap restore_timezone RETURN
if [[ -L /etc/localtime ]]; then
ORIG_TZ=$(readlink /etc/localtime | sed 's#^.*zoneinfo/##')
@ -49,9 +49,6 @@ test_timezone() {
assert_eq "$(cat /etc/timezone)" "$ORIG_TZ"
fi
fi
restore_timezone
trap - EXIT
}
restore_adjtime() {
@ -75,7 +72,7 @@ test_adjtime() {
mv /etc/adjtime /etc/adjtime.bak
fi
trap restore_adjtime EXIT
trap restore_adjtime RETURN
echo 'no adjtime file'
rm -f /etc/adjtime
@ -182,9 +179,6 @@ LOCAL"
assert_eq "$(cat /etc/adjtime)" "0.0 0 0
0
LOCAL"
restore_adjtime
trap - EXIT
}
assert_ntp() {