8 source $(dirname $0)/detect-build-env-vars.sh
9 source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
15 export CEPH_MON="127.0.0.1:7124" # git grep '\<7124\>' : there must be only one
17 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
18 CEPH_ARGS+="--mon-host=$CEPH_MON "
20 local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
21 for func in $funcs ; do
22 $func $dir || return 1
26 function TEST_without_pidfile() {
35 --run-dir=$dir || return 1
37 expect_failure $dir "ignore empty --pid-file" ceph-mon \
43 --run-dir=$dir || return 1
47 function TEST_pidfile() {
51 # no daemon can use a pidfile that is owned by another daemon
52 run_mon $dir a || return 1
53 run_mon $dir a --log-to-stderr -f 2>&1 | grep "failed to lock pidfile" || return 1
55 run_osd $dir 0 || return 1
56 activate_osd $dir 0 --log-to-stderr -f 2>&1 | grep "failed to lock pidfile" || return 1
58 # when a daemon shutdown, it will not unlink a path different from
60 mv $dir/osd.0.pid $dir/osd.0.pid.old || return 1
61 cp $dir/osd.0.pid.old $dir/osd.0.pid || return 1
62 kill_daemons $dir TERM osd.0 || return 1
63 test -f $dir/osd.0.pid || return 1
65 # when a daemon starts, it re-uses the pid file if no other daemon
67 run_osd $dir 0 || return 1
68 ! cmp $dir/osd.0.pid $dir/osd.0.pid.old || return 1
70 # if the pid in the file is different from the pid of the daemon
71 # the file is not removed because it is assumed to be owned by
74 cp $dir/osd.0.pid $dir/old/osd.0.pid # so that kill_daemon finds the pid
75 echo 123 > $dir/osd.0.pid
76 kill_daemons $dir/old TERM osd.0 || return 1
77 test -f $dir/osd.0.pid || return 1
79 # when the daemon shutdown, it removes its own pid file
80 test -f $dir/mon.a.pid || return 1
81 kill_daemons $dir TERM mon.a || return 1
82 ! test -f $dir/mon.a.pid || return 1
84 teardown $dir || return 1