]> git.proxmox.com Git - ceph.git/blob - ceph/src/script/run-cbt.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / src / script / run-cbt.sh
1 #!/bin/sh
2
3 usage() {
4 local prog_name=$1
5 shift
6 cat <<EOF
7 usage:
8 $prog_name [options] <config-file>...
9
10 options:
11 -a,--archive-dir directory in which the test result is stored, default to $PWD/cbt-archive
12 --build-dir directory where CMakeCache.txt is located, default to $PWD
13 --cbt-dir directory of cbt if you have already a copy of it. ceph/cbt:master will be cloned from github if not specified
14 -h,--help print this help message
15 --source-dir the path to the top level of Ceph source tree, default to $PWD/..
16 --use-existing do not setup/teardown a vstart cluster for testing
17
18 example:
19 $prog_name --cbt ~/dev/cbt -a /tmp ../src/test/crimson/cbt/radosbench_4K_read.yaml
20 EOF
21 }
22
23 prog_name=$(basename $0)
24 archive_dir=$PWD/cbt-archive
25 build_dir=$PWD
26 source_dir=$(dirname $PWD)
27 use_existing=false
28 classical=false
29 opts=$(getopt --options "a:h" --longoptions "archive-dir:,build-dir:,source-dir:,cbt:,help,use-existing,classical" --name $prog_name -- "$@")
30 eval set -- "$opts"
31
32 while true; do
33 case "$1" in
34 -a|--archive-dir)
35 archive_dir=$2
36 shift 2
37 ;;
38 --build-dir)
39 build_dir=$2
40 shift 2
41 ;;
42 --source-dir)
43 source_dir=$2
44 shift 2
45 ;;
46 --cbt)
47 cbt_dir=$2
48 shift 2
49 ;;
50 --use-existing)
51 use_existing=true
52 shift
53 ;;
54 --classical)
55 classical=true
56 shift
57 ;;
58 -h|--help)
59 usage $prog_name
60 return 0
61 ;;
62 --)
63 shift
64 break
65 ;;
66 *)
67 echo "unexpected argument $1" 1>&2
68 return 1
69 ;;
70 esac
71 done
72
73 if test $# -gt 0; then
74 config_files="$@"
75 else
76 echo "$prog_name: please specify one or more .yaml files" 1>&2
77 usage $prog_name
78 return 1
79 fi
80
81 if test -z "$cbt_dir"; then
82 cbt_dir=$PWD/cbt
83 git clone --depth 1 -b master https://github.com/ceph/cbt.git $cbt_dir
84 fi
85
86 # store absolute path before changing cwd
87 source_dir=$(readlink -f $source_dir)
88 if ! $use_existing; then
89 cd $build_dir
90 # seastar uses 128*8 aio in reactor for io and 10003 aio for events pooling
91 # for each core, if it fails to enough aio context, the seastar application
92 # bails out. and take other process into consideration, let's make it
93 # 32768 per core
94 max_io=$(expr 32768 \* $(nproc))
95 if test $(/sbin/sysctl --values fs.aio-max-nr) -lt $max_io; then
96 sudo /sbin/sysctl -q -w fs.aio-max-nr=$max_io
97 fi
98 if $classical; then
99 MDS=0 MGR=1 OSD=3 MON=1 $source_dir/src/vstart.sh -n -X \
100 --without-dashboard --memstore \
101 -o "memstore_device_bytes=34359738368"
102 else
103 MDS=0 MGR=1 OSD=3 MON=1 $source_dir/src/vstart.sh -n -X \
104 --without-dashboard --memstore \
105 -o "memstore_device_bytes=34359738368" \
106 --crimson --nodaemon --redirect-output \
107 --osd-args "--memory 4G"
108 fi
109 cd -
110 fi
111
112 for config_file in $config_files; do
113 echo "testing $config_file"
114 cbt_config=$(mktemp $config_file.XXXX.yaml)
115 python3 $source_dir/src/test/crimson/cbt/t2c.py \
116 --build-dir $build_dir \
117 --input $config_file \
118 --output $cbt_config
119 python3 $cbt_dir/cbt.py \
120 --archive $archive_dir \
121 --conf $build_dir/ceph.conf \
122 $cbt_config
123 rm -f $cbt_config
124 done
125
126 if ! $use_existing; then
127 cd $build_dir
128 if $classical; then
129 $source_dir/src/stop.sh
130 else
131 $source_dir/src/stop.sh --crimson
132 fi
133 fi