systemd/debian/tests/timedated
Martin Pitt bb8bab30b3 autopkgtests: Factorize out "assert.sh" utility functions
Use them in the tests for useful failure messages.
2015-02-24 16:00:22 +01:00

20 lines
549 B
Bash
Executable File

#!/bin/sh
set -e
. `dirname $0`/assert.sh
ORIG_TZ=`grep -v '^#' /etc/timezone`
echo "original tz: $ORIG_TZ"
# should activate daemon and work
assert_in "Local time:" "`timedatectl --no-pager`"
# change timezone
assert_eq "`timedatectl --no-pager set-timezone Europe/Moscow 2>&1`" ""
assert_eq "`cat /etc/timezone`" "Europe/Moscow"
assert_in "Time.*zone: Europe/Moscow (MSK, +" "`timedatectl --no-pager`"
# reset timezone to original
assert_eq "`timedatectl --no-pager set-timezone $ORIG_TZ 2>&1`" ""
assert_eq "`cat /etc/timezone`" "$ORIG_TZ"