]> git.proxmox.com Git - ceph.git/blame - ceph/src/script/run-cbt.sh
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / script / run-cbt.sh
CommitLineData
9f95a23c
TL
1#!/bin/sh
2
3usage() {
f67539c2 4 prog_name=$1
9f95a23c
TL
5 shift
6 cat <<EOF
7usage:
8 $prog_name [options] <config-file>...
9
10options:
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
f67539c2 13 --cbt directory of cbt if you have already a copy of it. ceph/cbt:master will be cloned from github if not specified
9f95a23c
TL
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
18example:
19 $prog_name --cbt ~/dev/cbt -a /tmp ../src/test/crimson/cbt/radosbench_4K_read.yaml
20EOF
21}
22
23prog_name=$(basename $0)
24archive_dir=$PWD/cbt-archive
25build_dir=$PWD
26source_dir=$(dirname $PWD)
27use_existing=false
28classical=false
29opts=$(getopt --options "a:h" --longoptions "archive-dir:,build-dir:,source-dir:,cbt:,help,use-existing,classical" --name $prog_name -- "$@")
30eval set -- "$opts"
31
32while 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
71done
72
73if test $# -gt 0; then
74 config_files="$@"
75else
76 echo "$prog_name: please specify one or more .yaml files" 1>&2
77 usage $prog_name
78 return 1
79fi
80
81if 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
84fi
85
86# store absolute path before changing cwd
87source_dir=$(readlink -f $source_dir)
88if ! $use_existing; then
f67539c2 89 cd $build_dir || exit
9f95a23c
TL
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
f67539c2
TL
94 max_io=$(expr 32768 \* "$(nproc)")
95 if test "$(/sbin/sysctl --values fs.aio-max-nr)" -lt $max_io; then
9f95a23c
TL
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 \
f67539c2 100 --without-dashboard
9f95a23c
TL
101 else
102 MDS=0 MGR=1 OSD=3 MON=1 $source_dir/src/vstart.sh -n -X \
103 --without-dashboard --memstore \
104 -o "memstore_device_bytes=34359738368" \
105 --crimson --nodaemon --redirect-output \
106 --osd-args "--memory 4G"
107 fi
f67539c2 108 cd - || exit
9f95a23c
TL
109fi
110
111for config_file in $config_files; do
112 echo "testing $config_file"
113 cbt_config=$(mktemp $config_file.XXXX.yaml)
114 python3 $source_dir/src/test/crimson/cbt/t2c.py \
115 --build-dir $build_dir \
116 --input $config_file \
117 --output $cbt_config
118 python3 $cbt_dir/cbt.py \
119 --archive $archive_dir \
120 --conf $build_dir/ceph.conf \
121 $cbt_config
122 rm -f $cbt_config
123done
124
125if ! $use_existing; then
f67539c2 126 cd $build_dir || exit
9f95a23c
TL
127 if $classical; then
128 $source_dir/src/stop.sh
129 else
130 $source_dir/src/stop.sh --crimson
131 fi
132fi