]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rados/test_envlibrados_for_rocksdb.sh
import 15.2.4
[ceph.git] / ceph / qa / workunits / rados / test_envlibrados_for_rocksdb.sh
CommitLineData
11fdf7f2
TL
1#!/usr/bin/env bash
2set -ex
3
7c673cae
FG
4############################################
5# Helper functions
6############################################
494da23a 7source $(dirname $0)/../ceph-helpers-root.sh
7c673cae 8
7c673cae
FG
9############################################
10# Install required tools
11############################################
12echo "Install required tools"
7c673cae
FG
13
14CURRENT_PATH=`pwd`
15
16############################################
17# Compile&Start RocksDB
18############################################
19# install prerequisites
20# for rocksdb
494da23a
TL
21case $(distro_id) in
22 ubuntu|debian|devuan)
e306af50 23 install git g++ libsnappy-dev zlib1g-dev libbz2-dev libradospp-dev cmake
7c673cae 24 ;;
494da23a 25 centos|fedora|rhel)
9f95a23c
TL
26 case $(distro_id) in
27 centos)
28 # centos needs PowerTools repo for snappy-devel
29 test -x /usr/bin/dnf && sudo dnf config-manager --set-enabled PowerTools || true
30 ;;
31 rhel)
32 # RHEL needs CRB repo for snappy-devel
33 sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-x86_64-rpms"
34 ;;
35 esac
36 install git gcc-c++.x86_64 snappy-devel zlib zlib-devel bzip2 bzip2-devel libradospp-devel.x86_64 cmake
37 ;;
494da23a 38 opensuse*|suse|sles)
eafe8130 39 install git gcc-c++ snappy-devel zlib-devel libbz2-devel libradospp-devel
494da23a 40 ;;
7c673cae 41 *)
494da23a 42 echo "$(distro_id) is unknown, $@ will have to be installed manually."
7c673cae
FG
43 ;;
44esac
45
46# # gflags
47# sudo yum install gflags-devel
48#
49# wget https://github.com/schuhschuh/gflags/archive/master.zip
50# unzip master.zip
51# cd gflags-master
52# mkdir build && cd build
53# export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
54# make && make install
55
56# # snappy-devel
57
58
59echo "Compile rocksdb"
60if [ -e rocksdb ]; then
61 rm -fr rocksdb
62fi
e306af50
TL
63
64pushd $(dirname /home/ubuntu/cephtest/clone.client.0/qa/workunits/rados/bash.sh)/../../../
65git submodule update --init src/rocksdb
66popd
67git clone $(dirname /home/ubuntu/cephtest/clone.client.0/qa/workunits/rados/bash.sh)/../../../src/rocksdb rocksdb
7c673cae
FG
68
69# compile code
70cd rocksdb
eafe8130
TL
71if type cmake3 > /dev/null 2>&1 ; then
72 CMAKE=cmake3
73else
74 CMAKE=cmake
75fi
9f95a23c
TL
76
77[ -z "$BUILD_DIR" ] && BUILD_DIR=build
78mkdir ${BUILD_DIR} && cd ${BUILD_DIR} && ${CMAKE} -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON -DWITH_LIBRADOS=ON -DWITH_SNAPPY=ON -DWITH_GFLAGS=OFF -DFAIL_ON_WARNINGS=OFF ..
11fdf7f2 79make rocksdb_env_librados_test -j8
7c673cae
FG
80
81echo "Copy ceph.conf"
82# prepare ceph.conf
83mkdir -p ../ceph/src/
84if [ -f "/etc/ceph/ceph.conf" ]; then
85 cp /etc/ceph/ceph.conf ../ceph/src/
86elif [ -f "/etc/ceph/ceph/ceph.conf" ]; then
87 cp /etc/ceph/ceph/ceph.conf ../ceph/src/
88else
89 echo "/etc/ceph/ceph/ceph.conf doesn't exist"
90fi
91
92echo "Run EnvLibrados test"
93# run test
94if [ -f "../ceph/src/ceph.conf" ]
95 then
96 cp env_librados_test ~/cephtest/archive
97 ./env_librados_test
98else
99 echo "../ceph/src/ceph.conf doesn't exist"
100fi
101cd ${CURRENT_PATH}