Merge pull request #29631 from taosdata/test/main_ci_sh
test:alter branch build
This commit is contained in:
commit
95985fd7e5
|
@ -33,37 +33,6 @@ function printHelp() {
|
|||
exit 0
|
||||
}
|
||||
|
||||
# Initialization parameter
|
||||
PROJECT_DIR=""
|
||||
BRANCH=""
|
||||
TEST_TYPE=""
|
||||
SAVE_LOG="notsave"
|
||||
|
||||
# Parse command line parameters
|
||||
while getopts "hb:d:t:s:" arg; do
|
||||
case $arg in
|
||||
d)
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
;;
|
||||
t)
|
||||
TEST_TYPE=$OPTARG
|
||||
;;
|
||||
s)
|
||||
SAVE_LOG=$OPTARG
|
||||
;;
|
||||
h)
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
function get_DIR() {
|
||||
today=`date +"%Y%m%d"`
|
||||
if [ -z "$PROJECT_DIR" ]; then
|
||||
|
@ -102,13 +71,6 @@ function get_DIR() {
|
|||
fi
|
||||
}
|
||||
|
||||
get_DIR
|
||||
echo "PROJECT_DIR = $PROJECT_DIR"
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
echo "BUILD_DIR = $BUILD_DIR"
|
||||
echo "BACKUP_DIR = $BACKUP_DIR"
|
||||
|
||||
|
||||
function buildTDengine() {
|
||||
print_color "$GREEN" "TDengine build start"
|
||||
|
||||
|
@ -118,14 +80,14 @@ function buildTDengine() {
|
|||
# pull tdinternal code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "Git pull TDinternal code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "Git pull TDengine code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
|
@ -137,12 +99,12 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
# git reset --hard
|
||||
# git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
# git checkout -- .
|
||||
# git clean -f
|
||||
# git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/../debug ] || mkdir $TDENGINE_DIR/../debug
|
||||
cd $TDENGINE_DIR/../debug
|
||||
|
@ -155,15 +117,15 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j 8 install
|
||||
make -j $(nproc) install
|
||||
|
||||
else
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "Git pull TDengine code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
|
@ -175,12 +137,12 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
# git reset --hard
|
||||
# git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
# git checkout -- .
|
||||
# git clean -f
|
||||
# git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
|
@ -193,24 +155,12 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j 8 install
|
||||
make -j $(nproc) install
|
||||
fi
|
||||
|
||||
print_color "$GREEN" "TDengine build end"
|
||||
}
|
||||
|
||||
|
||||
# Check and get the branch name
|
||||
if [ -n "$BRANCH" ] ; then
|
||||
branch="$BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
else
|
||||
print_color "$GREEN" "Build is not required for this test!"
|
||||
fi
|
||||
|
||||
|
||||
function runCasesOneByOne () {
|
||||
while read -r line; do
|
||||
if [[ "$line" != "#"* ]]; then
|
||||
|
@ -264,7 +214,7 @@ function runUnitTest() {
|
|||
cd $BUILD_DIR
|
||||
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||
sleep 10
|
||||
ctest -E "cunit_test" -j8
|
||||
ctest -E "cunit_test" -j4
|
||||
print_color "$GREEN" "3.0 unit test done"
|
||||
}
|
||||
|
||||
|
@ -314,7 +264,6 @@ function runPythonCases() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
function runTest() {
|
||||
print_color "$GREEN" "run Test"
|
||||
|
||||
|
@ -344,7 +293,7 @@ function stopTaosd {
|
|||
sleep 1
|
||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||
done
|
||||
print_color "$GREEN" "Stop tasod end"
|
||||
print_color "$GREEN" "Stop taosd end"
|
||||
}
|
||||
|
||||
function stopTaosadapter {
|
||||
|
@ -357,10 +306,52 @@ function stopTaosadapter {
|
|||
sleep 1
|
||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||
done
|
||||
print_color "$GREEN" "Stop tasoadapter end"
|
||||
print_color "$GREEN" "Stop taosadapter end"
|
||||
|
||||
}
|
||||
|
||||
######################
|
||||
# main entry
|
||||
######################
|
||||
|
||||
# Initialization parameter
|
||||
PROJECT_DIR=""
|
||||
BRANCH=""
|
||||
TEST_TYPE=""
|
||||
SAVE_LOG="notsave"
|
||||
|
||||
# Parse command line parameters
|
||||
while getopts "hb:d:t:s:" arg; do
|
||||
case $arg in
|
||||
d)
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
;;
|
||||
t)
|
||||
TEST_TYPE=$OPTARG
|
||||
;;
|
||||
s)
|
||||
SAVE_LOG=$OPTARG
|
||||
;;
|
||||
h)
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
get_DIR
|
||||
echo "PROJECT_DIR = $PROJECT_DIR"
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
echo "BUILD_DIR = $BUILD_DIR"
|
||||
echo "BACKUP_DIR = $BACKUP_DIR"
|
||||
|
||||
# Run all ci case
|
||||
WORK_DIR=$TDENGINE_DIR
|
||||
|
||||
date >> $WORK_DIR/date.log
|
||||
|
@ -368,6 +359,17 @@ print_color "$GREEN" "Run all ci test cases" | tee -a $WORK_DIR/date.log
|
|||
|
||||
stopTaosd
|
||||
|
||||
# Check and get the branch name
|
||||
if [ -n "$BRANCH" ] ; then
|
||||
branch="$BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
else
|
||||
print_color "$GREEN" "Build is not required for this test!"
|
||||
fi
|
||||
|
||||
# Run different types of case
|
||||
if [ -z "$TEST_TYPE" -o "$TEST_TYPE" = "all" -o "$TEST_TYPE" = "ALL" ]; then
|
||||
runTest
|
||||
elif [ "$TEST_TYPE" = "python" -o "$TEST_TYPE" = "PYTHON" ]; then
|
||||
|
|
|
@ -41,49 +41,6 @@ function printHelp() {
|
|||
}
|
||||
|
||||
|
||||
PROJECT_DIR=""
|
||||
CAPTURE_GCDA_DIR=""
|
||||
TEST_CASE="task"
|
||||
UNIT_TEST_CASE=""
|
||||
BRANCH=""
|
||||
BRANCH_BUILD=""
|
||||
LCOV_DIR="/usr/local/bin"
|
||||
|
||||
# Parse command line parameters
|
||||
while getopts "hd:b:f:c:u:i:l:" arg; do
|
||||
case $arg in
|
||||
d)
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
;;
|
||||
f)
|
||||
CAPTURE_GCDA_DIR=$OPTARG
|
||||
;;
|
||||
c)
|
||||
TEST_CASE=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_TEST_CASE=$OPTARG
|
||||
;;
|
||||
i)
|
||||
BRANCH_BUILD=$OPTARG
|
||||
;;
|
||||
l)
|
||||
LCOV_DIR=$OPTARG
|
||||
;;
|
||||
h)
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# Find the project/tdengine/build/capture directory
|
||||
function get_DIR() {
|
||||
today=`date +"%Y%m%d"`
|
||||
|
@ -118,18 +75,6 @@ function get_DIR() {
|
|||
}
|
||||
|
||||
|
||||
# Show all parameters
|
||||
get_DIR
|
||||
echo "PROJECT_DIR = $PROJECT_DIR"
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
echo "BUILD_DIR = $BUILD_DIR"
|
||||
echo "CAPTURE_GCDA_DIR = $CAPTURE_GCDA_DIR"
|
||||
echo "TEST_CASE = $TEST_CASE"
|
||||
echo "UNIT_TEST_CASE = $UNIT_TEST_CASE"
|
||||
echo "BRANCH_BUILD = $BRANCH_BUILD"
|
||||
echo "LCOV_DIR = $LCOV_DIR"
|
||||
|
||||
|
||||
function buildTDengine() {
|
||||
print_color "$GREEN" "TDengine build start"
|
||||
|
||||
|
@ -139,14 +84,14 @@ function buildTDengine() {
|
|||
# pull tdinternal code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "Git pull TDinternal code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "Git pull TDengine code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
|
@ -158,12 +103,12 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
# git reset --hard
|
||||
# git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
# git checkout -- .
|
||||
# git clean -f
|
||||
# git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/../debug ] || mkdir $TDENGINE_DIR/../debug
|
||||
cd $TDENGINE_DIR/../debug
|
||||
|
@ -183,8 +128,8 @@ function buildTDengine() {
|
|||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "Git pull TDengine code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
# git remote prune origin > /dev/null
|
||||
# git remote update > /dev/null
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
|
@ -196,12 +141,12 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
# git reset --hard
|
||||
# git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
# git checkout -- .
|
||||
# git clean -f
|
||||
# git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
|
@ -220,44 +165,6 @@ function buildTDengine() {
|
|||
print_color "$GREEN" "TDengine build end"
|
||||
}
|
||||
|
||||
# Check and get the branch name and build branch
|
||||
if [ -n "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||
branch="$BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "YES" -o "$BRANCH_BUILD" = "yes" ] ; then
|
||||
CURRENT_DIR=$(pwd)
|
||||
echo "CURRENT_DIR: $CURRENT_DIR"
|
||||
if [ -d .git ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "CURRENT_BRANCH: $CURRENT_BRANCH"
|
||||
else
|
||||
echo "The current directory is not a Git repository"
|
||||
fi
|
||||
branch="$CURRENT_BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "ONLY_INSTALL" -o "$BRANCH_BUILD" = "only_install" ] ; then
|
||||
CURRENT_DIR=$(pwd)
|
||||
echo "CURRENT_DIR: $CURRENT_DIR"
|
||||
if [ -d .git ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "CURRENT_BRANCH: $CURRENT_BRANCH"
|
||||
else
|
||||
echo "The current directory is not a Git repository"
|
||||
fi
|
||||
branch="$CURRENT_BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "not build,only install!"
|
||||
cd $TDENGINE_DIR/debug
|
||||
make -j $(nproc) install
|
||||
elif [ -z "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||
print_color "$GREEN" "Build is not required for this test!"
|
||||
fi
|
||||
|
||||
|
||||
function runCasesOneByOne () {
|
||||
while read -r line; do
|
||||
if [[ "$line" != "#"* ]]; then
|
||||
|
@ -481,10 +388,108 @@ function stopTaosadapter {
|
|||
|
||||
}
|
||||
|
||||
######################
|
||||
# main entry
|
||||
######################
|
||||
|
||||
# Initialization parameter
|
||||
PROJECT_DIR=""
|
||||
CAPTURE_GCDA_DIR=""
|
||||
TEST_CASE="task"
|
||||
UNIT_TEST_CASE=""
|
||||
BRANCH=""
|
||||
BRANCH_BUILD=""
|
||||
LCOV_DIR="/usr/local/bin"
|
||||
|
||||
# Parse command line parameters
|
||||
while getopts "hd:b:f:c:u:i:l:" arg; do
|
||||
case $arg in
|
||||
d)
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
;;
|
||||
f)
|
||||
CAPTURE_GCDA_DIR=$OPTARG
|
||||
;;
|
||||
c)
|
||||
TEST_CASE=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_TEST_CASE=$OPTARG
|
||||
;;
|
||||
i)
|
||||
BRANCH_BUILD=$OPTARG
|
||||
;;
|
||||
l)
|
||||
LCOV_DIR=$OPTARG
|
||||
;;
|
||||
h)
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# Show all parameters
|
||||
get_DIR
|
||||
echo "PROJECT_DIR = $PROJECT_DIR"
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
echo "BUILD_DIR = $BUILD_DIR"
|
||||
echo "CAPTURE_GCDA_DIR = $CAPTURE_GCDA_DIR"
|
||||
echo "TEST_CASE = $TEST_CASE"
|
||||
echo "UNIT_TEST_CASE = $UNIT_TEST_CASE"
|
||||
echo "BRANCH_BUILD = $BRANCH_BUILD"
|
||||
echo "LCOV_DIR = $LCOV_DIR"
|
||||
|
||||
|
||||
date >> $TDENGINE_DIR/date.log
|
||||
print_color "$GREEN" "Run local coverage test cases" | tee -a $TDENGINE_DIR/date.log
|
||||
|
||||
|
||||
# Check and get the branch name and build branch
|
||||
if [ -n "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||
branch="$BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "YES" -o "$BRANCH_BUILD" = "yes" ] ; then
|
||||
CURRENT_DIR=$(pwd)
|
||||
echo "CURRENT_DIR: $CURRENT_DIR"
|
||||
if [ -d .git ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "CURRENT_BRANCH: $CURRENT_BRANCH"
|
||||
else
|
||||
echo "The current directory is not a Git repository"
|
||||
fi
|
||||
branch="$CURRENT_BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "ONLY_INSTALL" -o "$BRANCH_BUILD" = "only_install" ] ; then
|
||||
CURRENT_DIR=$(pwd)
|
||||
echo "CURRENT_DIR: $CURRENT_DIR"
|
||||
if [ -d .git ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "CURRENT_BRANCH: $CURRENT_BRANCH"
|
||||
else
|
||||
echo "The current directory is not a Git repository"
|
||||
fi
|
||||
branch="$CURRENT_BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "not build,only install!"
|
||||
cd $TDENGINE_DIR/debug
|
||||
make -j $(nproc) install
|
||||
elif [ -z "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||
print_color "$GREEN" "Build is not required for this test!"
|
||||
fi
|
||||
|
||||
|
||||
stopTaosd
|
||||
|
||||
runTest
|
||||
|
|
Loading…
Reference in New Issue