[Asterisk-code-review] CI: Add weekly REF DEBUG testsuite run (asterisk[master])

Jenkins2 asteriskteam at digium.com
Mon Jul 16 13:14:39 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9447 )

Change subject: CI:  Add weekly REF_DEBUG testsuite run
......................................................................

CI:  Add weekly REF_DEBUG testsuite run

Change-Id: I5b581d0a0d1d1bb9b38961d40b112fb448355037
---
M tests/CI/buildAsterisk.sh
A tests/CI/ref_debug.jenkinsfile
A tests/CI/ref_debugTestGroups.json
3 files changed, 163 insertions(+), 0 deletions(-)

Approvals:
  Jenkins2: Looks good to me, approved; Approved for Submit



diff --git a/tests/CI/buildAsterisk.sh b/tests/CI/buildAsterisk.sh
index 85f347c..9840d85 100755
--- a/tests/CI/buildAsterisk.sh
+++ b/tests/CI/buildAsterisk.sh
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 
 CIDIR=$(dirname $(readlink -fn $0))
+REF_DEBUG=0
 source $CIDIR/ci.functions
 
 gen_cats() {
@@ -70,6 +71,9 @@
 
 runner menuselect/menuselect `gen_mods enable DONT_OPTIMIZE BETTER_BACKTRACES MALLOC_DEBUG DO_CRASH TEST_FRAMEWORK` menuselect.makeopts
 runner menuselect/menuselect `gen_mods disable COMPILE_DOUBLE BUILD_NATIVE` menuselect.makeopts
+if [ $REF_DEBUG -eq 1 ] ; then
+	runner menuselect/menuselect --enable REF_DEBUG menuselect.makeopts
+fi
 
 cat_enables="MENUSELECT_BRIDGES MENUSELECT_CEL MENUSELECT_CDR"
 cat_enables+=" MENUSELECT_CHANNELS MENUSELECT_CODECS MENUSELECT_FORMATS MENUSELECT_FUNCS"
diff --git a/tests/CI/ref_debug.jenkinsfile b/tests/CI/ref_debug.jenkinsfile
new file mode 100644
index 0000000..45a1c6a
--- /dev/null
+++ b/tests/CI/ref_debug.jenkinsfile
@@ -0,0 +1,127 @@
+/*
+ * This pipeline is the "template" for the Asterisk REF_DEBUG Tests multi-branch
+ * parent job.  Jenkins will automatically scan the branches in the "asterisk"
+ * or "Security-asterisk" projects in Gerrit and automatically create a branch-
+ * specific job for each branch it finds this file in.
+ *
+ * This file starts as a declarative pipeline because with a declarative
+ * pipeline, you can define the trigger in the pipeline file.  This keeps
+ * everything in one place.  We transition to scripted pipeline later on because
+ * we need to dynamically determine which docker image we're going to use and
+ * you can't do that in a delcarative pipeline.
+ */
+pipeline {
+	triggers {
+		cron 'H H(0-4) * * 0'
+	}
+	
+	agent {
+		/* All of the stages need to be performed on a docker host */
+		label "swdev-docker"
+	}
+
+	stages {
+		stage ("->") {
+			steps {
+				/* Here's where we switch to scripted pipeline */
+				script {
+					stage ("Checkout") {
+						sh "sudo chown -R jenkins:users ."  
+						sh "printenv | sort"
+						sh "sudo tests/CI/setupJenkinsEnvironment.sh"
+					}
+
+					def images = env.DOCKER_IMAGES.split(' ')
+					def r = currentBuild.startTimeInMillis % images.length
+					def ri = images[(int)r]
+					def randomImage = env.DOCKER_REGISTRY + "/" + ri
+					def dockerOptions = "--ulimit core=0 --ulimit nofile=10240 " +
+						" -v /srv/jenkins:/srv/jenkins:rw -v /srv/cache:/srv/cache:rw " +
+						" --entrypoint=''"
+					def bt = env.BUILD_TAG.replaceAll(/[^a-zA-Z0-9_.-]/, '-')
+					def outputdir = "tests/CI/output/Testsuite"
+					def img = docker.image(randomImage)
+					img.pull()
+
+					stage ("Build") {
+						img.inside(dockerOptions + " --name ${bt}-build") {
+							echo 'Building..'
+							env.CCACHE_DIR = "/srv/cache/ccache"
+							sh "./tests/CI/buildAsterisk.sh --ref-debug --output-dir=${outputdir} --cache-dir=/srv/cache"
+
+							archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: false,
+								artifacts: "${outputdir}/*"
+						}
+					}
+
+					def testGroups = readJSON file: "tests/CI/ref_debugTestGroups.json"
+					def parallelTasks = [ : ]
+
+					for (def testGroup in testGroups) {
+						/*
+						 * Because each task is a Groovy closure, we need to
+						 * keep local references to some variables.
+						 */
+						def groupName = testGroup.name
+						def groupDir = testGroup.dir
+						def groupTestcmd = testGroup.testcmd
+						def testsuiteUrl = env.GIT_URL.replaceAll(/\/[^\/]+$/, "/\$1testsuite")
+
+						parallelTasks[groupName] = {
+							stage (groupName) {
+
+								img.inside("${dockerOptions} --name ${bt}-${groupName}") {
+
+									lock("${JOB_NAME}.${NODE_NAME}.installer") {
+										sh 'sudo ./tests/CI/installAsterisk.sh  --user-group=jenkins:users'
+									}
+
+									sh "sudo rm -rf ${groupDir} || : "
+									
+									checkout scm: [$class: 'GitSCM',
+										branches: [[name: "${BRANCH_NAME}"]],
+											extensions: [
+												[$class: 'RelativeTargetDirectory', relativeTargetDir: groupDir],
+												[$class: 'CloneOption',
+													noTags: true,
+													depth: 10,
+													honorRefspec: true,
+													shallow: true
+												],
+											],
+											userRemoteConfigs: [[url: testsuiteUrl]]
+										]
+
+									sh "sudo tests/CI/runTestsuite.sh --testsuite-dir='${groupDir}' --test-command='${groupTestcmd}'"
+
+									archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: true,
+										artifacts: "${groupDir}/asterisk-test-suite-report.xml, ${groupDir}/logs/**, ${groupDir}/core*.txt"
+
+									junit testResults: "${groupDir}/asterisk-test-suite-report.xml",
+										healthScaleFactor: 1.0,
+										keepLongStdio: true
+								}
+							}
+						}
+					}
+					parallel parallelTasks
+				}
+			}
+		}
+	}
+	post {
+		cleanup {
+			sh "sudo make distclean 2&>/dev/null || : "
+			sh "sudo rm -rf tests/CI/output  2&>/dev/null || : "
+		}
+		success {
+			echo "Reporting ${currentBuild.currentResult} Passed"
+		}
+		failure {
+			echo "Reporting ${currentBuild.currentResult}: Failed: Fatal Error"
+		}
+		unstable {
+			echo "Reporting ${currentBuild.currentResult}: Failed: Tests Failed"
+		}
+	}
+}
diff --git a/tests/CI/ref_debugTestGroups.json b/tests/CI/ref_debugTestGroups.json
new file mode 100644
index 0000000..b8c8e9b
--- /dev/null
+++ b/tests/CI/ref_debugTestGroups.json
@@ -0,0 +1,32 @@
+[
+	{
+		"name": "ari ",
+		"dir": "tests/CI/output/ari",
+		"testcmd": "-t tests/rest_api/"
+	},
+	{
+		"name": "pjs ",
+		"dir": "tests/CI/output/pjsip",
+		"testcmd": "-t tests/channels/pjsip"
+	},
+	{
+		"name": "sip ",
+		"dir": "tests/CI/output/sip",
+		"testcmd": "-t tests/channels/SIP"
+	},
+	{
+		"name": "iax ",
+		"dir": "tests/CI/output/iax2_local",
+		"testcmd": " -t tests/channels/iax2 -t tests/channels/local"
+	},
+	{
+		"name": "apps",
+		"dir": "tests/CI/output/agi-apps",
+		"testcmd": " -t tests/agi -t tests/apps -t blind-transfer-parkingtimeout"
+	},
+	{
+		"name": "othr",
+		"dir": "tests/CI/output/other",
+		"testcmd": " -T tests/(apps|agi|blind-transfer-parkingtimeout|rest_api|channels|realtime|example|skeleton_test|remote-test)"
+	}
+]

-- 
To view, visit https://gerrit.asterisk.org/9447
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5b581d0a0d1d1bb9b38961d40b112fb448355037
Gerrit-Change-Number: 9447
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180716/8f243f5f/attachment-0001.html>


More information about the asterisk-code-review mailing list