diff --git a/tests/parallel_test/Jenkinsfile b/tests/parallel_test/Jenkinsfile index a49a7459d6e655c12813e4989df9a2c4209b4974..95c8cf83d9b6b2514588234cbce27c06343e4c17 100644 --- a/tests/parallel_test/Jenkinsfile +++ b/tests/parallel_test/Jenkinsfile @@ -4,7 +4,10 @@ import jenkins.model.CauseOfInterruption node { } def sync_source() { - sh 'hostname' + sh ''' + hostname + date + ''' sh ''' cd ${WKC} [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" @@ -40,7 +43,7 @@ def sync_source() { git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD - echo "// git clean -dfx" + git clean -dfx git submodule update --init --recursive cd ${WK} git reset --hard HEAD~10 @@ -73,7 +76,7 @@ def sync_source() { git pull >/dev/null export TZ=Asia/Harbin date - echo "// git clean -dfx" + git clean -dfx ''' } def pre_test() { @@ -82,11 +85,23 @@ def pre_test() { cd ${WK} mkdir -p debug cd debug + go env -w GOPROXY=https://goproxy.cn,direct + go env -w GO111MODULE=on cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null - make -j8> /dev/null - echo "make install > /dev/null" - cd ${WKC}/tests - echo "pip3 install ${WKC}/src/connector/python/" + make -j8 >/dev/null + ''' + return 1 +} +def pre_test_mac() { + sync_source() + sh ''' + cd ${WK} + mkdir -p debug + cd debug + go env -w GOPROXY=https://goproxy.cn,direct + go env -w GO111MODULE=on + cmake .. -DBUILD_TOOLS=false > /dev/null + make -j8 >/dev/null ''' return 1 } @@ -94,9 +109,9 @@ pipeline { agent {label " dispatcher "} options { skipDefaultCheckout() } environment{ - WK = '/root/jenkins/workspace/TDinternal' - WKC = '/root/jenkins/workspace/TDinternal/community' - LOGDIR = '/root/jenkins/workspace/log' + WK = '/var/data/jenkins/workspace/TDinternal' + WKC = '/var/data/jenkins/workspace/TDinternal/community' + LOGDIR = '/var/data/jenkins/workspace/log' } stages { stage ('pre_build') { @@ -121,8 +136,8 @@ pipeline { parallel { stage ('dispatcher sync source') { steps { - sync_source() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + sync_source() script { sh ''' echo "dispatcher ready" @@ -135,8 +150,8 @@ pipeline { stage ('build worker01') { agent {label " worker01 "} steps { - pre_test() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + pre_test() script { sh ''' echo "worker01 build done" @@ -149,8 +164,8 @@ pipeline { stage ('build worker02') { agent {label " worker02 "} steps { - pre_test() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + pre_test() script { sh ''' echo "worker02 build done" @@ -163,8 +178,8 @@ pipeline { stage ('build worker03') { agent {label " worker03 "} steps { - pre_test() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + pre_test() script { sh ''' echo "worker03 build done" @@ -177,8 +192,8 @@ pipeline { stage ('build worker04') { agent {label " worker04 "} steps { - pre_test() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + pre_test() script { sh ''' echo "worker04 build done" @@ -191,8 +206,8 @@ pipeline { stage ('build worker05') { agent {label " worker05 "} steps { - pre_test() - timeout(time: 100, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { + pre_test() script { sh ''' echo "worker05 build done" @@ -205,19 +220,65 @@ pipeline { } } stage('run test') { - steps { - sh ''' - date - hostname - ''' - timeout(time: 100, unit: 'MINUTES') { - sh ''' - date - cd ${WKC}/tests/parallel_test - time ./run.sh -m m.json -t cases.task -l ${LOGDIR} -b ${BRANCH_NAME} - date - hostname - ''' + parallel { + stage ('build worker06_arm64') { + agent {label " worker06_arm64 "} + steps { + timeout(time: 20, unit: 'MINUTES') { + pre_test() + script { + sh ''' + echo "worker06_arm64 build done" + date + ''' + } + } + } + } + stage ('build worker07_arm64') { + agent {label " worker07_arm64 "} + steps { + timeout(time: 20, unit: 'MINUTES') { + pre_test() + script { + sh ''' + echo "worker07_arm64 build done" + date + ''' + } + } + } + } + stage ('build Mac_catalina ') { + agent {label " Mac_catalina "} + steps { + timeout(time: 20, unit: 'MINUTES') { + pre_test_mac() + script { + sh ''' + echo "Mac_catalina build done" + date + ''' + } + } + } + } + stage('run cases') { + steps { + sh ''' + date + hostname + ''' + timeout(time: 60, unit: 'MINUTES') { + sh ''' + date + cd ${WKC}/tests/parallel_test + time ./run.sh -m m.json -t cases.task -l ${LOGDIR} -b ${BRANCH_NAME} + date + hostname + ''' + } + } } } } diff --git a/tests/parallel_test/m.json b/tests/parallel_test/m.json index 13d7cb776fd7147f6ffe1a17a87e4f3046939a9e..f86c571728962783867680901dfa2611c37e660e 100644 --- a/tests/parallel_test/m.json +++ b/tests/parallel_test/m.json @@ -1,30 +1,30 @@ [{ "host":"192.168.0.210", "username":"root", - "workdir":"/root/jenkins/workspace", + "workdir":"/var/data/jenkins/workspace", "thread":25 }, { "host":"192.168.0.211", "username":"root", - "workdir":"/root/jenkins/workspace", + "workdir":"/var/data/jenkins/workspace", "thread":25 }, { "host":"192.168.0.212", "username":"root", - "workdir":"/root/jenkins/workspace", + "workdir":"/var/data/jenkins/workspace", "thread":25 }, { "host":"192.168.0.213", "username":"root", - "workdir":"/root/jenkins/workspace", + "workdir":"/var/data/jenkins/workspace", "thread":25 }, { "host":"192.168.0.214", "username":"root", - "workdir":"/root/jenkins/workspace", + "workdir":"/var/data/jenkins/workspace", "thread":25 }] diff --git a/tests/parallel_test/run.sh b/tests/parallel_test/run.sh index cf881300c1a13526e96a3be8163bc2c501be95e0..582615f62d84eea218dd3bab27421f380d211865 100755 --- a/tests/parallel_test/run.sh +++ b/tests/parallel_test/run.sh @@ -269,7 +269,9 @@ function run_thread() { local corefile=`ls $log_dir/${case_file}.coredump/` corefile=`find $log_dir/${case_file}.coredump/ -name "core.*"` echo -e "$case_info \e[31m failed\e[0m" + echo "=========================log============================" cat $log_dir/$case_file.log + echo "=====================================================" echo -e "\e[34m log file: $log_dir/$case_file.log \e[0m" if [ ! -z $corefile ]; then echo -e "\e[34m corefiles: $corefile \e[0m" @@ -347,4 +349,6 @@ fi echo "${log_dir}" >&2 +date + exit $RET diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index ca408147586514f664ff032943d766345ec0921a..35e214d4ab4696a54be8bfb47216f13071bd803d 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -97,3 +97,6 @@ docker run \ -e PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$CONTAINER_TESTDIR/debug/build/bin:/usr/local/go/bin:/usr/local/node-v12.20.0-linux-x64/bin:/usr/local/apache-maven-3.8.4/bin:/usr/local/jdk1.8.0_144/bin \ -e JAVA_HOME=/usr/local/jdk1.8.0_144 \ --rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" +ret=$? +exit $ret +