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 \
|
cmake .. -DBUILD_TOOLS=true \
|
||||||
-DBUILD_KEEPER=true \
|
-DBUILD_KEEPER=true \
|
||||||
-DBUILD_HTTP=false \
|
-DBUILD_HTTP=false \
|
||||||
-DBUILD_TEST=false \
|
-DBUILD_TEST=true \
|
||||||
-DBUILD_DEPENDENCY_TESTS=false
|
-DBUILD_DEPENDENCY_TESTS=false
|
||||||
make -j 4
|
make -j 4
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
|
@ -196,14 +196,23 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
setAlterDbFsync(200);
|
setAlterDbFsync(200);
|
||||||
setAlterDbWal(1);
|
setAlterDbWal(1);
|
||||||
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
|
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
|
||||||
|
#ifndef _STORAGE
|
||||||
|
setAlterDbSttTrigger(-1);
|
||||||
|
#else
|
||||||
setAlterDbSttTrigger(16);
|
setAlterDbSttTrigger(16);
|
||||||
|
#endif
|
||||||
setAlterDbBuffer(16);
|
setAlterDbBuffer(16);
|
||||||
setAlterDbPages(128);
|
setAlterDbPages(128);
|
||||||
setAlterDbReplica(3);
|
setAlterDbReplica(3);
|
||||||
setAlterDbWalRetentionPeriod(10);
|
setAlterDbWalRetentionPeriod(10);
|
||||||
setAlterDbWalRetentionSize(20);
|
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 "
|
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");
|
"REPLICA 3 WAL_LEVEL 1 STT_TRIGGER 16 WAL_RETENTION_PERIOD 10 WAL_RETENTION_SIZE 20");
|
||||||
|
#endif
|
||||||
clearAlterDbReq();
|
clearAlterDbReq();
|
||||||
|
|
||||||
initAlterDb("test");
|
initAlterDb("test");
|
||||||
|
@ -286,6 +295,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
run("ALTER DATABASE test REPLICA 3");
|
run("ALTER DATABASE test REPLICA 3");
|
||||||
clearAlterDbReq();
|
clearAlterDbReq();
|
||||||
|
|
||||||
|
#ifdef _STORAGE
|
||||||
initAlterDb("test");
|
initAlterDb("test");
|
||||||
setAlterDbSttTrigger(1);
|
setAlterDbSttTrigger(1);
|
||||||
run("ALTER DATABASE test STT_TRIGGER 1");
|
run("ALTER DATABASE test STT_TRIGGER 1");
|
||||||
|
@ -294,6 +304,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
setAlterDbSttTrigger(16);
|
setAlterDbSttTrigger(16);
|
||||||
run("ALTER DATABASE test STT_TRIGGER 16");
|
run("ALTER DATABASE test STT_TRIGGER 16");
|
||||||
clearAlterDbReq();
|
clearAlterDbReq();
|
||||||
|
#endif
|
||||||
|
|
||||||
initAlterDb("test");
|
initAlterDb("test");
|
||||||
setAlterDbMinRows(10);
|
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 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
run("ALTER DATABASE test KEEP 1w", 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 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 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 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
run("ALTER DATABASE test STT_TRIGGER 17", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
run("ALTER DATABASE test STT_TRIGGER 17", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
// Regardless of the specific sentence
|
// Regardless of the specific sentence
|
||||||
|
|
|
@ -249,7 +249,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
for (int32_t i = 0; i < expect.numOfRetensions; ++i) {
|
for (int32_t i = 0; i < expect.numOfRetensions; ++i) {
|
||||||
SRetention* pReten = (SRetention*)taosArrayGet(req.pRetensions, i);
|
SRetention* pReten = (SRetention*)taosArrayGet(req.pRetensions, i);
|
||||||
SRetention* pExpectReten = (SRetention*)taosArrayGet(expect.pRetensions, i);
|
SRetention* pExpectReten = (SRetention*)taosArrayGet(expect.pRetensions, i);
|
||||||
if(i == 0) {
|
if (i == 0) {
|
||||||
ASSERT_EQ(pReten->freq, 0);
|
ASSERT_EQ(pReten->freq, 0);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pReten->freq, pExpectReten->freq);
|
ASSERT_EQ(pReten->freq, pExpectReten->freq);
|
||||||
|
@ -292,10 +292,44 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
setDbWalRetentionSize(-1);
|
setDbWalRetentionSize(-1);
|
||||||
setDbWalRollPeriod(10);
|
setDbWalRollPeriod(10);
|
||||||
setDbWalSegmentSize(20);
|
setDbWalSegmentSize(20);
|
||||||
|
#ifndef _STORAGE
|
||||||
|
setDbSstTrigger(1);
|
||||||
|
#else
|
||||||
setDbSstTrigger(16);
|
setDbSstTrigger(16);
|
||||||
|
#endif
|
||||||
setDbHashPrefix(3);
|
setDbHashPrefix(3);
|
||||||
setDbHashSuffix(4);
|
setDbHashSuffix(4);
|
||||||
setDbTsdbPageSize(32);
|
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 "
|
run("CREATE DATABASE IF NOT EXISTS wxy_db "
|
||||||
"BUFFER 64 "
|
"BUFFER 64 "
|
||||||
"CACHEMODEL 'last_value' "
|
"CACHEMODEL 'last_value' "
|
||||||
|
@ -324,6 +358,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
"TABLE_PREFIX 3 "
|
"TABLE_PREFIX 3 "
|
||||||
"TABLE_SUFFIX 4 "
|
"TABLE_SUFFIX 4 "
|
||||||
"TSDB_PAGESIZE 32");
|
"TSDB_PAGESIZE 32");
|
||||||
|
|
||||||
|
#endif
|
||||||
clearCreateDbReq();
|
clearCreateDbReq();
|
||||||
|
|
||||||
setCreateDbReq("wxy_db", 1);
|
setCreateDbReq("wxy_db", 1);
|
||||||
|
@ -583,8 +619,6 @@ TEST_F(ParserInitialCTest, createView) {
|
||||||
clearCreateStreamReq();
|
clearCreateStreamReq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CREATE MNODE ON DNODE dnode_id
|
* CREATE MNODE ON DNODE dnode_id
|
||||||
*/
|
*/
|
||||||
|
@ -679,7 +713,7 @@ TEST_F(ParserInitialCTest, createSmaIndex) {
|
||||||
ASSERT_EQ(QUERY_NODE_SELECT_STMT, nodeType(pQuery->pPrevRoot));
|
ASSERT_EQ(QUERY_NODE_SELECT_STMT, nodeType(pQuery->pPrevRoot));
|
||||||
|
|
||||||
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pQuery->pRoot;
|
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pQuery->pRoot;
|
||||||
SCmdMsgInfo* pCmdMsg = (SCmdMsgInfo*)taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
SCmdMsgInfo* pCmdMsg = (SCmdMsgInfo*)taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||||
if (NULL == pCmdMsg) FAIL();
|
if (NULL == pCmdMsg) FAIL();
|
||||||
pCmdMsg->msgType = TDMT_MND_CREATE_SMA;
|
pCmdMsg->msgType = TDMT_MND_CREATE_SMA;
|
||||||
pCmdMsg->msgLen = tSerializeSMCreateSmaReq(NULL, 0, pStmt->pReq);
|
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",
|
run("CREATE STREAM s2 INTO st1 AS SELECT ts, to_json('{c1:1}') FROM st1 PARTITION BY TBNAME",
|
||||||
TSDB_CODE_PAR_INVALID_STREAM_QUERY);
|
TSDB_CODE_PAR_INVALID_STREAM_QUERY);
|
||||||
run("CREATE STREAM s3 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tbname)) "
|
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");
|
run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1 WHERE tag1 > 0");
|
||||||
clearCreateTopicReq();
|
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");
|
run("CREATE TOPIC IF NOT EXISTS tp1 WITH META AS STABLE st1 WHERE tag1 > 0");
|
||||||
clearCreateTopicReq();
|
clearCreateTopicReq();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -287,12 +287,12 @@ TEST(TcsTest, InterfaceNonBlobTest) {
|
||||||
uint8_t *pBlock = NULL;
|
uint8_t *pBlock = NULL;
|
||||||
code = tcsGetObjectBlock(object_name, 0, size, check, &pBlock);
|
code = tcsGetObjectBlock(object_name, 0, size, check, &pBlock);
|
||||||
GTEST_ASSERT_EQ(code, 0);
|
GTEST_ASSERT_EQ(code, 0);
|
||||||
|
if (pBlock) {
|
||||||
for (int i = 0; i < size / 2; ++i) {
|
for (int i = 0; i < size / 2; ++i) {
|
||||||
GTEST_ASSERT_EQ(pBlock[i * 2], 0);
|
GTEST_ASSERT_EQ(pBlock[i * 2], 0);
|
||||||
GTEST_ASSERT_EQ(pBlock[i * 2 + 1], 1);
|
GTEST_ASSERT_EQ(pBlock[i * 2 + 1], 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(pBlock);
|
taosMemoryFree(pBlock);
|
||||||
|
|
||||||
code = tcsGetObjectToFile(object_name, path_download);
|
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}"
|
echo -e "${color}${message}${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 初始化参数
|
function printHelp() {
|
||||||
TDENGINE_DIR="/root/TDinternal/community"
|
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=""
|
BRANCH=""
|
||||||
SAVE_LOG="notsave"
|
SAVE_LOG="notsave"
|
||||||
|
|
||||||
# 解析命令行参数
|
# Parse command line parameters
|
||||||
while getopts "hd:b:t:s:" arg; do
|
while getopts "hb:d:s:" arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
d)
|
d)
|
||||||
TDENGINE_DIR=$OPTARG
|
PROJECT_DIR=$OPTARG
|
||||||
;;
|
;;
|
||||||
b)
|
b)
|
||||||
BRANCH=$OPTARG
|
BRANCH=$OPTARG
|
||||||
|
@ -31,11 +48,7 @@ while getopts "hd:b:t:s:" arg; do
|
||||||
SAVE_LOG=$OPTARG
|
SAVE_LOG=$OPTARG
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
echo "Usage: $(basename $0) -d [TDengine_dir] -b [branch] -s [save ci case log]"
|
printHelp
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
echo "Usage: ./$(basename $0) -h"
|
echo "Usage: ./$(basename $0) -h"
|
||||||
|
@ -44,76 +57,144 @@ while getopts "hd:b:t:s:" arg; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# 检查是否提供了命令名称
|
function get_DIR() {
|
||||||
if [ -z "$TDENGINE_DIR" ]; then
|
today=`date +"%Y%m%d"`
|
||||||
echo "Error: TDengine dir is required."
|
if [ -z "$PROJECT_DIR" ]; then
|
||||||
echo "Usage: $(basename $0) -d [TDengine_dir] -b [branch] -s [save ci case log] "
|
CODE_DIR=$(dirname $0)
|
||||||
echo " -d [TDengine_dir] [default /root/TDinternal/community] "
|
cd $CODE_DIR
|
||||||
echo " -b [branch] [default local branch] "
|
CODE_DIR=$(pwd)
|
||||||
echo " -s [save/notsave] [default save ci case log in TDengine_dir/tests/ci_bak] "
|
if [[ "$CODE_DIR" == *"/community/"* ]]; then
|
||||||
exit 1
|
PROJECT_DIR=$(realpath ../..)
|
||||||
fi
|
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"
|
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
||||||
today=`date +"%Y%m%d"`
|
echo "BUILD_DIR = $BUILD_DIR"
|
||||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
echo "BACKUP_DIR = $BACKUP_DIR"
|
||||||
BACKUP_DIR="$TDENGINE_DIR/tests/ci_bak"
|
|
||||||
mkdir -p "$BACKUP_DIR"
|
|
||||||
#cd $BACKUP_DIR && rm -rf *
|
|
||||||
|
|
||||||
|
|
||||||
function buildTDengine() {
|
function buildTDengine() {
|
||||||
print_color "$GREEN" "TDengine build start"
|
print_color "$GREEN" "TDengine build start"
|
||||||
|
|
||||||
# pull parent code
|
if [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||||
cd "$TDENGINE_DIR/../"
|
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||||
print_color "$GREEN" "git pull parent code..."
|
|
||||||
git remote prune origin > /dev/null
|
|
||||||
git remote update > /dev/null
|
|
||||||
|
|
||||||
# pull tdengine code
|
# pull tdinternal code
|
||||||
cd $TDENGINE_DIR
|
cd "$TDENGINE_DIR/../"
|
||||||
print_color "$GREEN" "git pull tdengine code..."
|
print_color "$GREEN" "Git pull TDinternal code..."
|
||||||
git remote prune origin > /dev/null
|
git remote prune origin > /dev/null
|
||||||
git remote update > /dev/null
|
git remote update > /dev/null
|
||||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch`
|
|
||||||
LOCAL_COMMIT=`git rev-parse --short @`
|
# pull tdengine code
|
||||||
print_color "$GREEN" " LOCAL: $LOCAL_COMMIT"
|
cd $TDENGINE_DIR
|
||||||
print_color "$GREEN" "REMOTE: $REMOTE_COMMIT"
|
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
|
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
|
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"
|
print_color "$GREEN" "TDengine build end"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# 检查并获取分支名称
|
# Check and get the branch name
|
||||||
if [ -n "$BRANCH" ]; then
|
if [ -n "$BRANCH" ] ; then
|
||||||
branch="$BRANCH"
|
branch="$BRANCH"
|
||||||
print_color "$GREEN" "Testing branch: $branch "
|
print_color "$GREEN" "Testing branch: $branch "
|
||||||
print_color "$GREEN" "Build is required for this test!"
|
print_color "$GREEN" "Build is required for this test!"
|
||||||
|
@ -136,17 +217,10 @@ function runCasesOneByOne () {
|
||||||
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_ALLCI_REPORT || \
|
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_ALLCI_REPORT || \
|
||||||
echo -e "${RED}$case failed${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
|
if [ "$SAVE_LOG" == "save" ]; then
|
||||||
mkdir -p "$BACKUP_DIR/$case_file"
|
mkdir -p "$BACKUP_DIR/$case_file"
|
||||||
tar --exclude='*.sock*' -czf "$BACKUP_DIR/$case_file/sim.tar.gz" -C "$TDENGINE_DIR/.." sim
|
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"
|
mv "$TDENGINE_DIR/tests/$case_file.log" "$BACKUP_DIR/$case_file"
|
||||||
else
|
|
||||||
echo "This case not save log!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
end_time=`date +%s`
|
end_time=`date +%s`
|
||||||
|
@ -168,8 +242,6 @@ function runCasesOneByOne () {
|
||||||
mkdir -p "$BACKUP_DIR/$case_file"
|
mkdir -p "$BACKUP_DIR/$case_file"
|
||||||
tar --exclude='*.sock*' -czf "$BACKUP_DIR/$case_file/sim.tar.gz" -C "$TDENGINE_DIR/.." sim
|
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"
|
mv "$TDENGINE_DIR/tests/$case_file.log" "$BACKUP_DIR/$case_file"
|
||||||
else
|
|
||||||
echo "This case not save log!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
end_time=`date +%s`
|
end_time=`date +%s`
|
||||||
|
@ -180,10 +252,12 @@ function runCasesOneByOne () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runUnitTest() {
|
function runUnitTest() {
|
||||||
print_color "$GREEN" "=== Run unit test case ==="
|
get_DIR
|
||||||
print_color "$GREEN" " $TDENGINE_DIR/../debug"
|
print_color "$GREEN" "cd $BUILD_DIR"
|
||||||
cd $TDENGINE_DIR/../debug
|
cd $BUILD_DIR
|
||||||
ctest -j12
|
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||||
|
sleep 10
|
||||||
|
ctest -E "cunit_test" -j8
|
||||||
print_color "$GREEN" "3.0 unit test done"
|
print_color "$GREEN" "3.0 unit test done"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +265,7 @@ function runSimCases() {
|
||||||
print_color "$GREEN" "=== Run sim cases ==="
|
print_color "$GREEN" "=== Run sim cases ==="
|
||||||
|
|
||||||
cd $TDENGINE_DIR/tests/script
|
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`
|
totalSuccess=`grep 'sim success' $TDENGINE_ALLCI_REPORT | wc -l`
|
||||||
if [ "$totalSuccess" -gt "0" ]; then
|
if [ "$totalSuccess" -gt "0" ]; then
|
||||||
|
@ -208,19 +282,19 @@ function runPythonCases() {
|
||||||
print_color "$GREEN" "=== Run python cases ==="
|
print_color "$GREEN" "=== Run python cases ==="
|
||||||
|
|
||||||
cd $TDENGINE_DIR/tests/parallel_test
|
cd $TDENGINE_DIR/tests/parallel_test
|
||||||
sed -i '/compatibility.py/d' cases.task
|
sed -i '/compatibility.py/d' cases_tdengine.task
|
||||||
|
|
||||||
# army
|
# army
|
||||||
cd $TDENGINE_DIR/tests/army
|
cd $TDENGINE_DIR/tests/army
|
||||||
runCasesOneByOne ../parallel_test/cases.task army
|
runCasesOneByOne ../parallel_test/cases_tdengine.task army
|
||||||
|
|
||||||
# system-test
|
# system-test
|
||||||
cd $TDENGINE_DIR/tests/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
|
# develop-test
|
||||||
cd $TDENGINE_DIR/tests/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`
|
totalSuccess=`grep 'py success' $TDENGINE_ALLCI_REPORT | wc -l`
|
||||||
if [ "$totalSuccess" -gt "0" ]; then
|
if [ "$totalSuccess" -gt "0" ]; then
|
||||||
|
@ -280,7 +354,7 @@ function stopTaosadapter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WORK_DIR=/root/
|
WORK_DIR=$TDENGINE_DIR
|
||||||
|
|
||||||
date >> $WORK_DIR/date.log
|
date >> $WORK_DIR/date.log
|
||||||
print_color "$GREEN" "Run all ci test cases" | tee -a $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}"
|
echo -e "${color}${message}${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization parameter
|
function printHelp() {
|
||||||
TDENGINE_DIR="/root/TDinternal/community"
|
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=""
|
BRANCH=""
|
||||||
TDENGINE_GCDA_DIR="/root/TDinternal/community/debug/"
|
BRANCH_BUILD=""
|
||||||
LCOV_DIR="/usr/local/bin"
|
LCOV_DIR="/usr/local/bin"
|
||||||
|
|
||||||
# Parse command line parameters
|
# Parse command line parameters
|
||||||
while getopts "hd:b:f:c:u:i:l:" arg; do
|
while getopts "hd:b:f:c:u:i:l:" arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
d)
|
d)
|
||||||
TDENGINE_DIR=$OPTARG
|
PROJECT_DIR=$OPTARG
|
||||||
;;
|
;;
|
||||||
b)
|
b)
|
||||||
BRANCH=$OPTARG
|
BRANCH=$OPTARG
|
||||||
;;
|
;;
|
||||||
f)
|
f)
|
||||||
TDENGINE_GCDA_DIR=$OPTARG
|
CAPTURE_GCDA_DIR=$OPTARG
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
TEST_CASE=$OPTARG
|
TEST_CASE=$OPTARG
|
||||||
|
@ -44,15 +74,7 @@ while getopts "hd:b:f:c:u:i:l:" arg; do
|
||||||
LCOV_DIR=$OPTARG
|
LCOV_DIR=$OPTARG
|
||||||
;;
|
;;
|
||||||
h)
|
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]"
|
printHelp
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
echo "Usage: ./$(basename $0) -h"
|
echo "Usage: ./$(basename $0) -h"
|
||||||
|
@ -61,65 +83,141 @@ while getopts "hd:b:f:c:u:i:l:" arg; do
|
||||||
esac
|
esac
|
||||||
done
|
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
|
|
||||||
|
|
||||||
|
# Find the project/tdengine/build/capture directory
|
||||||
echo "TDENGINE_DIR = $TDENGINE_DIR"
|
function get_DIR() {
|
||||||
today=`date +"%Y%m%d"`
|
today=`date +"%Y%m%d"`
|
||||||
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
if [ -z "$PROJECT_DIR" ]; then
|
||||||
|
CODE_DIR=$(dirname $0)
|
||||||
function pullTDengine() {
|
cd $CODE_DIR
|
||||||
print_color "$GREEN" "TDengine pull start"
|
CODE_DIR=$(pwd)
|
||||||
|
if [[ "$CODE_DIR" == *"/community/"* ]]; then
|
||||||
# pull parent code
|
PROJECT_DIR=$(realpath ../..)
|
||||||
cd "$TDENGINE_DIR/../"
|
TDENGINE_DIR="$PROJECT_DIR"
|
||||||
print_color "$GREEN" "git pull parent code..."
|
BUILD_DIR="$PROJECT_DIR/debug"
|
||||||
|
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||||
git reset --hard
|
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||||
git checkout -- .
|
else
|
||||||
git checkout $branch
|
PROJECT_DIR=$(realpath ..)
|
||||||
git checkout -- .
|
TDENGINE_DIR="$PROJECT_DIR"
|
||||||
git clean -f
|
BUILD_DIR="$PROJECT_DIR/debug"
|
||||||
git pull
|
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||||
|
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||||
# pull tdengine code
|
fi
|
||||||
cd $TDENGINE_DIR
|
elif [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||||
print_color "$GREEN" "git pull tdengine code..."
|
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||||
|
BUILD_DIR="$PROJECT_DIR/debug"
|
||||||
git reset --hard
|
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||||
git checkout -- .
|
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||||
git checkout $branch
|
elif [[ "$PROJECT_DIR" == *"/TDengine" ]]; then
|
||||||
git checkout -- .
|
TDENGINE_DIR="$PROJECT_DIR"
|
||||||
git clean -f
|
BUILD_DIR="$PROJECT_DIR/debug"
|
||||||
git pull
|
TDENGINE_ALLCI_REPORT="$TDENGINE_DIR/tests/all-ci-report-$today.log"
|
||||||
|
CAPTURE_GCDA_DIR="$BUILD_DIR"
|
||||||
print_color "$GREEN" "TDengine pull end"
|
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() {
|
function buildTDengine() {
|
||||||
print_color "$GREEN" "TDengine build start"
|
print_color "$GREEN" "TDengine build start"
|
||||||
|
|
||||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
if [[ "$PROJECT_DIR" == *"/TDinternal" ]]; then
|
||||||
cd $TDENGINE_DIR/debug
|
TDENGINE_DIR="$PROJECT_DIR/community"
|
||||||
|
|
||||||
print_color "$GREEN" "rebuild.."
|
# pull tdinternal code
|
||||||
rm -rf *
|
cd "$TDENGINE_DIR/../"
|
||||||
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" "Git pull TDinternal code..."
|
||||||
print_color "$GREEN" "$makecmd"
|
git remote prune origin > /dev/null
|
||||||
$makecmd
|
git remote update > /dev/null
|
||||||
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
|
# Check and get the branch name and build branch
|
||||||
|
@ -127,28 +225,39 @@ if [ -n "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||||
branch="$BRANCH"
|
branch="$BRANCH"
|
||||||
print_color "$GREEN" "Testing branch: $branch "
|
print_color "$GREEN" "Testing branch: $branch "
|
||||||
print_color "$GREEN" "Build is required for this test!"
|
print_color "$GREEN" "Build is required for this test!"
|
||||||
pullTDengine
|
|
||||||
buildTDengine
|
buildTDengine
|
||||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" == "yes" ] ; then
|
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "YES" -o "$BRANCH_BUILD" = "yes" ] ; then
|
||||||
branch="$BRANCH"
|
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" "Testing branch: $branch "
|
||||||
print_color "$GREEN" "Build is required for this test!"
|
print_color "$GREEN" "Build is required for this test!"
|
||||||
pullTDengine
|
|
||||||
buildTDengine
|
buildTDengine
|
||||||
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" == "no" ] ; then
|
elif [ -n "$BRANCH_BUILD" ] && [ "$BRANCH_BUILD" = "ONLY_INSTALL" -o "$BRANCH_BUILD" = "only_install" ] ; then
|
||||||
branch="$BRANCH"
|
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" "Testing branch: $branch "
|
||||||
print_color "$GREEN" "not build,only install!"
|
print_color "$GREEN" "not build,only install!"
|
||||||
cd "$TDENGINE_DIR/../"
|
|
||||||
git pull
|
|
||||||
cd "$TDENGINE_DIR/"
|
|
||||||
git pull
|
|
||||||
cd $TDENGINE_DIR/debug
|
cd $TDENGINE_DIR/debug
|
||||||
make -j 8 install
|
make -j $(nproc) install
|
||||||
else
|
elif [ -z "$BRANCH" ] && [ -z "$BRANCH_BUILD" ] ; then
|
||||||
print_color "$GREEN" "Build is not required for this test!"
|
print_color "$GREEN" "Build is not required for this test!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
function runCasesOneByOne () {
|
function runCasesOneByOne () {
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ "$line" != "#"* ]]; then
|
if [[ "$line" != "#"* ]]; then
|
||||||
|
@ -184,9 +293,12 @@ function runCasesOneByOne () {
|
||||||
|
|
||||||
function runUnitTest() {
|
function runUnitTest() {
|
||||||
print_color "$GREEN" "=== Run unit test case ==="
|
print_color "$GREEN" "=== Run unit test case ==="
|
||||||
print_color "$GREEN" " $TDENGINE_DIR/debug"
|
get_DIR
|
||||||
cd $TDENGINE_DIR/debug
|
print_color "$GREEN" "cd $BUILD_DIR"
|
||||||
ctest -j12
|
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"
|
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
|
if [ -n "$TEST_CASE" ] && [ "$TEST_CASE" != "all" ] && [ "$TEST_CASE" != "task" ]; then
|
||||||
TEST_CASE="$TEST_CASE"
|
TEST_CASE="$TEST_CASE"
|
||||||
print_color "$GREEN" "Test case: $TEST_CASE "
|
print_color "$GREEN" "Test case: $TEST_CASE "
|
||||||
cd $TDENGINE_DIR/tests/script/ && $TEST_CASE
|
PYTHON_SIM=$(echo $TEST_CASE | awk '{print $1}' | xargs basename)
|
||||||
cd $TDENGINE_DIR/tests/army/ && $TEST_CASE
|
echo "PYTHON_SIM: $PYTHON_SIM"
|
||||||
cd $TDENGINE_DIR/tests/system-test/ && $TEST_CASE
|
if [[ "$PYTHON_SIM" == "python3" ]]; then
|
||||||
cd $TDENGINE_DIR/tests/develop-test/ && $TEST_CASE
|
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
|
elif [ "$TEST_CASE" == "all" ]; then
|
||||||
print_color "$GREEN" "Test case is : parallel_test/longtimeruning_cases.task and all unit cases"
|
print_color "$GREEN" "Test case is : parallel_test/longtimeruning_cases.task and all unit cases"
|
||||||
runTest_all
|
runTest_all
|
||||||
|
@ -280,12 +409,11 @@ function runTest() {
|
||||||
runPythonCases
|
runPythonCases
|
||||||
elif [ -n "$UNIT_TEST_CASE" ]; then
|
elif [ -n "$UNIT_TEST_CASE" ]; then
|
||||||
UNIT_TEST_CASE="$UNIT_TEST_CASE"
|
UNIT_TEST_CASE="$UNIT_TEST_CASE"
|
||||||
cd $TDENGINE_DIR/debug/build/bin/ && $UNIT_TEST_CASE
|
cd $BUILD_DIR/build/bin/ && $UNIT_TEST_CASE
|
||||||
else
|
else
|
||||||
print_color "$GREEN" "Test case is null"
|
print_color "$GREEN" "Test case is null"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
cd $TDENGINE_DIR/tests/script
|
cd $TDENGINE_DIR/tests/script
|
||||||
find . -name '*.sql' | xargs rm -f
|
find . -name '*.sql' | xargs rm -f
|
||||||
|
@ -298,13 +426,6 @@ function lcovFunc {
|
||||||
echo "collect data by lcov"
|
echo "collect data by lcov"
|
||||||
cd $TDENGINE_DIR
|
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
|
if [ -n "$LCOV_DIR" ]; then
|
||||||
LCOV_DIR="$LCOV_DIR"
|
LCOV_DIR="$LCOV_DIR"
|
||||||
print_color "$GREEN" "Lcov bin dir: $LCOV_DIR "
|
print_color "$GREEN" "Lcov bin dir: $LCOV_DIR "
|
||||||
|
@ -313,7 +434,7 @@ function lcovFunc {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# collect data
|
# 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
|
# remove exclude paths
|
||||||
$LCOV_DIR/lcov --remove coverage.info \
|
$LCOV_DIR/lcov --remove coverage.info \
|
||||||
|
@ -360,10 +481,9 @@ function stopTaosadapter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WORK_DIR=/root
|
|
||||||
|
|
||||||
date >> $WORK_DIR/date.log
|
date >> $TDENGINE_DIR/date.log
|
||||||
print_color "$GREEN" "Run local coverage test cases" | tee -a $WORK_DIR/date.log
|
print_color "$GREEN" "Run local coverage test cases" | tee -a $TDENGINE_DIR/date.log
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
|
|
||||||
|
@ -372,13 +492,13 @@ runTest
|
||||||
lcovFunc
|
lcovFunc
|
||||||
|
|
||||||
|
|
||||||
date >> $WORK_DIR/date.log
|
date >> $TDENGINE_DIR/date.log
|
||||||
print_color "$GREEN" "End of local coverage test cases" | tee -a $WORK_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
|
# Define coverage information files and output directories
|
||||||
COVERAGE_INFO="$TDENGINE_DIR/coverage.info"
|
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
|
# Check whether the coverage information file exists
|
||||||
if [ ! -f "$COVERAGE_INFO" ]; then
|
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
|
# Check whether the report was generated successfully
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "HTML coverage report generated successfully in $OUTPUT_DIR"
|
echo "HTML coverage report generated successfully in $OUTPUT_DIR"
|
||||||
echo "For more details : "
|
echo "For more details : use 'python3 -m http.server port' in $OUTPUT_DIR"
|
||||||
echo "http://192.168.1.61:7000/"
|
echo "eg: http://IP:PORT/"
|
||||||
else
|
else
|
||||||
echo "Error generating HTML coverage report"
|
echo "Error generating HTML coverage report"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue