container_build.sh 1.9 KB
Newer Older
T
tangfangzhi 已提交
1
#!/bin/bash
haoranc's avatar
haoranc 已提交
2
set -e 
T
tangfangzhi 已提交
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

function usage() {
    echo "$0"
    echo -e "\t -w work dir"
    echo -e "\t -e enterprise edition"
    echo -e "\t -t make thread count"
    echo -e "\t -h help"
}

ent=0
while getopts "w:t:eh" opt; do
    case $opt in
        w)
            WORKDIR=$OPTARG
            ;;
        e)
            ent=1
            ;;
        t)
            THREAD_COUNT=$OPTARG
            ;;
        h)
            usage
            exit 0
            ;;
        \?)
            echo "Invalid option: -$OPTARG"
            usage
            exit 0
            ;;
    esac
done

if [ -z "$WORKDIR" ]; then
    usage
    exit 1
fi
haoranc's avatar
haoranc 已提交
40 41 42
# if [ -z "$THREAD_COUNT" ]; then
#     THREAD_COUNT=1
# fi
T
tangfangzhi 已提交
43 44 45 46 47

ulimit -c unlimited

if [ $ent -eq 0 ]; then
    REP_DIR=/home/TDengine
48 49
    REP_REAL_PATH=$WORKDIR/TDengine
    REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDengine
T
tangfangzhi 已提交
50 51
else
    REP_DIR=/home/TDinternal
52 53
    REP_REAL_PATH=$WORKDIR/TDinternal
    REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDinternal
T
tangfangzhi 已提交
54
fi
55
date 
T
tangfangzhi 已提交
56 57
docker run \
    -v $REP_MOUNT_PARAM \
haoranc's avatar
haoranc 已提交
58
    --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
T
tangfangzhi 已提交
59

60
if [[ -d ${WORKDIR}/debugNoSan  ]] ;then
61
    echo "delete  ${WORKDIR}/debugNoSan"
62
    rm -rf  ${WORKDIR}/debugNoSan
63 64 65
fi
if [[ -d ${WORKDIR}/debugSan ]] ;then
    echo "delete  ${WORKDIR}/debugSan"
66 67 68
    rm -rf  ${WORKDIR}/debugSan
fi

69
mv  ${REP_REAL_PATH}/debug  ${WORKDIR}/debugNoSan
70
date
71 72
docker run \
    -v $REP_MOUNT_PARAM \
haoranc's avatar
haoranc 已提交
73
    --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true   -DBUILD_SANITIZER=1  -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
74 75 76

mv  ${REP_REAL_PATH}/debug  ${WORKDIR}/debugSan

T
tangfangzhi 已提交
77 78 79
ret=$?
exit $ret