make-and-install.sh 3.9 KB
Newer Older
L
LiFeng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/bin/sh
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
# - iSulad licensed under the Mulan PSL v2.
# - You can use this software according to the terms and conditions of the Mulan PSL v2.
# - You may obtain a copy of Mulan PSL v2 at:
# -     http://license.coscl.org.cn/MulanPSL2
# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# - PURPOSE.
# - See the Mulan PSL v2 for more details.
##- @Description:CI
##- @Author: lifeng
##- @Create: 2020-03-30
#######################################################################

PWD=`pwd`
basepath=$(cd `dirname $0`; pwd)
cd ${PWD}

set -xe

# install depend libs
builddir=`env | grep BUILDDIR | awk -F '=' '{print $2}'`
restbuilddir=${builddir}/rest
mkdir -p $builddir

mkdir -p $restbuilddir
mkdir -p $restbuilddir/bin
mkdir -p $restbuilddir/etc
mkdir -p $restbuilddir/include
mkdir -p $restbuilddir/lib
mkdir -p $restbuilddir/systemd

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${builddir}/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:${builddir}/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/usr/local/include:${builddir}/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/include:${builddir}/include:$CPLUS_INCLUDE_PATH
export PATH=${builddir}/bin:$PATH

L
lifeng68 已提交
41
ISULAD_SRC_PATH=`env | grep TOPDIR | awk -F '=' '{print $2}'`
L
LiFeng 已提交
42 43 44 45 46 47 48 49 50
export ISULAD_COPY_PATH=~/iSulad
export LCR_SRC_PATH=~/lcr/

export valgrind_log="/tmp/valgrind.log"
export PATH=$PATH:/usr/local/go/bin

umask 0022
cp -r $ISULAD_SRC_PATH $ISULAD_COPY_PATH

L
lifeng68 已提交
51 52 53 54 55 56 57
#Init GCOV configs
set +e
if [[ "x${GCOV}" == "xON" ]]; then
  export enable_gcov=1
fi
set -e

L
LiFeng 已提交
58 59 60 61 62 63 64 65 66 67 68 69
function echo_success()
{
    echo -e "\033[1;32m"$@"\033[0m"
}

function echo_error()
{
    echo -e "\033[1;31m"$@"\033[0m"
}

source $basepath/install_depends.sh

L
lifeng68 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82
echo_success "===================RUN DT-LLT TESTCASES START========================="
cd $ISULAD_COPY_PATH
rm -rf build
cd ./test
./test.sh -mcoverage -c -r -t
if [[ $? -ne 0 ]]; then
    exit 1
fi
ISULAD_SRC_PATH=$(env | grep TOPDIR | awk -F = '{print $2}')
tar -zcf $ISULAD_SRC_PATH/isulad-llt-gcov.tar.gz ./coverage
./test.sh -e
echo_success "===================RUN DT-LLT TESTCASES END========================="

L
LiFeng 已提交
83 84 85 86 87 88 89
cd $ISULAD_COPY_PATH
sed -i 's/fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO/fd == 0 || fd == 1 || fd == 2 || fd >= 1000/g' ./src/cutils/utils.c

#build grpc version
rm -rf build
mkdir build
cd build
L
lifeng68 已提交
90 91 92 93 94
if [[ ${enable_gcov} -ne 1 ]]; then
  cmake -DLIB_INSTALL_DIR=${builddir}/lib -DCMAKE_INSTALL_PREFIX=${builddir} -DCMAKE_INSTALL_SYSCONFDIR=${builddir}/etc -DCMAKE_BUILD_TYPE=debug -DGCOV=ON -DENABLE_EMBEDDED=ON ..
else
  cmake -DLIB_INSTALL_DIR=${builddir}/lib -DCMAKE_INSTALL_PREFIX=${builddir} -DCMAKE_INSTALL_SYSCONFDIR=${builddir}/etc -DENABLE_EMBEDDED=ON ..
fi
L
LiFeng 已提交
95 96 97
make -j $(nproc)
make install
sed -i 's/"log-driver": "stdout"/"log-driver": "file"/g' ${builddir}/etc/isulad/daemon.json
L
LiFeng 已提交
98
sed -i "/registry-mirrors/a\        \"https://hub-mirror.c.163.com\"" ${builddir}/etc/isulad/daemon.json
L
LiFeng 已提交
99 100 101 102 103 104

# build rest version
cd $ISULAD_COPY_PATH
rm -rf build
mkdir build
cd build
L
lifeng68 已提交
105 106 107 108 109 110

if [[ ${enable_gcov} -ne 0 ]]; then
  cmake -DLIB_INSTALL_DIR=${restbuilddir}/lib -DCMAKE_INSTALL_PREFIX=${restbuilddir} -DCMAKE_INSTALL_SYSCONFDIR=${restbuilddir}/etc -DCMAKE_BUILD_TYPE=debug -DGCOV=ON -DENABLE_EMBEDDED=ON -DENABLE_GRPC=OFF -DDISABLE_OCI=ON ..
else
  cmake -DLIB_INSTALL_DIR=${restbuilddir}/lib -DCMAKE_INSTALL_PREFIX=${restbuilddir} -DCMAKE_INSTALL_SYSCONFDIR=${restbuilddir}/etc -DENABLE_EMBEDDED=ON -DENABLE_GRPC=OFF -DDISABLE_OCI=ON ..
fi
L
LiFeng 已提交
111 112 113
make -j $(nproc)
make install
sed -i 's/"log-driver": "stdout"/"log-driver": "file"/g' ${restbuilddir}/etc/isulad/daemon.json
L
LiFeng 已提交
114
sed -i "/registry-mirrors/a\        \"https://hub-mirror.c.163.com\"" ${restbuilddir}/etc/isulad/daemon.json