]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rados/test_librados_build.sh
import 14.2.4 nautilus point release
[ceph.git] / ceph / qa / workunits / rados / test_librados_build.sh
CommitLineData
91327a77
AA
1#!/bin/bash -ex
2#
3# Compile and run a librados application outside of the ceph build system, so
4# that we can be sure librados.h[pp] is still usable and hasn't accidentally
5# started depending on internal headers.
6#
7# The script assumes all dependencies - e.g. curl, make, gcc, librados headers,
8# libradosstriper headers, boost headers, etc. - are already installed.
9#
10
494da23a
TL
11source $(dirname $0)/../ceph-helpers-root.sh
12
91327a77
AA
13trap cleanup EXIT
14
15SOURCES="hello_radosstriper.cc
16hello_world_c.c
17hello_world.cc
18Makefile
19"
20BINARIES_TO_RUN="hello_world_c
21hello_world_cpp
22"
23BINARIES="${BINARIES_TO_RUN}hello_radosstriper_cpp
24"
11fdf7f2
TL
25DL_PREFIX="http://git.ceph.com/?p=ceph.git;a=blob_plain;hb=master;f=examples/librados/"
26#DL_PREFIX="https://raw.githubusercontent.com/ceph/ceph/master/examples/librados/"
91327a77
AA
27DESTDIR=$(pwd)
28
29function cleanup () {
30 for f in $BINARIES$SOURCES ; do
31 rm -f "${DESTDIR}/$f"
32 done
33}
34
35function get_sources () {
36 for s in $SOURCES ; do
37 curl --progress-bar --output $s ${DL_PREFIX}$s
38 done
39}
40
41function check_sources () {
42 for s in $SOURCES ; do
43 test -f $s
44 done
45}
46
47function check_binaries () {
48 for b in $BINARIES ; do
49 file $b
50 test -f $b
51 done
52}
53
54function run_binaries () {
55 for b in $BINARIES_TO_RUN ; do
56 ./$b -c /etc/ceph/ceph.conf
57 done
58}
59
60pushd $DESTDIR
494da23a
TL
61case $(distro_id) in
62 centos|fedora|rhel|opensuse*|suse|sles)
63 install gcc-c++ make libradospp-devel librados-devel;;
64 ubuntu|debian|devuan)
65 install g++ make libradospp-dev librados-dev;;
66 *)
67 echo "$(distro_id) is unknown, $@ will have to be installed manually."
68esac
91327a77
AA
69get_sources
70check_sources
71make all-system
72check_binaries
73run_binaries
74popd