]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #!/usr/bin/env bash |
2 | set -ex | |
3 | ||
7c673cae FG |
4 | ############################################ |
5 | # Helper functions | |
6 | ############################################ | |
494da23a | 7 | source $(dirname $0)/../ceph-helpers-root.sh |
7c673cae | 8 | |
7c673cae FG |
9 | ############################################ |
10 | # Install required tools | |
11 | ############################################ | |
12 | echo "Install required tools" | |
7c673cae FG |
13 | |
14 | CURRENT_PATH=`pwd` | |
15 | ||
16 | ############################################ | |
17 | # Compile&Start RocksDB | |
18 | ############################################ | |
19 | # install prerequisites | |
20 | # for rocksdb | |
494da23a TL |
21 | case $(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 | ;; |
44 | esac | |
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 | ||
59 | echo "Compile rocksdb" | |
60 | if [ -e rocksdb ]; then | |
61 | rm -fr rocksdb | |
62 | fi | |
e306af50 TL |
63 | |
64 | pushd $(dirname /home/ubuntu/cephtest/clone.client.0/qa/workunits/rados/bash.sh)/../../../ | |
65 | git submodule update --init src/rocksdb | |
66 | popd | |
67 | git clone $(dirname /home/ubuntu/cephtest/clone.client.0/qa/workunits/rados/bash.sh)/../../../src/rocksdb rocksdb | |
7c673cae FG |
68 | |
69 | # compile code | |
70 | cd rocksdb | |
eafe8130 TL |
71 | if type cmake3 > /dev/null 2>&1 ; then |
72 | CMAKE=cmake3 | |
73 | else | |
74 | CMAKE=cmake | |
75 | fi | |
9f95a23c TL |
76 | |
77 | [ -z "$BUILD_DIR" ] && BUILD_DIR=build | |
78 | 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 .. | |
11fdf7f2 | 79 | make rocksdb_env_librados_test -j8 |
7c673cae FG |
80 | |
81 | echo "Copy ceph.conf" | |
82 | # prepare ceph.conf | |
83 | mkdir -p ../ceph/src/ | |
84 | if [ -f "/etc/ceph/ceph.conf" ]; then | |
85 | cp /etc/ceph/ceph.conf ../ceph/src/ | |
86 | elif [ -f "/etc/ceph/ceph/ceph.conf" ]; then | |
87 | cp /etc/ceph/ceph/ceph.conf ../ceph/src/ | |
88 | else | |
89 | echo "/etc/ceph/ceph/ceph.conf doesn't exist" | |
90 | fi | |
91 | ||
92 | echo "Run EnvLibrados test" | |
93 | # run test | |
94 | if [ -f "../ceph/src/ceph.conf" ] | |
95 | then | |
96 | cp env_librados_test ~/cephtest/archive | |
97 | ./env_librados_test | |
98 | else | |
99 | echo "../ceph/src/ceph.conf doesn't exist" | |
100 | fi | |
101 | cd ${CURRENT_PATH} |