| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
dir=$(pwd)/debian/tests |
| 6 |
. $dir/textutils.sh |
| 7 |
|
| 8 |
frame "Here we are testing the ranges of days and months" \ |
| 9 |
"for day of week and month fields, as stated in crontab(5)" |
| 10 |
|
| 11 |
echo "================= adding user 'dummy' =====================" |
| 12 |
getent passwd dummy || adduser --disabled-password --gecos "" dummy |
| 13 |
|
| 14 |
echo "= make user 'dummy' fill his crontab with month = Jan-Mar =" |
| 15 |
|
| 16 |
# stderr is redirected towards stdout so the variable warning can catch it |
| 17 |
reply=$(su dummy -c "(export LINES=' * * * Jan-Mar * echo hello'; echo 'n' | EDITOR=$(pwd)/debian/tests/cronfiller.py crontab -n -e)" 2>&1 | grep syntax) |
| 18 |
|
| 19 |
echo "== check that the reply contains 'successfully checked' ===" |
| 20 |
expected="successfully checked" |
| 21 |
(echo "$reply" | grep -q "$expected") || (echo "reply = $reply"; \ |
| 22 |
echo "The expected success did not occur" >&2) |
| 23 |
|
| 24 |
echo "= make user 'dummy' fill his crontab with month = Jan,Mar =" |
| 25 |
|
| 26 |
# stderr is redirected towards stdout so the variable warning can catch it |
| 27 |
reply=$(su dummy -c "(export LINES=' * * * Jan,Mar * echo hello'; echo 'n' | EDITOR=$(pwd)/debian/tests/cronfiller.py crontab -n -e)" 2>&1 | grep syntax) |
| 28 |
|
| 29 |
echo "== check that the reply contains 'successfully checked' ===" |
| 30 |
expected="successfully checked" |
| 31 |
(echo "$reply" | grep -q "$expected") || (echo "reply = $reply"; \ |
| 32 |
echo "The expected success did not occur" >&2) |
| 33 |
|
| 34 |
echo "== make user 'dummy' fill his crontab with dow = Mon-Wed ==" |
| 35 |
|
| 36 |
# stderr is redirected towards stdout so the variable warning can catch it |
| 37 |
reply=$(su dummy -c "(export LINES=' * * * * Mon-Wed echo hello'; echo 'n' | EDITOR=$(pwd)/debian/tests/cronfiller.py crontab -n -e)" 2>&1 | grep syntax) |
| 38 |
|
| 39 |
echo "== check that the reply contains 'successfully checked' ===" |
| 40 |
expected="successfully checked" |
| 41 |
(echo "$reply" | grep -q "$expected") || (echo "reply = $reply"; \ |
| 42 |
echo "The expected success did not occur" >&2) |
| 43 |
|
| 44 |
echo "== make user 'dummy' fill his crontab with dow = Mon,Wed ==" |
| 45 |
|
| 46 |
# stderr is redirected towards stdout so the variable warning can catch it |
| 47 |
reply=$(su dummy -c "(export LINES=' * * * * Mon,Wed echo hello'; echo 'n' | EDITOR=$(pwd)/debian/tests/cronfiller.py crontab -n -e)" 2>&1 | grep syntax) |
| 48 |
|
| 49 |
echo "== check that the reply contains 'successfully checked' ===" |
| 50 |
expected="successfully checked" |
| 51 |
(echo "$reply" | grep -q "$expected") || (echo "reply = $reply"; \ |
| 52 |
echo "The expected success did not occur" >&2) |
| 53 |
|