]> git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/rados/test_librados_build.sh
update sources to 12.2.10
[ceph.git] / ceph / qa / workunits / rados / test_librados_build.sh
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
11 trap cleanup EXIT
12
13 SOURCES="hello_radosstriper.cc
14 hello_world_c.c
15 hello_world.cc
16 Makefile
17 "
18 BINARIES_TO_RUN="hello_world_c
19 hello_world_cpp
20 "
21 BINARIES="${BINARIES_TO_RUN}hello_radosstriper_cpp
22 "
23 DL_PREFIX="http://git.ceph.com/?p=ceph.git;a=blob_plain;f=examples/librados/"
24 #DL_PREFIX="https://raw.githubusercontent.com/ceph/ceph/master/examples/librados/"
25 DESTDIR=$(pwd)
26
27 function cleanup () {
28 for f in $BINARIES$SOURCES ; do
29 rm -f "${DESTDIR}/$f"
30 done
31 }
32
33 function get_sources () {
34 for s in $SOURCES ; do
35 curl --progress-bar --output $s ${DL_PREFIX}$s
36 done
37 }
38
39 function check_sources () {
40 for s in $SOURCES ; do
41 test -f $s
42 done
43 }
44
45 function check_binaries () {
46 for b in $BINARIES ; do
47 file $b
48 test -f $b
49 done
50 }
51
52 function run_binaries () {
53 for b in $BINARIES_TO_RUN ; do
54 ./$b -c /etc/ceph/ceph.conf
55 done
56 }
57
58 pushd $DESTDIR
59 get_sources
60 check_sources
61 make all-system
62 check_binaries
63 run_binaries
64 popd