From 345fb9cecc500819d9c4c1685fbb91643fb4829c Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Fri, 17 Jan 2025 14:58:40 +0800 Subject: [PATCH 1/5] test:alter branch build --- tests/run_all_ci_cases.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/run_all_ci_cases.sh b/tests/run_all_ci_cases.sh index 1374fc1431..a29a528298 100755 --- a/tests/run_all_ci_cases.sh +++ b/tests/run_all_ci_cases.sh @@ -118,14 +118,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 +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 @@ -155,15 +155,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 +175,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,7 +193,7 @@ function buildTDengine() { print_color "$GREEN" "$makecmd" $makecmd - make -j 8 install + make -j $(nproc) install fi print_color "$GREEN" "TDengine build end" From 0442a3c2cbee7ef4f859686edad4473725fdb378 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Wed, 22 Jan 2025 13:52:49 +0800 Subject: [PATCH 2/5] test:alter case step --- tests/run_all_ci_cases.sh | 100 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 51 deletions(-) diff --git a/tests/run_all_ci_cases.sh b/tests/run_all_ci_cases.sh index a29a528298..b129964bbd 100755 --- a/tests/run_all_ci_cases.sh +++ b/tests/run_all_ci_cases.sh @@ -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" @@ -199,18 +161,6 @@ function buildTDengine() { 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 @@ -314,7 +264,6 @@ function runPythonCases() { fi } - function runTest() { print_color "$GREEN" "run Test" @@ -361,6 +310,55 @@ function stopTaosadapter { } + +# 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" + +# 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 + + WORK_DIR=$TDENGINE_DIR date >> $WORK_DIR/date.log From 79998fe56c3e48f66dc2e2a1c75b0a257b341f29 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Wed, 22 Jan 2025 14:17:04 +0800 Subject: [PATCH 3/5] test:alter case step --- tests/run_all_ci_cases.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/run_all_ci_cases.sh b/tests/run_all_ci_cases.sh index b129964bbd..15d3e9f6a9 100755 --- a/tests/run_all_ci_cases.sh +++ b/tests/run_all_ci_cases.sh @@ -214,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" } @@ -293,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 { @@ -306,10 +306,13 @@ 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="" @@ -348,17 +351,7 @@ echo "TDENGINE_DIR = $TDENGINE_DIR" echo "BUILD_DIR = $BUILD_DIR" echo "BACKUP_DIR = $BACKUP_DIR" -# 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 all ci case WORK_DIR=$TDENGINE_DIR date >> $WORK_DIR/date.log @@ -366,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 From e40d56bc73041b30d0d37b1ca4a1d2c5a4011107 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Wed, 22 Jan 2025 14:17:22 +0800 Subject: [PATCH 4/5] test:alter case step --- tests/run_local_coverage.sh | 191 ++++++++++++++++++------------------ 1 file changed, 98 insertions(+), 93 deletions(-) diff --git a/tests/run_local_coverage.sh b/tests/run_local_coverage.sh index f82d37faa4..128661d237 100755 --- a/tests/run_local_coverage.sh +++ b/tests/run_local_coverage.sh @@ -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" @@ -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 From 9c2384d74efb5fbdebceb7d9cc23ff64b516d4bd Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Wed, 22 Jan 2025 14:22:34 +0800 Subject: [PATCH 5/5] test:alter case step --- tests/run_local_coverage.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/run_local_coverage.sh b/tests/run_local_coverage.sh index 128661d237..ca3175a051 100755 --- a/tests/run_local_coverage.sh +++ b/tests/run_local_coverage.sh @@ -84,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" @@ -103,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 @@ -128,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" @@ -141,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