Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / standalone / special / test-failure.sh
1 #!/usr/bin/env bash
2 set -ex
3
4 source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
5
6 function run() {
7     local dir=$1
8     shift
9
10     export CEPH_MON="127.0.0.1:7202" # git grep '\<7202\>' : there must be only one
11     export CEPH_ARGS
12     CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
13     CEPH_ARGS+="--mon-host=$CEPH_MON "
14
15     local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
16     for func in $funcs ; do
17         setup $dir || return 1
18         $func $dir || return 1
19         teardown $dir || return 1
20     done
21 }
22
23 function TEST_failure_log() {
24     local dir=$1
25
26     cat > $dir/test_failure.log << EOF
27 This is a fake log file
28 *
29 *
30 *
31 *
32 *
33 This ends the fake log file
34 EOF
35
36     # Test fails
37     return 1
38 }
39
40 function TEST_failure_core_only() {
41     local dir=$1
42
43     run_mon $dir a || return 1
44     kill_daemons $dir SEGV mon 5
45     return 0
46 }
47
48 main test_failure "$@"