blob: 54bb9a47727eccb610d061dca331bc3e411da620 [file] [log] [blame]
Alok Bhattf10e1692020-11-13 22:35:49 +00001#!/bin/bash
2##############################################################################
3#
Alok Bhatt6c0c6d32020-11-30 14:15:57 +00004# Copyright (c) 2020 AT&T Intellectual Property.
5# Copyright (c) 2020 Nokia.
6# Copyright (c) 2020 HCL Technologies
Alok Bhattf10e1692020-11-13 22:35:49 +00007#
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
20##############################################################################
21
22# Installs prerequisites needed to compile & test SDL code
23# and build RPM/DEB packages on a Debian/Ubuntu machine.
24
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000025echo "--> setup-dbaas-build-deb.sh"
Alok Bhattf10e1692020-11-13 22:35:49 +000026
27# Ensure we fail the job if any steps fail.
28set -eux -o pipefail
29
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000030# NOTE: The valgrind false positive problem could also potentially be solved
31# with valgrind suppression files but that kind of approach may be fragile.
32
Alok Bhattf10e1692020-11-13 22:35:49 +000033# install prereqs
34sudo apt-get update && sudo apt-get -q -y install \
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000035 automake \
36 autoconf \
37 cmake \
38 curl \
39 g++ \
40 gcc \
41 libtool \
42 make \
43 pkg-config \
44 valgrind \
45 lcov
Alok Bhattf10e1692020-11-13 22:35:49 +000046
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000047# Cpputest built-in memory checks generate false positives in valgrind.
48# This is solved by compiling cpputest with memory checking disabled.
49
50mkdir -p cpputest/builddir
51cd cpputest
52
Alok Bhattf10e1692020-11-13 22:35:49 +000053curl -L https://github.com/cpputest/cpputest/releases/download/v3.8/cpputest-3.8.tar.gz | \
54 tar --strip-components=1 -xzf -
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000055cd builddir
56cmake -DMEMORY_LEAK_DETECTION=OFF .. && \
Alok Bhattf10e1692020-11-13 22:35:49 +000057sudo make install
Alok Bhatt6c0c6d32020-11-30 14:15:57 +000058cd ../..
59# generate configure script
60cd redismodule
61./autogen.sh && \
62 ./configure && \
63sudo make test
64
65# generate configure script with memory checking disabled.
66
67./autogen.sh && \
68 ./configure --disable-unit-test-memcheck && \
69sudo make test
70cd ..
71
72#Copy configure to $WORKSPACE
73
74cp -r cpputest/* .
75
76echo "--> setup-dbaas-build-deb.sh ends"