run_case.sh 1023 字节
Newer Older
1 2 3 4 5 6 7 8
#!/bin/bash

CONTAINER_TESTDIR=/home/community

function usage() {
    echo "$0"
    echo -e "\t -d execution dir"
    echo -e "\t -c command"
T
tangfangzhi 已提交
9
    echo -e "\t -o default timeout value"
10 11 12
    echo -e "\t -h help"
}

T
tangfangzhi 已提交
13
while getopts "d:c:o:h" opt; do
14 15 16 17 18 19 20
    case $opt in
        d)
            exec_dir=$OPTARG
            ;;
        c)
            cmd=$OPTARG
            ;;
T
tangfangzhi 已提交
21 22 23
        o)
            TIMEOUT_CMD="timeout $OPTARG"
            ;;
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
        h)
            usage
            exit 0
            ;;
        \?)
            echo "Invalid option: -$OPTARG"
            usage
            exit 0
            ;;
    esac
done

if [ -z "$exec_dir" ]; then
    usage
    exit 0
fi
if [ -z "$cmd" ]; then
    usage
    exit 0
fi

T
tangfangzhi 已提交
45
export PATH=$PATH:/home/debug/build/bin
46 47 48 49 50 51 52
ln -s  /home/debug/build/lib/libtaos.so /usr/lib/libtaos.so 2>/dev/null
mkdir -p /home/sim/tsim
mkdir -p /var/lib/taos/subscribe

cd $CONTAINER_TESTDIR/tests/$exec_dir
ulimit -c unlimited

T
tangfangzhi 已提交
53
$TIMEOUT_CMD $cmd
54 55 56 57 58 59 60 61
RET=$?

if [ $RET -ne 0 ]; then
    pwd
fi

exit $RET