diff --git a/Jenkinsfile b/Jenkinsfile index f2e3c1c4f6c3754f33f56575c4f6b89170e36948..35a2bf82606313fe015457cda3a6a57c23e2ef4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,8 +4,10 @@ import jenkins.model.CauseOfInterruption node { } -def skipbuild=0 -def win_stop=0 +def skipbuild = 0 +def win_stop = 0 +def scope = [] +def mod = [0,1,2,3,4] def abortPreviousBuilds() { def currentJobName = env.JOB_NAME @@ -349,7 +351,7 @@ pipeline { } stages { stage('pre_build'){ - agent{label 'master'} + agent{label 'catalina'} options { skipDefaultCheckout() } when { changeRequest() @@ -358,44 +360,32 @@ pipeline { script{ abort_previous() abortPreviousBuilds() - } - // sh''' - // rm -rf ${WORKSPACE}.tes - // cp -r ${WORKSPACE} ${WORKSPACE}.tes - // cd ${WORKSPACE}.tes - // git fetch - // ''' - // script { - // if (env.CHANGE_TARGET == 'master') { - // sh ''' - // git checkout master - // ''' - // } - // else if(env.CHANGE_TARGET == '2.0'){ - // sh ''' - // git checkout 2.0 - // ''' - // } - // else{ - // sh ''' - // git checkout develop - // ''' - // } - // } - // sh''' - // git fetch origin +refs/pull/${CHANGE_ID}/merge - // git checkout -qf FETCH_HEAD - // ''' + println env.CHANGE_BRANCH + if(env.CHANGE_FORK){ + scope = ['connector','query','insert','other','tools','taosAdapter'] + } + else{ + sh''' + cd ${WKC} + git fetch + git checkout ${CHANGE_BRANCH} + git pull + ''' + dir('/var/lib/jenkins/workspace/TDinternal/community'){ + gitlog = sh(script: "git log -1 --pretty=%B ", returnStdout:true) + println gitlog + if (!(gitlog =~ /\((.*?)\)/)){ + autoCancelled = true + error('Aborting the build.') + } + temp = (gitlog =~ /\((.*?)\)/) + temp = temp[0].remove(1) + scope = temp.split(",") + Collections.shuffle mod + } - // script{ - // skipbuild='2' - // skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true) - // println skipbuild - // } - // sh''' - // rm -rf ${WORKSPACE}.tes - // ''' - // } + } + } } } stage('Parallel test stage') { @@ -408,239 +398,90 @@ pipeline { } } parallel { - stage('python_1_s1') { - agent{label " slave1 || slave11 "} + stage('python_1') { + agent{label " slave1 || slave6 || slave11 || slave16 "} steps { pre_test() timeout(time: 55, unit: 'MINUTES'){ - sh ''' - date - cd ${WKC}/tests - ./test-all.sh p1 - date''' - } + script{ + scope.each { + sh """ + date + cd ${WKC}/tests + ./test-CI.sh ${it} 5 ${mod[0]} + date""" + } + } + } } } - stage('python_2_s5') { - agent{label " slave5 || slave15 "} + stage('python_2') { + agent{label " slave2 || slave7 || slave12 || slave17 "} steps { pre_test() timeout(time: 55, unit: 'MINUTES'){ - sh ''' - date - cd ${WKC}/tests - ./test-all.sh p2 - date''' - } - } - } - stage('python_3_s6') { - agent{label " slave6 || slave16 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ - pre_test() - sh ''' - date - cd ${WKC}/tests - ./test-all.sh p3 - date''' + script{ + scope.each { + sh """ + date + cd ${WKC}/tests + ./test-CI.sh ${it} 5 ${mod[1]} + date""" + } + } } } } - stage('test_b1_s2') { - agent{label " slave2 || slave12 "} + stage('python_3') { + agent{label " slave3 || slave8 || slave13 ||slave18 "} steps { timeout(time: 105, unit: 'MINUTES'){ pre_test() - sh ''' - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - nohup taosd >/dev/null & - sleep 10 - ''' - - sh ''' - cd ${WKC}/src/connector/python - export PYTHONPATH=$PWD/ - export LD_LIBRARY_PATH=${WKC}/debug/build/lib - pip3 install pytest - pytest tests/ - - python3 examples/bind-multi.py - python3 examples/bind-row.py - python3 examples/demo.py - python3 examples/insert-lines.py - python3 examples/pep-249.py - python3 examples/query-async.py - python3 examples/query-objectively.py - python3 examples/subscribe-sync.py - python3 examples/subscribe-async.py - ''' - - sh ''' - cd ${WKC}/src/connector/nodejs - npm install - npm run test - cd ${WKC}/tests/examples/nodejs - npm install td2.0-connector > /dev/null 2>&1 - node nodejsChecker.js host=localhost - node test1970.js - cd ${WKC}/tests/connectorTest/nodejsTest/nanosupport - npm install td2.0-connector > /dev/null 2>&1 - node nanosecondTest.js - ''' - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh ''' - cd ${WKC}/src/connector/C# - dotnet test - dotnet run --project src/test/Cases/Cases.csproj - - cd ${WKC}/tests/examples/C# - dotnet run --project C#checker/C#checker.csproj - dotnet run --project TDengineTest/TDengineTest.csproj - dotnet run --project schemaless/schemaless.csproj - - cd ${WKC}/tests/examples/C#/taosdemo - dotnet build -c Release - tree | true - ./bin/Release/net5.0/taosdemo -c /etc/taos -y - ''' + script{ + scope.each { + sh """ + date + cd ${WKC}/tests + ./test-CI.sh ${it} 5 ${mod[2]} + date""" + } } - sh ''' - cd ${WKC}/tests/gotest - bash batchtest.sh - ''' - sh ''' - cd ${WKC}/tests - ./test-all.sh b1fq - date''' } } } - stage('test_crash_gen_s3') { - agent{label " slave3 || slave13 "} - + stage('python_4') { + agent{label " slave4 || slave9 || slave14 || slave19 "} steps { - pre_test() - timeout(time: 60, unit: 'MINUTES'){ - sh ''' - cd ${WKC}/tests/pytest - ./crash_gen.sh -a -p -t 4 -s 2000 - ''' - } - timeout(time: 60, unit: 'MINUTES'){ - sh ''' - cd ${WKC}/tests/pytest - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - ./handle_crash_gen_val_log.sh - ''' - sh ''' - cd ${WKC}/tests/pytest - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - ./handle_taosd_val_log.sh - ''' - } timeout(time: 55, unit: 'MINUTES'){ - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b2fq - date - ''' - } - } - } - stage('test_valgrind_s4') { - agent{label " slave4 || slave14 "} - - steps { - pre_test() - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh ''' - cd ${WKC}/tests/pytest - ./valgrind-test.sh 2>&1 > mem-error-out.log - ./handle_val_log.sh - ''' - } - timeout(time: 55, unit: 'MINUTES'){ - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b3fq - date''' - sh ''' - date - cd ${WKC}/tests - ./test-all.sh full example - date''' - } - } - } - stage('test_b4_s7') { - agent{label " slave7 || slave17 "} - steps { - timeout(time: 105, unit: 'MINUTES'){ pre_test() - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b4fq - cd ${WKC}/tests - ./test-all.sh p4 - ''' - // cd ${WKC}/tests - // ./test-all.sh full jdbc - // cd ${WKC}/tests - // ./test-all.sh full unit - } - } - } - stage('test_b5_s8') { - agent{label " slave8 || slave18 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ - pre_test() - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b5fq - date''' - } - } - } - stage('test_b6_s9') { - agent{label " slave9 || slave19 "} - steps { - timeout(time: 55, unit: 'MINUTES'){ - pre_test() - sh ''' - cd ${WKC}/tests - ./test-all.sh develop-test - ''' - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b6fq - date''' + script{ + scope.each { + sh """ + date + cd ${WKC}/tests + ./test-CI.sh ${it} 5 ${mod[3]} + date""" + } + } + } } } - stage('test_b7_s10') { - agent{label " slave10 || slave20 "} + stage('python_5') { + agent{label " slave5 || slave10 || slave15 || slave20 "} steps { timeout(time: 55, unit: 'MINUTES'){ pre_test() - sh ''' - cd ${WKC}/tests - ./test-all.sh system-test - ''' - sh ''' - date - cd ${WKC}/tests - ./test-all.sh b7fq - date''' + script{ + scope.each { + sh """ + date + cd ${WKC}/tests + ./test-CI.sh ${it} 5 ${mod[4]} + date""" + } + } + } } } @@ -813,3 +654,4 @@ pipeline { } } } + diff --git a/tests/develop-test/3-connectors/c#/test.sh b/tests/develop-test/3-connectors/c#/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..2d4f18b668263d40bb18ef46f34b7299b3f7cdd3 --- /dev/null +++ b/tests/develop-test/3-connectors/c#/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` +cd ${WKC}/src/connector/C# +dotnet test +dotnet run --project src/test/Cases/Cases.csproj + +cd ${WKC}/tests/examples/C# +dotnet run --project C#checker/C#checker.csproj +dotnet run --project TDengineTest/TDengineTest.csproj +dotnet run --project schemaless/schemaless.csproj + +cd ${WKC}/tests/examples/C#/taosdemo +dotnet build -c Release +tree | true +./bin/Release/net5.0/taosdemo -c /etc/taos -y diff --git a/tests/develop-test/3-connectors/go/test.sh b/tests/develop-test/3-connectors/go/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..097723ad461b69c75e18bc8018c025f0e9f7a3e3 --- /dev/null +++ b/tests/develop-test/3-connectors/go/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` + diff --git a/tests/develop-test/3-connectors/java/test.sh b/tests/develop-test/3-connectors/java/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..15f7b84955b793e0fb6acaa434fba83c6ff0c710 --- /dev/null +++ b/tests/develop-test/3-connectors/java/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 diff --git a/tests/develop-test/3-connectors/nodejs/test.sh b/tests/develop-test/3-connectors/nodejs/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b1d8bb4790d6273e32a42ce50979e98e1ce5a92 --- /dev/null +++ b/tests/develop-test/3-connectors/nodejs/test.sh @@ -0,0 +1,29 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` +cd ${WKC}/src/connector/nodejs +npm install +npm run test +cd ${WKC}/tests/examples/nodejs +npm install td2.0-connector > /dev/null 2>&1 +node nodejsChecker.js host=localhost +node test1970.js +cd ${WKC}/tests/connectorTest/nodejsTest/nanosupport +npm install td2.0-connector > /dev/null 2>&1 +node nanosecondTest.js diff --git a/tests/develop-test/3-connectors/python/test.sh b/tests/develop-test/3-connectors/python/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..fe0dfbdac99f6938c8a57d13666f609c2c7c5d33 --- /dev/null +++ b/tests/develop-test/3-connectors/python/test.sh @@ -0,0 +1,30 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../src/connector/python +pip3 install pytest +pytest tests/ + +python3 examples/bind-multi.py +python3 examples/bind-row.py +python3 examples/demo.py +python3 examples/insert-lines.py +python3 examples/pep-249.py +python3 examples/query-async.py +python3 examples/query-objectively.py +python3 examples/subscribe-sync.py +python3 examples/subscribe-async.py diff --git a/tests/develop-test/3-connectors/restful/test.sh b/tests/develop-test/3-connectors/restful/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..1c6d8fbc2c5da6633d749054a19a5bde7772faf7 --- /dev/null +++ b/tests/develop-test/3-connectors/restful/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` diff --git a/tests/develop-test/3-connectors/rust/test.sh b/tests/develop-test/3-connectors/rust/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..4bf6394b27cf43674ed38a1e4de46342ee3b1ae4 --- /dev/null +++ b/tests/develop-test/3-connectors/rust/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` \ No newline at end of file diff --git a/tests/develop-test/fulltest-connector.sh b/tests/develop-test/fulltest-connector.sh index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..81999dc2cf8d8945487387463c86f18106a97641 100755 --- a/tests/develop-test/fulltest-connector.sh +++ b/tests/develop-test/fulltest-connector.sh @@ -0,0 +1,7 @@ +bash 3-connectors/c#/test.sh +bash 3-connectors/go/test.sh +bash 3-connectors/java/test.sh +bash 3-connectors/nodejs/test.sh +bash 3-connectors/python/test.sh +bash 3-connectors/restful/test.sh +bash 3-connectors/rust/test.sh diff --git a/tests/develop-test/fulltest-insert.sh b/tests/develop-test/fulltest-insert.sh index 8269dbb5bc0fce1dbc67a36e09edc21ac1ee5f26..532f7e6fc0446f6a68ca0a5e80be070684a71c23 100755 --- a/tests/develop-test/fulltest-insert.sh +++ b/tests/develop-test/fulltest-insert.sh @@ -1 +1 @@ -python3 ./test.py -f 1-insert/batchInsert.py +python3 ./test.py -f 1-insert/batchInsert.py \ No newline at end of file diff --git a/tests/develop-test/fulltest-others.sh b/tests/develop-test/fulltest-others.sh index eea6e856ba170ebfcf64df8e63dbe91abbaf2c38..bb0bb585b5323b45d43b01404093b97babca3ab7 100755 --- a/tests/develop-test/fulltest-others.sh +++ b/tests/develop-test/fulltest-others.sh @@ -1 +1 @@ -python3 ./test.py -f 0-others/json_tag.py +python3 ./test.py -f 0-others/json_tag.py \ No newline at end of file diff --git a/tests/develop-test/fulltest-query.sh b/tests/develop-test/fulltest-query.sh index ed8a4fcd9d92ca631395a233c07095eb983df5fe..b5147d20a399e6e19bcb7d84985a83a187429780 100755 --- a/tests/develop-test/fulltest-query.sh +++ b/tests/develop-test/fulltest-query.sh @@ -1,3 +1,3 @@ -python3 ./test.py -f 2-query/ts_hidden_column.py -python3 ./test.py -f 2-query/union-order.py -python3 ./test.py -f 2-query/session_two_stage.py +python3 ./test.py -f 2-query/ts_hidden_column.py +python3 ./test.py -f 2-query/union-order.py +python3 ./test.py -f 2-query/session_two_stage.py diff --git a/tests/develop-test/fulltest-tools.sh b/tests/develop-test/fulltest-tools.sh index 52e6ac28bfc62be3106150c05f95e249a4c62b54..df6e1718ccf31dfc1a2e5b652a0e38acedb8fe69 100755 --- a/tests/develop-test/fulltest-tools.sh +++ b/tests/develop-test/fulltest-tools.sh @@ -1 +1 @@ -python3 ./test.py -f 5-taos-tools/taosdump/taosdumpTestTypeJson.py +python3 ./test.py -f 5-taos-tools/taosdump/taosdumpTestTypeJson.py \ No newline at end of file diff --git a/tests/pytest/fulltest-connector.sh b/tests/pytest/fulltest-connector.sh index 701c316040970b9077e6c730c1346dcf8759f673..1e456503989f47a20a4595c86a1df0b4c3a32946 100755 --- a/tests/pytest/fulltest-connector.sh +++ b/tests/pytest/fulltest-connector.sh @@ -1,13 +1,2 @@ #!/bin/bash -ulimit -c unlimited -#======================p1-start=============== - -# restful test for python -# python3 test.py -f restful/restful_bind_db1.py -# python3 test.py -f restful/restful_bind_db2.py -python3 ./test.py -f client/nettest.py - -python3 ./test.py -f ../system-test/4-taosAdapter/taosAdapter_query.py -python3 ./test.py -f ../system-test/4-taosAdapter/taosAdapter_insert.py - -#======================p1-end=============== +ulimit -c unlimited \ No newline at end of file diff --git a/tests/pytest/fulltest-insert.sh b/tests/pytest/fulltest-insert.sh index 85b36bda29a047c788eb00b991bb890a2c270bac..153bc072dba128fa8f5635e26aba0d30066b9c9a 100755 --- a/tests/pytest/fulltest-insert.sh +++ b/tests/pytest/fulltest-insert.sh @@ -4,7 +4,6 @@ ulimit -c unlimited python3 testCompress.py python3 testNoCompress.py - python3 ./test.py -f import_merge/importBlock1HO.py python3 ./test.py -f import_merge/importBlock1HPO.py python3 ./test.py -f import_merge/importBlock1H.py @@ -23,10 +22,6 @@ python3 ./test.py -f import_merge/importBlock2TPO.py python3 ./test.py -f import_merge/importBlock2T.py python3 ./test.py -f import_merge/importBlockbetween.py python3 ./test.py -f import_merge/importCacheFileHO.py - -#======================p1-end=============== -#======================p2-start=============== - python3 ./test.py -f import_merge/importCacheFileHPO.py python3 ./test.py -f import_merge/importCacheFileH.py python3 ./test.py -f import_merge/importCacheFileS.py @@ -48,10 +43,6 @@ python3 ./test.py -f import_merge/importDataLastTPO.py python3 ./test.py -f import_merge/importDataLastT.py python3 ./test.py -f import_merge/importDataS.py python3 ./test.py -f import_merge/importDataSub.py - -#======================p2-end=============== -#======================p3-start=============== - python3 ./test.py -f import_merge/importDataTO.py python3 ./test.py -f import_merge/importDataTPO.py python3 ./test.py -f import_merge/importDataT.py @@ -73,10 +64,6 @@ python3 ./test.py -f import_merge/importSpan.py python3 ./test.py -f import_merge/importSRestart.py python3 ./test.py -f import_merge/importSubRestart.py python3 ./test.py -f import_merge/importTailOverlap.py - -#======================p3-end=============== -#======================p4-start=============== - python3 ./test.py -f import_merge/importTailPartOverlap.py python3 ./test.py -f import_merge/importTail.py python3 ./test.py -f import_merge/importToCommit.py @@ -88,7 +75,6 @@ python3 ./test.py -f import_merge/importCSV.py python3 ./test.py -f import_merge/import_update_0.py python3 ./test.py -f import_merge/import_update_1.py python3 ./test.py -f import_merge/import_update_2.py - python3 ./test.py -f insert/basic.py python3 ./test.py -f insert/int.py python3 ./test.py -f insert/float.py @@ -98,8 +84,6 @@ python3 ./test.py -f insert/double.py python3 ./test.py -f insert/smallint.py python3 ./test.py -f insert/tinyint.py python3 ./test.py -f insert/date.py - - python3 ./test.py -f insert/binary.py python3 ./test.py -f insert/nchar.py #python3 ./test.py -f insert/nchar-boundary.py @@ -133,41 +117,21 @@ python3 ./test.py -f insert/verifyMemToDiskCrash.py #python3 ./test.py -f insert/schemalessInsert.py #python3 ./test.py -f insert/openTsdbJsonInsert.py python3 ./test.py -f insert/openTsdbTelnetLinesInsert.py - - -# update python3 ./test.py -f update/merge_commit_data.py python3 ./test.py -f update/allow_update.py python3 ./test.py -f update/allow_update-0.py python3 ./test.py -f update/append_commit_data.py python3 ./test.py -f update/append_commit_last-0.py python3 ./test.py -f update/append_commit_last.py - - python3 ./test.py -f update/merge_commit_data2.py python3 ./test.py -f update/merge_commit_data2_update0.py python3 ./test.py -f update/merge_commit_last-0.py python3 ./test.py -f update/merge_commit_last.py python3 ./test.py -f update/update_options.py python3 ./test.py -f update/merge_commit_data-0.py - -# wal python3 ./test.py -f wal/addOldWalTest.py python3 ./test.py -f wal/sdbComp.py -#======================p4-end=============== -#======================p5-start=============== -python3 ./test.py -f ../system-test/1-insert/0-sql/basic.py -python3 ./test.py -f ../develop-test/1-insert/0-sql/basic.py -python3 ./test.py -f ../develop-test/1-insert/0-sql/batchInsert.py - -#======================p5-end=============== - - - - - - diff --git a/tests/system-test/3-connectors/c#/test.sh b/tests/system-test/3-connectors/c#/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..2d4f18b668263d40bb18ef46f34b7299b3f7cdd3 --- /dev/null +++ b/tests/system-test/3-connectors/c#/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` +cd ${WKC}/src/connector/C# +dotnet test +dotnet run --project src/test/Cases/Cases.csproj + +cd ${WKC}/tests/examples/C# +dotnet run --project C#checker/C#checker.csproj +dotnet run --project TDengineTest/TDengineTest.csproj +dotnet run --project schemaless/schemaless.csproj + +cd ${WKC}/tests/examples/C#/taosdemo +dotnet build -c Release +tree | true +./bin/Release/net5.0/taosdemo -c /etc/taos -y diff --git a/tests/system-test/3-connectors/go/test.sh b/tests/system-test/3-connectors/go/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..097723ad461b69c75e18bc8018c025f0e9f7a3e3 --- /dev/null +++ b/tests/system-test/3-connectors/go/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` + diff --git a/tests/system-test/3-connectors/java/test.sh b/tests/system-test/3-connectors/java/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..15f7b84955b793e0fb6acaa434fba83c6ff0c710 --- /dev/null +++ b/tests/system-test/3-connectors/java/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 diff --git a/tests/system-test/3-connectors/nodejs/test.sh b/tests/system-test/3-connectors/nodejs/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b1d8bb4790d6273e32a42ce50979e98e1ce5a92 --- /dev/null +++ b/tests/system-test/3-connectors/nodejs/test.sh @@ -0,0 +1,29 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` +cd ${WKC}/src/connector/nodejs +npm install +npm run test +cd ${WKC}/tests/examples/nodejs +npm install td2.0-connector > /dev/null 2>&1 +node nodejsChecker.js host=localhost +node test1970.js +cd ${WKC}/tests/connectorTest/nodejsTest/nanosupport +npm install td2.0-connector > /dev/null 2>&1 +node nanosecondTest.js diff --git a/tests/system-test/3-connectors/python/test.sh b/tests/system-test/3-connectors/python/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..fe0dfbdac99f6938c8a57d13666f609c2c7c5d33 --- /dev/null +++ b/tests/system-test/3-connectors/python/test.sh @@ -0,0 +1,30 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../src/connector/python +pip3 install pytest +pytest tests/ + +python3 examples/bind-multi.py +python3 examples/bind-row.py +python3 examples/demo.py +python3 examples/insert-lines.py +python3 examples/pep-249.py +python3 examples/query-async.py +python3 examples/query-objectively.py +python3 examples/subscribe-sync.py +python3 examples/subscribe-async.py diff --git a/tests/system-test/3-connectors/restful/test.sh b/tests/system-test/3-connectors/restful/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..1c6d8fbc2c5da6633d749054a19a5bde7772faf7 --- /dev/null +++ b/tests/system-test/3-connectors/restful/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` diff --git a/tests/system-test/3-connectors/rust/test.sh b/tests/system-test/3-connectors/rust/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..4bf6394b27cf43674ed38a1e4de46342ee3b1ae4 --- /dev/null +++ b/tests/system-test/3-connectors/rust/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} +stopTaosd +rm -rf /var/lib/taos/* +rm -rf /var/log/taos/* +nohup taosd -c /etc/taos/ > /dev/null 2>&1 & +sleep 10 +cd ../../ +WKC=`pwd` \ No newline at end of file diff --git a/tests/system-test/fulltest-connector.sh b/tests/system-test/fulltest-connector.sh index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..dbb77b2ce07d8c34c549a22a3218ebcb6894d2a3 100755 --- a/tests/system-test/fulltest-connector.sh +++ b/tests/system-test/fulltest-connector.sh @@ -0,0 +1,7 @@ +bash 3-connectors/c#/test.sh +bash 3-connectors/go/test.sh +bash 3-connectors/java/test.sh +bash 3-connectors/nodejs/test.sh +bash 3-connectors/python/test.sh +bash 3-connectors/restful/test.sh +bash 3-connectors/rust/test.sh diff --git a/tests/system-test/fulltest-others.sh b/tests/system-test/fulltest-others.sh index e098631f97ee913ad22ed5f30abbc8212798a53d..26e6aee2b90a619329e23bb8418b95cc0466a78f 100755 --- a/tests/system-test/fulltest-others.sh +++ b/tests/system-test/fulltest-others.sh @@ -1 +1 @@ -python3 ./test.py -f 0-others/create_col_tag.py +python3 ./test.py -f 0-others/create_col_tag.py \ No newline at end of file diff --git a/tests/system-test/fulltest-query.sh b/tests/system-test/fulltest-query.sh index 466252e7a77b06ea2aaa9624c5f37b9d9e65b649..104781def751ca8df6028dc7afe5dd80a172b4ff 100755 --- a/tests/system-test/fulltest-query.sh +++ b/tests/system-test/fulltest-query.sh @@ -6,4 +6,4 @@ python3 test.py -f 2-query/TD-11256.py python3 ./test.py -f 2-query/TD-11389.py python3 ./test.py -f 2-query/TD-11945_crash.py python3 ./test.py -f 2-query/TD-12340-12342.py -python3 ./test.py -f 2-query/TD-12344.py +python3 ./test.py -f 2-query/TD-12344.py \ No newline at end of file diff --git a/tests/system-test/fulltest-taosAdapter.sh b/tests/system-test/fulltest-taosAdapter.sh index 9573acaf1aab16fa3cdbfc80b7d10ec94307cb05..f7ca439fd4407438d3ffaf11a6dcd2c839508404 100755 --- a/tests/system-test/fulltest-taosAdapter.sh +++ b/tests/system-test/fulltest-taosAdapter.sh @@ -1,6 +1,3 @@ - python3 test.py -f 4-taosAdapter/TD-12163.py - python3 ./test.py -f 4-taosAdapter/taosAdapter_insert.py -python3 ./test.py -f 4-taosAdapter/taosAdapter_query.py - +python3 ./test.py -f 4-taosAdapter/taosAdapter_query.py \ No newline at end of file diff --git a/tests/test-CI.sh b/tests/test-CI.sh new file mode 100755 index 0000000000000000000000000000000000000000..f08479bc806a5a8b0f8918f292769924b9134502 --- /dev/null +++ b/tests/test-CI.sh @@ -0,0 +1,222 @@ +#!/bin/bash + +# Color setting +RED='\033[0;31m' +GREEN='\033[1;32m' +GREEN_DARK='\033[0;32m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' + +tests_dir=`pwd` +IN_TDINTERNAL="community" + +function stopTaosd { + echo "Stop taosd" + sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail' + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosd + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done +} + +function dohavecore(){ + corefile=`find $corepath -mmin 1` + if [ -n "$corefile" ];then + core_file=`echo $corefile|cut -d " " -f2` + proc=`file $core_file|awk -F "execfn:" '/execfn:/{print $2}'|tr -d \' |awk '{print $1}'|tr -d \,` + echo 'taosd or taos has generated core' + rm case.log + if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]] && [[ $1 == 1 ]]; then + cd ../../../ + tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz debug/build/bin/taosd debug/build/bin/tsim debug/build/lib/libtaos*so* + if [[ $2 == 1 ]];then + cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"` + else + cd community + cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` + fi + else + cd ../../ + if [[ $1 == 1 ]];then + tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz debug/build/bin/taosd debug/build/bin/tsim debug/build/lib/libtaos*so* + cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` + fi + fi + if [[ $1 == 1 ]];then + echo '\n'|gdb $proc $core_file -ex "bt 10" -ex quit + exit 8 + fi + fi +} + + +function runPyCaseOneByOne { + while read -r line; do + if [[ $line =~ ^python.* ]]; then + if [[ $line != *sleep* ]]; then + + if [[ $line =~ '-r' ]];then + case=`echo $line|awk '{print $4}'` + else + case=`echo $line|awk '{print $NF}'` + fi + start_time=`date +%s` + date +%F\ %T | tee -a pytest-out.log + echo -n $case + $line > /dev/null 2>&1 && \ + echo -e "${GREEN} success${NC}" | tee -a pytest-out.log || \ + echo -e "${RED} failed${NC}" | tee -a pytest-out.log + end_time=`date +%s` + out_log=`tail -1 pytest-out.log ` + # if [[ $out_log =~ 'failed' ]];then + # exit 8 + # fi + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log + else + $line > /dev/null 2>&1 + fi + fi + done < $1 +} + +function runPyCaseOneByOnefq() { + end=`sed -n '$=' $1` + for ((i=1;i<=$end;i++)) ; do + if [[ $(($i%$2)) -eq $4 ]];then + line=`sed -n "$i"p $1` + if [[ $line =~ ^python.* ]]; then + if [[ $line != *sleep* ]]; then + + if [[ $line =~ '-r' ]];then + case=`echo $line|awk '{print $4}'` + else + case=`echo $line|awk '{print $NF}'` + fi + start_time=`date +%s` + date +%F\ %T | tee -a pytest-out.log + echo -n $case + if [[ $1 =~ full ]] ; then + line=$line" -s" + fi + $line > case.log 2>&1 && \ + echo -e "${GREEN} success${NC}" | tee -a pytest-out.log || \ + echo -e "${RED} failed${NC}" | tee -a pytest-out.log + end_time=`date +%s` + out_log=`tail -1 pytest-out.log ` + if [[ $out_log =~ 'failed' ]];then + cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` + echo '=====================log===================== ' + cat case.log + rm -rf case.log + dohavecore $3 2 + if [[ $3 == 1 ]];then + exit 8 + fi + fi + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log + else + $line > /dev/null 2>&1 + fi + dohavecore $3 2 + else + echo $line + if [[ $line =~ ^bash.* ]]; then + # $line > case.log 2>&1 || cat case.log && exit 8 + # cat case.log + $line > case.log 2>&1 + if [ $? -ne 0 ];then + cat case.log + exit 8 + fi + fi + fi + fi + done + rm -rf ../../sim/case.log +} + +###################### +# main entry +###################### + +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) OS=Linux;; + Darwin*) OS=Darwin;; + CYGWIN*) OS=Windows;; + *) OS=Unknown;; +esac + +case "${OS}" in + Linux*) TAOSLIB=libtaos.so;; + Darwin*) TAOSLIB=libtaos.dylib;; + Windows*) TAOSLIB=taos.dll;; + Unknown) TAOSLIB="UNKNOWN:${unameOut}";; +esac + +echo TAOSLIB is ${TAOSLIB} + +totalFailed=0 +totalPyFailed=0 +totalJDBCFailed=0 +totalUnitFailed=0 +totalExampleFailed=0 +totalApiFailed=0 + +if [ "${OS}" == "Linux" ]; then + corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` + if [ -z "$corepath" ];then + echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied" + corepath="/coredump/" + fi +fi + + +echo "### run Python test case ###" + +cd $tests_dir + +if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then + cd ../.. +else + cd ../ +fi + +TOP_DIR=`pwd` +TAOSLIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1` +if [[ "$TAOSLIB_DIR" == *"$IN_TDINTERNAL"* ]]; then + LIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1|cut -d '/' -f 2,3,4,5` +else + LIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1|cut -d '/' -f 2,3,4` +fi + +export LD_LIBRARY_PATH=$TOP_DIR/$LIB_DIR:$LD_LIBRARY_PATH + +cd $tests_dir/pytest + +[ -f pytest-out.log ] && rm -f pytest-out.log + +if [ "$1" == "full" ]; then + echo "### run Python full test ###" + runPyCaseOneByOne fulltest-tools.sh + runPyCaseOneByOne fulltest-query.sh + runPyCaseOneByOne fulltest-other.sh + runPyCaseOneByOne fulltest-insert.sh + runPyCaseOneByOne fulltest-connector.sh +else + echo "### run $1 $2 test ###" + if [ "$1" != "query" ] && [ "$1" != "other" ] && [ "$1" != "tools" ] && [ "$1" != "insert" ] && [ "$1" != "connector" ] ;then + echo " wrong option:$1 must one of [query,other,tools,insert,connector]" + exit 8 + fi + cd $tests_dir/pytest + runPyCaseOneByOnefq fulltest-$1.sh $2 1 $3 + cd $tests_dir/develop-test + runPyCaseOneByOnefq fulltest-$1.sh $2 1 $3 + cd $tests_dir/system-test + runPyCaseOneByOnefq fulltest-$1.sh $2 1 $3 +fi +