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