Skip to content

Commit c1676c8

Browse files
author
Kimmo Lepikko
committed
Support for running against mbed-os PRs
1 parent 90c55ed commit c1676c8

File tree

1 file changed

+49
-39
lines changed

1 file changed

+49
-39
lines changed

Jenkinsfile

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
2-
[$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: 'mbed-os-5.4', description: 'Revision of mbed-os to build'],
2+
[$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. To access mbed-os PR use format "pull/PR number/head"'],
33
[$class: 'BooleanParameterDefinition', name: 'smoke_test', defaultValue: true, description: 'Runs HW smoke tests on Cellular devices']
44
]]])
55

6-
echo "Run smoke tests: ${params.smoke_test}"
7-
8-
try {
9-
echo "Verifying build with mbed-os version ${mbed_os_revision}"
10-
env.MBED_OS_REVISION = "${mbed_os_revision}"
11-
} catch (err) {
12-
def mbed_os_revision = "master"
13-
echo "Verifying build with mbed-os version ${mbed_os_revision}"
14-
env.MBED_OS_REVISION = "${mbed_os_revision}"
6+
if (env.MBED_OS_REVISION == null) {
7+
echo 'First run in this branch, using default parameter values'
8+
env.MBED_OS_REVISION = ''
9+
}
10+
if (env.MBED_OS_REVISION == '') {
11+
echo 'Using mbed OS revision from mbed-os.lib'
12+
} else {
13+
echo "Using given mbed OS revision: ${env.MBED_OS_REVISION}"
14+
if (env.MBED_OS_REVISION.matches('pull/\\d+/head')) {
15+
echo "Revision is a Pull Request"
16+
}
1517
}
1618

1719
// Map RaaS instances to corresponding test suites
1820
def raas = [
1921
"cellular_smoke_ublox_c027.json": "8072"
20-
// Currently dragonfly is not supported by RAAS, skip it
21-
//"cellular_smoke_mts_dragonfly.json": "8072"
22-
]
22+
//"cellular_smoke_mtb_mts_dragonfly.json": "8119"
23+
]
2324

2425
// List of targets with supported modem families
2526
def target_families = [
26-
"UBLOX": ["UBLOX_C027"]
27-
]
27+
"UBLOX": ["UBLOX_C027"],
28+
"DRAGONFLY": ["MTB_MTS_DRAGONFLY"]
29+
]
2830

2931
// Supported Modems
3032
def targets = [
31-
"UBLOX_C027"
33+
"UBLOX_C027",
34+
"MTB_MTS_DRAGONFLY"
3235
]
3336

3437
// Map toolchains to compilers
3538
def toolchains = [
3639
ARM: "armcc",
3740
GCC_ARM: "arm-none-eabi-gcc",
38-
IAR: "iar_arm"
41+
IAR: "iar_arm",
42+
ARMC6: "arm6"
3943
]
4044

4145
// supported socket tests
@@ -67,11 +71,11 @@ for (int i = 0; i < target_families.size(); i++) {
6771
}
6872
}
6973

70-
7174
def parallelRunSmoke = [:]
7275

7376
// Need to compare boolean against string value
74-
if ( params.smoke_test == true ) {
77+
if (params.smoke_test == true) {
78+
echo "Running smoke tests"
7579
// Generate smoke tests based on suite amount
7680
for(int i = 0; i < raas.size(); i++) {
7781
for(int j = 0; j < sockets.size(); j++) {
@@ -84,6 +88,8 @@ if ( params.smoke_test == true ) {
8488
parallelRunSmoke[smokeStep] = run_smoke(target_families, raasPort, suite_to_run, toolchains, targets, socket)
8589
}
8690
}
91+
} else {
92+
echo "Skipping smoke tests"
8793
}
8894

8995
timestamps {
@@ -110,9 +116,17 @@ def buildStep(target_family, target, compilerLabel, toolchain, socket) {
110116

111117
// Set mbed-os to revision received as parameter
112118
execute ("mbed deploy --protocol ssh")
113-
//dir ("mbed-os") {
114-
// execute ("git checkout ${env.MBED_OS_REVISION}")
115-
//}
119+
if (env.MBED_OS_REVISION != '') {
120+
dir("mbed-os") {
121+
if (env.MBED_OS_REVISION.matches('pull/\\d+/head')) {
122+
// Use mbed-os PR and switch to branch created
123+
execute("git fetch origin ${env.MBED_OS_REVISION}:_PR_")
124+
execute("git checkout _PR_")
125+
} else {
126+
execute ("git checkout ${env.MBED_OS_REVISION}")
127+
}
128+
}
129+
}
116130

117131
execute ("mbed compile --build out/${target}_${toolchain}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
118132
}
@@ -132,11 +146,11 @@ def run_smoke(target_families, raasPort, suite_to_run, toolchains, targets, sock
132146
def suiteName = suite_to_run.substring(0, suite_to_run.indexOf('.'))
133147
stage ("smoke_${raasPort}_${suiteName}") {
134148
//node is actually the type of machine, i.e., mesh-test boild down to linux
135-
node ("mesh-test") {
149+
node ("linux") {
136150
deleteDir()
137151
dir("mbed-clitest") {
138152
git "[email protected]:ARMmbed/mbed-clitest.git"
139-
execute("git checkout master")
153+
execute("git checkout ${env.LATEST_CLITEST_STABLE_REL}")
140154
dir("mbed-clitest-suites") {
141155
git "[email protected]:ARMmbed/mbed-clitest-suites.git"
142156
execute("git submodule update --init --recursive")
@@ -149,23 +163,19 @@ def run_smoke(target_families, raasPort, suite_to_run, toolchains, targets, sock
149163
for (int i = 0; i < target_families.size(); i++) {
150164
for(int j = 0; j < toolchains.size(); j++) {
151165
for(int k = 0; k < targets.size(); k++) {
152-
def target_family = target_families.keySet().asList().get(i)
153-
def allowed_target_type = target_families.get(target_family)
154-
def target = targets.get(k)
155-
def toolchain = toolchains.keySet().asList().get(j)
156-
157-
if(allowed_target_type.contains(target)) {
158-
unstash "${target}_${toolchain}_${socket}"
159-
}
160-
}
166+
def target_family = target_families.keySet().asList().get(i)
167+
def allowed_target_type = target_families.get(target_family)
168+
def target = targets.get(k)
169+
def toolchain = toolchains.keySet().asList().get(j)
170+
171+
if(allowed_target_type.contains(target)) {
172+
unstash "${target}_${toolchain}_${socket}"
173+
}
174+
}
161175
}
162176
}
163-
if ("${suiteName}" == "cellular_smoke_mts_dragonfly") {
164-
execute("python clitest.py --suitedir mbed-clitest-suites/suites/ --suite ${suite_to_run} --type hardware --reset hard --raas 62.44.193.186:${raasPort} --tcdir mbed-clitest-suites/cellular --failure_return_value -vvv -w --log log_${raasPort}_${suiteName}")
165-
} else {
166-
execute("python clitest.py --suitedir mbed-clitest-suites/suites/ --suite ${suite_to_run} --type hardware --reset --raas 62.44.193.186:${raasPort} --tcdir mbed-clitest-suites/cellular --failure_return_value -vvv -w --log log_${raasPort}_${suiteName}")
167-
}
168-
archive "log_${raasPort}_${suiteName}/**/*"
177+
execute("python clitest.py --suitedir mbed-clitest-suites/suites/ --suite ${suite_to_run} --type hardware --reset --raas 62.44.193.186:${raasPort} --tcdir mbed-clitest-suites/cellular --failure_return_value -vvv -w --log log_${raasPort}_${suiteName}")
178+
archive "log_${raasPort}_${suiteName}/**/*"
169179
}
170180
}
171181
}

0 commit comments

Comments
 (0)