2 # Copyright (C) 2012 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 # Test that variables are reloaded across runs.
24 libdir=$(cd ../../lib; pwd)
25 toolsdir=$(cd ../../tools; pwd)
26 daemondir=$(cd ../../daemon; pwd)
31 rm -rf "$testdir/.whenjobs"
33 PATH="$toolsdir:$daemondir:$PATH"
36 # Kill the daemon and clean up when the script exits.
38 kill `cat "$testdir/.whenjobs/daemon_pid"`
39 rm -rf "$testdir/.whenjobs"
41 trap cleanup INT TERM QUIT EXIT
46 whenjobs --lib "$libdir" --type float --set test_float=4.2
47 whenjobs --lib "$libdir" --type int --set test_int=42
48 whenjobs --lib "$libdir" --type string --set test_string=fortytwo
50 whenjobs --lib "$libdir" --daemon-stop >/dev/null 2>&1 ||:
52 # Run the daemon again and read back the variables.
55 output="$(whenjobs --lib "$libdir" --variables | LANG=C sort)"
57 whenjobs --lib "$libdir" --daemon-stop >/dev/null 2>&1 ||:
59 trap - INT TERM QUIT EXIT
60 rm -rf "$testdir/.whenjobs"
62 if [ "$output" != "JOBSERIAL=0
65 test_string=fortytwo" ]; then
66 echo "$0: unexpected variables in output:"
71 rm -rf "$testdir/.whenjobs"