Merge pull request #29477 from taosdata/test/main_TD33437
Increase TDengine/TDinternal script compatibility
This commit is contained in:
commit
4e4331c654
|
@ -42,7 +42,7 @@ jobs:
|
|||
cmake .. -DBUILD_TOOLS=true \
|
||||
-DBUILD_KEEPER=true \
|
||||
-DBUILD_HTTP=false \
|
||||
-DBUILD_TEST=false \
|
||||
-DBUILD_TEST=true \
|
||||
-DBUILD_DEPENDENCY_TESTS=false
|
||||
make -j 4
|
||||
sudo make install
|
||||
|
|
|
@ -196,14 +196,23 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
|||
setAlterDbFsync(200);
|
||||
setAlterDbWal(1);
|
||||
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
|
||||
#ifndef _STORAGE
|
||||
setAlterDbSttTrigger(-1);
|
||||
#else
|
||||
setAlterDbSttTrigger(16);
|
||||
#endif
|
||||
setAlterDbBuffer(16);
|
||||
setAlterDbPages(128);
|
||||
setAlterDbReplica(3);
|
||||
setAlterDbWalRetentionPeriod(10);
|
||||
setAlterDbWalRetentionSize(20);
|
||||
#ifndef _STORAGE
|
||||
run("ALTER DATABASE test BUFFER 16 CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 PAGES 128 "
|
||||
"REPLICA 3 WAL_LEVEL 1 WAL_RETENTION_PERIOD 10 WAL_RETENTION_SIZE 20");
|
||||
#else
|
||||
run("ALTER DATABASE test BUFFER 16 CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 PAGES 128 "
|
||||
"REPLICA 3 WAL_LEVEL 1 STT_TRIGGER 16 WAL_RETENTION_PERIOD 10 WAL_RETENTION_SIZE 20");
|
||||
#endif
|
||||
clearAlterDbReq();
|
||||
|
||||
initAlterDb("test");
|
||||
|
@ -286,6 +295,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
|||
run("ALTER DATABASE test REPLICA 3");
|
||||
clearAlterDbReq();
|
||||
|
||||
#ifdef _STORAGE
|
||||
initAlterDb("test");
|
||||
setAlterDbSttTrigger(1);
|
||||
run("ALTER DATABASE test STT_TRIGGER 1");
|
||||
|
@ -294,6 +304,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
|||
setAlterDbSttTrigger(16);
|
||||
run("ALTER DATABASE test STT_TRIGGER 16");
|
||||
clearAlterDbReq();
|
||||
#endif
|
||||
|
||||
initAlterDb("test");
|
||||
setAlterDbMinRows(10);
|
||||
|
@ -335,9 +346,9 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
|
|||
run("ALTER DATABASE test KEEP 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
run("ALTER DATABASE test PAGES 63", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
//run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
// run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
//run("ALTER DATABASE test REPLICA 2", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
// run("ALTER DATABASE test REPLICA 2", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
run("ALTER DATABASE test STT_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
run("ALTER DATABASE test STT_TRIGGER 17", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||
// Regardless of the specific sentence
|
||||
|
|
|
@ -249,7 +249,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
|||
for (int32_t i = 0; i < expect.numOfRetensions; ++i) {
|
||||
SRetention* pReten = (SRetention*)taosArrayGet(req.pRetensions, i);
|
||||
SRetention* pExpectReten = (SRetention*)taosArrayGet(expect.pRetensions, i);
|
||||
if(i == 0) {
|
||||
if (i == 0) {
|
||||
ASSERT_EQ(pReten->freq, 0);
|
||||
} else {
|
||||
ASSERT_EQ(pReten->freq, pExpectReten->freq);
|
||||
|
@ -292,10 +292,44 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
|||
setDbWalRetentionSize(-1);
|
||||
setDbWalRollPeriod(10);
|
||||
setDbWalSegmentSize(20);
|
||||
#ifndef _STORAGE
|
||||
setDbSstTrigger(1);
|
||||
#else
|
||||
setDbSstTrigger(16);
|
||||
#endif
|
||||
setDbHashPrefix(3);
|
||||
setDbHashSuffix(4);
|
||||
setDbTsdbPageSize(32);
|
||||
#ifndef _STORAGE
|
||||
run("CREATE DATABASE IF NOT EXISTS wxy_db "
|
||||
"BUFFER 64 "
|
||||
"CACHEMODEL 'last_value' "
|
||||
"CACHESIZE 20 "
|
||||
"COMP 1 "
|
||||
"DURATION 100 "
|
||||
"WAL_FSYNC_PERIOD 100 "
|
||||
"MAXROWS 1000 "
|
||||
"MINROWS 100 "
|
||||
"KEEP 1440 "
|
||||
"PAGES 96 "
|
||||
"PAGESIZE 8 "
|
||||
"PRECISION 'ns' "
|
||||
"REPLICA 3 "
|
||||
"RETENTIONS -:7d,1m:21d,15m:500d "
|
||||
// "STRICT 'on' "
|
||||
"WAL_LEVEL 2 "
|
||||
"VGROUPS 100 "
|
||||
"SINGLE_STABLE 1 "
|
||||
"SCHEMALESS 1 "
|
||||
"WAL_RETENTION_PERIOD -1 "
|
||||
"WAL_RETENTION_SIZE -1 "
|
||||
"WAL_ROLL_PERIOD 10 "
|
||||
"WAL_SEGMENT_SIZE 20 "
|
||||
"STT_TRIGGER 1 "
|
||||
"TABLE_PREFIX 3 "
|
||||
"TABLE_SUFFIX 4 "
|
||||
"TSDB_PAGESIZE 32");
|
||||
#else
|
||||
run("CREATE DATABASE IF NOT EXISTS wxy_db "
|
||||
"BUFFER 64 "
|
||||
"CACHEMODEL 'last_value' "
|
||||
|
@ -324,6 +358,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
|||
"TABLE_PREFIX 3 "
|
||||
"TABLE_SUFFIX 4 "
|
||||
"TSDB_PAGESIZE 32");
|
||||
|
||||
#endif
|
||||
clearCreateDbReq();
|
||||
|
||||
setCreateDbReq("wxy_db", 1);
|
||||
|
@ -583,8 +619,6 @@ TEST_F(ParserInitialCTest, createView) {
|
|||
clearCreateStreamReq();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CREATE MNODE ON DNODE dnode_id
|
||||
*/
|
||||
|
@ -679,7 +713,7 @@ TEST_F(ParserInitialCTest, createSmaIndex) {
|
|||
ASSERT_EQ(QUERY_NODE_SELECT_STMT, nodeType(pQuery->pPrevRoot));
|
||||
|
||||
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pQuery->pRoot;
|
||||
SCmdMsgInfo* pCmdMsg = (SCmdMsgInfo*)taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||
SCmdMsgInfo* pCmdMsg = (SCmdMsgInfo*)taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||
if (NULL == pCmdMsg) FAIL();
|
||||
pCmdMsg->msgType = TDMT_MND_CREATE_SMA;
|
||||
pCmdMsg->msgLen = tSerializeSMCreateSmaReq(NULL, 0, pStmt->pReq);
|
||||
|
@ -1068,7 +1102,8 @@ TEST_F(ParserInitialCTest, createStreamSemanticCheck) {
|
|||
run("CREATE STREAM s2 INTO st1 AS SELECT ts, to_json('{c1:1}') FROM st1 PARTITION BY TBNAME",
|
||||
TSDB_CODE_PAR_INVALID_STREAM_QUERY);
|
||||
run("CREATE STREAM s3 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tbname)) "
|
||||
"AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 INTERVAL(10S)", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
|
||||
"AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 INTERVAL(10S)",
|
||||
TSDB_CODE_PAR_INVALID_STREAM_QUERY);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1296,10 +1331,10 @@ TEST_F(ParserInitialCTest, createTopic) {
|
|||
run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1 WHERE tag1 > 0");
|
||||
clearCreateTopicReq();
|
||||
|
||||
setCreateTopicReq("tp1", 1, "create topic if not exists tp1 with meta as stable st1 where tag1 > 0", nullptr, "test", "st1", 1);
|
||||
setCreateTopicReq("tp1", 1, "create topic if not exists tp1 with meta as stable st1 where tag1 > 0", nullptr, "test",
|
||||
"st1", 1);
|
||||
run("CREATE TOPIC IF NOT EXISTS tp1 WITH META AS STABLE st1 WHERE tag1 > 0");
|
||||
clearCreateTopicReq();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -287,12 +287,12 @@ TEST(TcsTest, InterfaceNonBlobTest) {
|
|||
uint8_t *pBlock = NULL;
|
||||
code = tcsGetObjectBlock(object_name, 0, size, check, &pBlock);
|
||||
GTEST_ASSERT_EQ(code, 0);
|
||||
|
||||
for (int i = 0; i < size / 2; ++i) {
|
||||
GTEST_ASSERT_EQ(pBlock[i * 2], 0);
|
||||
GTEST_ASSERT_EQ(pBlock[i * 2 + 1], 1);
|
||||
if (pBlock) {
|
||||
for (int i = 0; i < size / 2; ++i) {
|
||||
GTEST_ASSERT_EQ(pBlock[i * 2], 0);
|
||||
GTEST_ASSERT_EQ(pBlock[i * 2 + 1], 1);
|
||||
}
|
||||
}
|
||||
|
||||
taosMemoryFree(pBlock);
|
||||
|
||||
code = tcsGetObjectToFile(object_name, path_download);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,16 +13,33 @@ function print_color() {
|
|||
echo -e "${color}${message}${NC}"
|
||||
}
|
||||
|
||||
# 初始化参数
|
||||
TDENGINE_DIR="/root/TDinternal/community"
|
||||
function printHelp() {
|
||||
echo "Usage: $(basename $0) [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -d [Project dir] Project directory (default: outermost project directory)"
|
||||
echo " Options: "
|
||||
echo " e.g., -d /root/TDengine or -d /root/TDinternal"
|
||||
echo " -b [Build test branch] Build test branch (default: null)"
|
||||
echo " Options: "
|
||||
echo " e.g., -b main (pull main branch, build and install)"
|
||||
echo " -s [Save cases log] Save cases log(default: notsave)"
|
||||
echo " Options:"
|
||||
echo " e.g., -c notsave : do not save the log "
|
||||
echo " -c save : default save ci case log in Project dir/tests/ci_bak"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Initialization parameter
|
||||
PROJECT_DIR=""
|
||||
BRANCH=""
|
||||
SAVE_LOG="notsave"
|
||||
|
||||
# 解析命令行参数
|
||||
while getopts "hd:b:t:s:" arg; do
|
||||
# Parse command line parameters
|
||||
while getopts "hb:d:s:" arg; do
|
||||
case $arg in
|
||||
d)
|
||||
TDENGINE_DIR=$OPTARG
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
|
@ -31,11 +48,7 @@ while getopts "hd:b:t:s:" arg; do
|
|||
SAVE_LOG=$OPTARG
|
||||
;;
|
||||
h)
|
||||
echo "Usage: $(basename $0) -d [TDengine_dir] -b [branch] -s [save ci case log]"
|
||||
echo " -d [TDengine_dir] [default /root/TDinternal/community] "
|
||||
echo " -b [branch] [default local branch] "
|
||||
echo " -s [save/notsave] [default save ci case log in TDengine_dir/tests/ci_bak] "
|
||||
exit 0
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
|
@ -44,76 +57,144 @@ while getopts "hd:b:t:s:" arg; do
|
|||
esac
|
||||
done
|
||||
|
||||
# 检查是否提供了命令名称
|
||||
if [ -z "$TDENGINE_DIR" ]; then
|
||||
echo "Error: TDengine dir is required."
|
||||
echo "Usage: $(basename $0) -d [TDengine_dir] -b [branch] -s [save ci case log] "
|
||||
echo " -d [TDengine_dir] [default /root/TDinternal/community] "
|
||||
echo " -b [branch] [default local branch] "
|
||||
echo " -s [save/notsave] [default save ci case log in TDengine_dir/tests/ci_bak] "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function get_DIR() {
|
||||
today=`date +"%Y%m%d"`
|
||||
if [ -z "$PROJECT_DIR" ]; then
|
||||
CODE_DIR=$(dirname $0)
|
||||
cd $CODE_DIR
|
||||
CODE_DIR=$(pwd)
|
||||
if [[ "$CODE_DIR" == *"/community/"* ]]; then
|
||||
PROJECT_DIR=$(realpath ../..)
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
else
|
||||
PROJECT_DIR=$(realpath ..)
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
cp $TDENGINE_DIR/tests/parallel_test/cases.task $TDENGINE_DIR/tests/parallel_test/cases_tdengine.task
|
||||
fi
|
||||
elif [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
cp $TDENGINE_DIR/tests/parallel_test/cases.task $TDENGINE_DIR/tests/parallel_test/cases_tdengine.task
|
||||
elif [[ "$PROJECT_DIR" == *"/TDengine" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
get_DIR
|
||||
echo "PROJECT_DIR = $PROJECT_DIR"
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
today=`date +"%Y%m%d"`
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
#cd $BACKUP_DIR && rm -rf *
|
||||
echo "BUILD_DIR = $BUILD_DIR"
|
||||
echo "BACKUP_DIR = $BACKUP_DIR"
|
||||
|
||||
|
||||
function buildTDengine() {
|
||||
print_color "$GREEN" "TDengine build start"
|
||||
|
||||
# pull parent code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "git pull parent code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
if [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "git pull tdengine code..."
|
||||
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"
|
||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
||||
# pull tdinternal code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "Git pull TDinternal code..."
|
||||
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
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
||||
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
print_color "$GREEN" "Repo up-to-date"
|
||||
else
|
||||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/../debug ] || mkdir $TDENGINE_DIR/../debug
|
||||
cd $TDENGINE_DIR/../debug
|
||||
|
||||
print_color "$GREEN" "Rebuild.."
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
rm -rf *
|
||||
makecmd="cmake -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=false -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../ "
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j 8 install
|
||||
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
print_color "$GREEN" "repo up-to-date"
|
||||
else
|
||||
print_color "$GREEN" "repo need to pull"
|
||||
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
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
||||
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
print_color "$GREEN" "Repo up-to-date"
|
||||
else
|
||||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
|
||||
print_color "$GREEN" "Rebuild.."
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
rm -rf *
|
||||
makecmd="cmake -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=0 -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../ "
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j 8 install
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
|
||||
print_color "$GREEN" "rebuild.."
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
rm -rf *
|
||||
makecmd="cmake -DBUILD_TEST=false -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=0 -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../../"
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j 8 install
|
||||
|
||||
print_color "$GREEN" "TDengine build end"
|
||||
}
|
||||
|
||||
|
||||
# 检查并获取分支名称
|
||||
if [ -n "$BRANCH" ]; then
|
||||
# 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!"
|
||||
|
@ -135,18 +216,11 @@ function runCasesOneByOne () {
|
|||
date +%F\ %T | tee -a $TDENGINE_ALLCI_REPORT && timeout 20m $cmd > $TDENGINE_DIR/tests/$case_file.log 2>&1 && \
|
||||
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_ALLCI_REPORT || \
|
||||
echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_ALLCI_REPORT
|
||||
|
||||
# # 记录日志和备份
|
||||
# mkdir -p "$BACKUP_DIR/$case_file"
|
||||
# tar --exclude='*.sock*' -czf "$BACKUP_DIR/$case_file/sim.tar.gz" -C "$TDENGINE_DIR/.." sim
|
||||
# mv "$TDENGINE_DIR/tests/$case_file.log" "$BACKUP_DIR/$case_file"
|
||||
|
||||
if [ "$SAVE_LOG" == "save" ]; then
|
||||
mkdir -p "$BACKUP_DIR/$case_file"
|
||||
tar --exclude='*.sock*' -czf "$BACKUP_DIR/$case_file/sim.tar.gz" -C "$TDENGINE_DIR/.." sim
|
||||
mv "$TDENGINE_DIR/tests/$case_file.log" "$BACKUP_DIR/$case_file"
|
||||
else
|
||||
echo "This case not save log!"
|
||||
fi
|
||||
|
||||
end_time=`date +%s`
|
||||
|
@ -168,8 +242,6 @@ function runCasesOneByOne () {
|
|||
mkdir -p "$BACKUP_DIR/$case_file"
|
||||
tar --exclude='*.sock*' -czf "$BACKUP_DIR/$case_file/sim.tar.gz" -C "$TDENGINE_DIR/.." sim
|
||||
mv "$TDENGINE_DIR/tests/$case_file.log" "$BACKUP_DIR/$case_file"
|
||||
else
|
||||
echo "This case not save log!"
|
||||
fi
|
||||
|
||||
end_time=`date +%s`
|
||||
|
@ -180,10 +252,12 @@ function runCasesOneByOne () {
|
|||
}
|
||||
|
||||
function runUnitTest() {
|
||||
print_color "$GREEN" "=== Run unit test case ==="
|
||||
print_color "$GREEN" " $TDENGINE_DIR/../debug"
|
||||
cd $TDENGINE_DIR/../debug
|
||||
ctest -j12
|
||||
get_DIR
|
||||
print_color "$GREEN" "cd $BUILD_DIR"
|
||||
cd $BUILD_DIR
|
||||
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||
sleep 10
|
||||
ctest -E "cunit_test" -j8
|
||||
print_color "$GREEN" "3.0 unit test done"
|
||||
}
|
||||
|
||||
|
@ -191,7 +265,7 @@ function runSimCases() {
|
|||
print_color "$GREEN" "=== Run sim cases ==="
|
||||
|
||||
cd $TDENGINE_DIR/tests/script
|
||||
runCasesOneByOne $TDENGINE_DIR/tests/parallel_test/cases.task sim
|
||||
runCasesOneByOne $TDENGINE_DIR/tests/parallel_test/cases_tdengine.task sim
|
||||
|
||||
totalSuccess=`grep 'sim success' $TDENGINE_ALLCI_REPORT | wc -l`
|
||||
if [ "$totalSuccess" -gt "0" ]; then
|
||||
|
@ -208,19 +282,19 @@ function runPythonCases() {
|
|||
print_color "$GREEN" "=== Run python cases ==="
|
||||
|
||||
cd $TDENGINE_DIR/tests/parallel_test
|
||||
sed -i '/compatibility.py/d' cases.task
|
||||
sed -i '/compatibility.py/d' cases_tdengine.task
|
||||
|
||||
# army
|
||||
cd $TDENGINE_DIR/tests/army
|
||||
runCasesOneByOne ../parallel_test/cases.task army
|
||||
runCasesOneByOne ../parallel_test/cases_tdengine.task army
|
||||
|
||||
# system-test
|
||||
cd $TDENGINE_DIR/tests/system-test
|
||||
runCasesOneByOne ../parallel_test/cases.task system-test
|
||||
runCasesOneByOne ../parallel_test/cases_tdengine.task system-test
|
||||
|
||||
# develop-test
|
||||
cd $TDENGINE_DIR/tests/develop-test
|
||||
runCasesOneByOne ../parallel_test/cases.task develop-test
|
||||
runCasesOneByOne ../parallel_test/cases_tdengine.task develop-test
|
||||
|
||||
totalSuccess=`grep 'py success' $TDENGINE_ALLCI_REPORT | wc -l`
|
||||
if [ "$totalSuccess" -gt "0" ]; then
|
||||
|
@ -280,7 +354,7 @@ function stopTaosadapter {
|
|||
|
||||
}
|
||||
|
||||
WORK_DIR=/root/
|
||||
WORK_DIR=$TDENGINE_DIR
|
||||
|
||||
date >> $WORK_DIR/date.log
|
||||
print_color "$GREEN" "Run all ci test cases" | tee -a $WORK_DIR/date.log
|
||||
|
|
|
@ -13,23 +13,53 @@ function print_color() {
|
|||
echo -e "${color}${message}${NC}"
|
||||
}
|
||||
|
||||
# Initialization parameter
|
||||
TDENGINE_DIR="/root/TDinternal/community"
|
||||
function printHelp() {
|
||||
echo "Usage: $(basename $0) [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -d [Project dir] Project directory (default: outermost project directory)"
|
||||
echo " e.g., -d /root/TDinternal/community"
|
||||
echo " -b [Build specify branch] Build specify branch (default: main)"
|
||||
echo " Options: "
|
||||
echo " e.g., -b main (pull main branch, build and install)[Branches need to be specified for the first run]"
|
||||
echo " -i [Build develop branch] Build develop branch (default: null)"
|
||||
echo " Options: "
|
||||
echo " yes/YES (pull , build and install)"
|
||||
echo " only_install/ONLY_INSTALL (only install)"
|
||||
echo " -f [Capture gcda dir] Capture gcda directory (default: <project dir>/debug)"
|
||||
echo " -c [Test case] Test single case or all cases (default: null)"
|
||||
echo " Options:"
|
||||
echo " -c all : run all python, sim cases in longtimeruning_cases.task and unit cases"
|
||||
echo " -c task : run all python and sim cases in longtimeruning_cases.task "
|
||||
echo " -c cmd : run the specified test command"
|
||||
echo " e.g., -c './test.sh -f tsim/stream/streamFwcIntervalFill.sim'"
|
||||
echo " -u [Unit test case] Unit test case (default: null)"
|
||||
echo " e.g., -u './schedulerTest'"
|
||||
echo " -l [Lcov bin dir] Lcov bin dir (default: /usr/local/bin)"
|
||||
echo " e.g., -l '/root/TDinternal/community/tests/lcov-1.16/bin'"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
PROJECT_DIR=""
|
||||
CAPTURE_GCDA_DIR=""
|
||||
TEST_CASE="task"
|
||||
UNIT_TEST_CASE=""
|
||||
BRANCH=""
|
||||
TDENGINE_GCDA_DIR="/root/TDinternal/community/debug/"
|
||||
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)
|
||||
TDENGINE_DIR=$OPTARG
|
||||
PROJECT_DIR=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BRANCH=$OPTARG
|
||||
;;
|
||||
f)
|
||||
TDENGINE_GCDA_DIR=$OPTARG
|
||||
CAPTURE_GCDA_DIR=$OPTARG
|
||||
;;
|
||||
c)
|
||||
TEST_CASE=$OPTARG
|
||||
|
@ -44,15 +74,7 @@ while getopts "hd:b:f:c:u:i:l:" arg; do
|
|||
LCOV_DIR=$OPTARG
|
||||
;;
|
||||
h)
|
||||
echo "Usage: $(basename $0) -d [TDengine dir] -b [Test branch] -i [Build test branch] -f [TDengine gcda dir] -c [Test single case/all cases] -u [Unit test case] -l [Lcov dir]"
|
||||
echo " -d [TDengine dir] [default /root/TDinternal/community; eg: /home/TDinternal/community] "
|
||||
echo " -b [Test branch] [default local branch; eg:cover/3.0] "
|
||||
echo " -i [Build test branch] [default no:not build, but still install ;yes:will build and install ] "
|
||||
echo " -f [TDengine gcda dir] [default /root/TDinternal/community/debug; eg:/root/TDinternal/community/debug/community/source/dnode/vnode/CMakeFiles/vnode.dir/src/tq/] "
|
||||
echo " -c [Test single case/all cases] [default null; -c all : include parallel_test/longtimeruning_cases.task and all unit cases; -c task : include parallel_test/longtimeruning_cases.task; single case: eg: -c './test.sh -f tsim/stream/streamFwcIntervalFill.sim' ] "
|
||||
echo " -u [Unit test case] [default null; eg: './schedulerTest' ] "
|
||||
echo " -l [Lcov bin dir] [default /usr/local/bin; eg: '/root/TDinternal/community/tests/lcov-1.14/bin' ] "
|
||||
exit 0
|
||||
printHelp
|
||||
;;
|
||||
?)
|
||||
echo "Usage: ./$(basename $0) -h"
|
||||
|
@ -61,65 +83,141 @@ while getopts "hd:b:f:c:u:i:l:" arg; do
|
|||
esac
|
||||
done
|
||||
|
||||
# Check if the command name is provided
|
||||
if [ -z "$TDENGINE_DIR" ]; then
|
||||
echo "Error: TDengine dir is required."
|
||||
echo "Usage: $(basename $0) -d [TDengine dir] -b [Test branch] -i [Build test branch] -f [TDengine gcda dir] -c [Test single case/all cases] -u [Unit test case] -l [Lcov dir] "
|
||||
echo " -d [TDengine dir] [default /root/TDinternal/community; eg: /home/TDinternal/community] "
|
||||
echo " -b [Test branch] [default local branch; eg:cover/3.0] "
|
||||
echo " -i [Build test branch] [default no:not build, but still install ;yes:will build and install ] "
|
||||
echo " -f [TDengine gcda dir] [default /root/TDinternal/community/debug; eg:/root/TDinternal/community/debug/community/source/dnode/vnode/CMakeFiles/vnode.dir/src/tq/] "
|
||||
echo " -c [Test casingle case/all casesse] [default null; -c all : include parallel_test/longtimeruning_cases.task and all unit cases; -c task : include parallel_test/longtimeruning_cases.task; single case: eg: -c './test.sh -f tsim/stream/streamFwcIntervalFill.sim' ] "
|
||||
echo " -u [Unit test case] [default null; eg: './schedulerTest' ] "
|
||||
echo " -l [Lcov bin dir] [default /usr/local/bin; eg: '/root/TDinternal/community/tests/lcov-1.14/bin' ] "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||
today=`date +"%Y%m%d"`
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
|
||||
function pullTDengine() {
|
||||
print_color "$GREEN" "TDengine pull start"
|
||||
|
||||
# pull parent code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "git pull parent code..."
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "git pull tdengine code..."
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
print_color "$GREEN" "TDengine pull end"
|
||||
# Find the project/tdengine/build/capture directory
|
||||
function get_DIR() {
|
||||
today=`date +"%Y%m%d"`
|
||||
if [ -z "$PROJECT_DIR" ]; then
|
||||
CODE_DIR=$(dirname $0)
|
||||
cd $CODE_DIR
|
||||
CODE_DIR=$(pwd)
|
||||
if [[ "$CODE_DIR" == *"/community/"* ]]; then
|
||||
PROJECT_DIR=$(realpath ../..)
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||
else
|
||||
PROJECT_DIR=$(realpath ..)
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||
fi
|
||||
elif [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||
elif [[ "$PROJECT_DIR" == *"/TDengine" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR"
|
||||
BUILD_DIR="$PROJECT_DIR/debug"
|
||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# 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"
|
||||
|
||||
if [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
# pull tdinternal code
|
||||
cd "$TDENGINE_DIR/../"
|
||||
print_color "$GREEN" "Git pull TDinternal code..."
|
||||
git remote prune origin > /dev/null
|
||||
git remote update > /dev/null
|
||||
|
||||
print_color "$GREEN" "rebuild.."
|
||||
rm -rf *
|
||||
makecmd="cmake -DCOVER=true -DBUILD_TEST=false -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=0 -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../../"
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
make -j 8 install
|
||||
# pull tdengine code
|
||||
cd $TDENGINE_DIR
|
||||
print_color "$GREEN" "Git pull TDengine code..."
|
||||
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"
|
||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
||||
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
print_color "$GREEN" "Repo up-to-date"
|
||||
else
|
||||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/../debug ] || mkdir $TDENGINE_DIR/../debug
|
||||
cd $TDENGINE_DIR/../debug
|
||||
|
||||
print_color "$GREEN" "Rebuild.."
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
rm -rf *
|
||||
makecmd="cmake -DCOVER=true -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=false -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../ "
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
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
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
||||
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
print_color "$GREEN" "Repo up-to-date"
|
||||
else
|
||||
print_color "$GREEN" "Repo need to pull"
|
||||
fi
|
||||
|
||||
git reset --hard
|
||||
git checkout -- .
|
||||
git checkout $branch
|
||||
git checkout -- .
|
||||
git clean -f
|
||||
git pull
|
||||
|
||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||
cd $TDENGINE_DIR/debug
|
||||
|
||||
print_color "$GREEN" "Rebuild.."
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
rm -rf *
|
||||
makecmd="cmake -DCOVER=true -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=0 -DBUILD_TOOLS=true -DBUILD_GEOS=true -DBUILD_TEST=true -DBUILD_CONTRIB=false ../ "
|
||||
print_color "$GREEN" "$makecmd"
|
||||
$makecmd
|
||||
|
||||
make -j $(nproc) install
|
||||
fi
|
||||
|
||||
print_color "$GREEN" "TDengine build end"
|
||||
}
|
||||
|
||||
# Check and get the branch name and build branch
|
||||
|
@ -127,28 +225,39 @@ if [ -n "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
|||
branch="$BRANCH"
|
||||
print_color "$GREEN" "Testing branch: $branch "
|
||||
print_color "$GREEN" "Build is required for this test!"
|
||||
pullTDengine
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" == "yes" ] ; then
|
||||
branch="$BRANCH"
|
||||
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!"
|
||||
pullTDengine
|
||||
buildTDengine
|
||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" == "no" ] ; then
|
||||
branch="$BRANCH"
|
||||
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/../"
|
||||
git pull
|
||||
cd "$TDENGINE_DIR/"
|
||||
git pull
|
||||
cd $TDENGINE_DIR/debug
|
||||
make -j 8 install
|
||||
else
|
||||
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
|
||||
|
@ -184,9 +293,12 @@ function runCasesOneByOne () {
|
|||
|
||||
function runUnitTest() {
|
||||
print_color "$GREEN" "=== Run unit test case ==="
|
||||
print_color "$GREEN" " $TDENGINE_DIR/debug"
|
||||
cd $TDENGINE_DIR/debug
|
||||
ctest -j12
|
||||
get_DIR
|
||||
print_color "$GREEN" "cd $BUILD_DIR"
|
||||
cd $BUILD_DIR
|
||||
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||
sleep 10
|
||||
ctest -E "cunit_test" -j $(nproc)
|
||||
print_color "$GREEN" "3.0 unit test done"
|
||||
}
|
||||
|
||||
|
@ -267,10 +379,27 @@ function runTest() {
|
|||
if [ -n "$TEST_CASE" ] && [ "$TEST_CASE" != "all" ] && [ "$TEST_CASE" != "task" ]; then
|
||||
TEST_CASE="$TEST_CASE"
|
||||
print_color "$GREEN" "Test case: $TEST_CASE "
|
||||
cd $TDENGINE_DIR/tests/script/ && $TEST_CASE
|
||||
cd $TDENGINE_DIR/tests/army/ && $TEST_CASE
|
||||
cd $TDENGINE_DIR/tests/system-test/ && $TEST_CASE
|
||||
cd $TDENGINE_DIR/tests/develop-test/ && $TEST_CASE
|
||||
PYTHON_SIM=$(echo $TEST_CASE | awk '{print $1}' | xargs basename)
|
||||
echo "PYTHON_SIM: $PYTHON_SIM"
|
||||
if [[ "$PYTHON_SIM" == "python3" ]]; then
|
||||
CASE_FILENAME=$(echo $TEST_CASE | awk -F' ' '{print $4}' | xargs basename)
|
||||
echo "CASE_FILENAME: $CASE_FILENAME"
|
||||
CASE_DIR=$(find $TDENGINE_DIR/tests -name $CASE_FILENAME)
|
||||
echo "CASE_DIR: $CASE_DIR"
|
||||
if [[ "$CASE_DIR" == *"/army/"* ]]; then
|
||||
cd $TDENGINE_DIR/tests/army/ && $TEST_CASE
|
||||
elif [[ "$CASE_DIR" == *"/system-test/"* ]]; then
|
||||
cd $TDENGINE_DIR/tests/system-test/ && $TEST_CASE
|
||||
elif [[ "$CASE_DIR" == *"/develop-test/"* ]]; then
|
||||
cd $TDENGINE_DIR/tests/develop-test/ && $TEST_CASE
|
||||
fi
|
||||
else
|
||||
CASE_FILENAME=$(echo $TEST_CASE | awk -F' ' '{print $3}' | xargs basename)
|
||||
echo "CASE_FILENAME: $CASE_FILENAME"
|
||||
CASE_DIR=$(find $TDENGINE_DIR/tests -name $CASE_FILENAME)
|
||||
echo "CASE_DIR: $CASE_DIR"
|
||||
cd $TDENGINE_DIR/tests/script/ && $TEST_CASE
|
||||
fi
|
||||
elif [ "$TEST_CASE" == "all" ]; then
|
||||
print_color "$GREEN" "Test case is : parallel_test/longtimeruning_cases.task and all unit cases"
|
||||
runTest_all
|
||||
|
@ -280,12 +409,11 @@ function runTest() {
|
|||
runPythonCases
|
||||
elif [ -n "$UNIT_TEST_CASE" ]; then
|
||||
UNIT_TEST_CASE="$UNIT_TEST_CASE"
|
||||
cd $TDENGINE_DIR/debug/build/bin/ && $UNIT_TEST_CASE
|
||||
cd $BUILD_DIR/build/bin/ && $UNIT_TEST_CASE
|
||||
else
|
||||
print_color "$GREEN" "Test case is null"
|
||||
fi
|
||||
|
||||
|
||||
stopTaosd
|
||||
cd $TDENGINE_DIR/tests/script
|
||||
find . -name '*.sql' | xargs rm -f
|
||||
|
@ -298,13 +426,6 @@ function lcovFunc {
|
|||
echo "collect data by lcov"
|
||||
cd $TDENGINE_DIR
|
||||
|
||||
if [ -n "$TDENGINE_GCDA_DIR" ]; then
|
||||
TDENGINE_GCDA_DIR="$TDENGINE_GCDA_DIR"
|
||||
print_color "$GREEN" "Test gcda file dir: $TDENGINE_GCDA_DIR "
|
||||
else
|
||||
print_color "$GREEN" "Test gcda file dir is default: /root/TDinternal/community/debug"
|
||||
fi
|
||||
|
||||
if [ -n "$LCOV_DIR" ]; then
|
||||
LCOV_DIR="$LCOV_DIR"
|
||||
print_color "$GREEN" "Lcov bin dir: $LCOV_DIR "
|
||||
|
@ -313,7 +434,7 @@ function lcovFunc {
|
|||
fi
|
||||
|
||||
# collect data
|
||||
$LCOV_DIR/lcov -d "$TDENGINE_GCDA_DIR" -capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1 --no-external -b $TDENGINE_DIR -o coverage.info
|
||||
$LCOV_DIR/lcov -d "$CAPTURE_GCDA_DIR" -capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1 --no-external -b $TDENGINE_DIR -o coverage.info
|
||||
|
||||
# remove exclude paths
|
||||
$LCOV_DIR/lcov --remove coverage.info \
|
||||
|
@ -360,10 +481,9 @@ function stopTaosadapter {
|
|||
|
||||
}
|
||||
|
||||
WORK_DIR=/root
|
||||
|
||||
date >> $WORK_DIR/date.log
|
||||
print_color "$GREEN" "Run local coverage test cases" | tee -a $WORK_DIR/date.log
|
||||
date >> $TDENGINE_DIR/date.log
|
||||
print_color "$GREEN" "Run local coverage test cases" | tee -a $TDENGINE_DIR/date.log
|
||||
|
||||
stopTaosd
|
||||
|
||||
|
@ -372,13 +492,13 @@ runTest
|
|||
lcovFunc
|
||||
|
||||
|
||||
date >> $WORK_DIR/date.log
|
||||
print_color "$GREEN" "End of local coverage test cases" | tee -a $WORK_DIR/date.log
|
||||
date >> $TDENGINE_DIR/date.log
|
||||
print_color "$GREEN" "End of local coverage test cases" | tee -a $TDENGINE_DIR/date.log
|
||||
|
||||
|
||||
# Define coverage information files and output directories
|
||||
COVERAGE_INFO="$TDENGINE_DIR/coverage.info"
|
||||
OUTPUT_DIR="$WORK_DIR/coverage_report"
|
||||
OUTPUT_DIR="$TDENGINE_DIR/coverage_report"
|
||||
|
||||
# Check whether the coverage information file exists
|
||||
if [ ! -f "$COVERAGE_INFO" ]; then
|
||||
|
@ -398,8 +518,8 @@ $LCOV_DIR/genhtml "$COVERAGE_INFO" --branch-coverage --function-coverage --outp
|
|||
# Check whether the report was generated successfully
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "HTML coverage report generated successfully in $OUTPUT_DIR"
|
||||
echo "For more details : "
|
||||
echo "http://192.168.1.61:7000/"
|
||||
echo "For more details : use 'python3 -m http.server port' in $OUTPUT_DIR"
|
||||
echo "eg: http://IP:PORT/"
|
||||
else
|
||||
echo "Error generating HTML coverage report"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue