Skip to content

Commit 329fc7a

Browse files
author
Hasnain Virk
authored
Merge pull request #12 from ARMmbed/update_ptr
Code Simplification and mbed-os ptr update
2 parents d7ecd4a + 9e4f49b commit 329fc7a

File tree

4 files changed

+163
-183
lines changed

4 files changed

+163
-183
lines changed

Jenkinsfile

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,30 @@ def toolchains = [
3838
IAR: "iar_arm"
3939
]
4040

41+
// supported socket tests
42+
def sockets = [
43+
"udp",
44+
"tcp"
45+
]
46+
4147
def stepsForParallel = [:]
4248

4349
// Jenkins pipeline does not support map.each, we need to use oldschool for loop
4450
for (int i = 0; i < target_families.size(); i++) {
4551
for(int j = 0; j < toolchains.size(); j++) {
4652
for(int k = 0; k < targets.size(); k++) {
47-
def target_family = target_families.keySet().asList().get(i)
48-
def allowed_target_type = target_families.get(target_family)
49-
def target = targets.get(k)
50-
def toolchain = toolchains.keySet().asList().get(j)
51-
def compilerLabel = toolchains.get(toolchain)
52-
53-
def stepName = "${target} ${toolchain}"
54-
if(allowed_target_type.contains(target)) {
55-
stepsForParallel[stepName] = buildStep(target_family, target, compilerLabel, toolchain)
53+
for(int l = 0; l < sockets.size(); l++) {
54+
def target_family = target_families.keySet().asList().get(i)
55+
def allowed_target_type = target_families.get(target_family)
56+
def target = targets.get(k)
57+
def toolchain = toolchains.keySet().asList().get(j)
58+
def compilerLabel = toolchains.get(toolchain)
59+
def stepName = "${target} ${toolchain}"
60+
def socket = sockets.get(l)
61+
62+
if(allowed_target_type.contains(target)) {
63+
stepsForParallel[stepName] = buildStep(target_family, target, compilerLabel, toolchain, socket)
64+
}
5665
}
5766
}
5867
}
@@ -65,11 +74,15 @@ def parallelRunSmoke = [:]
6574
if ( params.smoke_test == true ) {
6675
// Generate smoke tests based on suite amount
6776
for(int i = 0; i < raas.size(); i++) {
68-
def suite_to_run = raas.keySet().asList().get(i)
69-
def raasPort = raas.get(suite_to_run)
70-
// Parallel execution needs unique step names. Remove .json file ending.
71-
def smokeStep = "${raasPort} ${suite_to_run.substring(0, suite_to_run.indexOf('.'))}"
72-
parallelRunSmoke[smokeStep] = run_smoke(target_families, raasPort, suite_to_run, toolchains, targets)
77+
for(int j = 0; j < sockets.size(); j++) {
78+
def suite_to_run = raas.keySet().asList().get(i)
79+
def raasPort = raas.get(suite_to_run)
80+
def socket = sockets.get(j)
81+
82+
// Parallel execution needs unique step names. Remove .json file ending.
83+
def smokeStep = "${raasPort} ${suite_to_run.substring(0, suite_to_run.indexOf('.'))}"
84+
parallelRunSmoke[smokeStep] = run_smoke(target_families, raasPort, suite_to_run, toolchains, targets, socket)
85+
}
7386
}
7487
}
7588

@@ -78,7 +91,7 @@ timestamps {
7891
parallel parallelRunSmoke
7992
}
8093

81-
def buildStep(target_family, target, compilerLabel, toolchain) {
94+
def buildStep(target_family, target, compilerLabel, toolchain, socket) {
8295
return {
8396
stage ("${target_family}_${target}_${compilerLabel}") {
8497
node ("${compilerLabel}") {
@@ -88,7 +101,12 @@ def buildStep(target_family, target, compilerLabel, toolchain) {
88101
def config_file = "mbed_app.json"
89102

90103
// Activate traces
91-
execute("sed -i 's/\"mbed-trace.enable\": false/\"mbed-trace.enable\": true/' ${config_file}")
104+
//execute("sed -i 's/\"mbed-trace.enable\": false/\"mbed-trace.enable\": true/' ${config_file}")
105+
106+
//change socket typembed_app.json
107+
108+
109+
execute("sed -i 's/\"sock-type\": .*/\"sock-type\": \"${socket}\",/' ${config_file}")
92110

93111
// Set mbed-os to revision received as parameter
94112
execute ("mbed deploy --protocol ssh")
@@ -98,15 +116,15 @@ def buildStep(target_family, target, compilerLabel, toolchain) {
98116

99117
execute ("mbed compile --build out/${target}_${toolchain}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
100118
}
101-
stash name: "${target}_${toolchain}", includes: '**/mbed-os-example-cellular.bin'
119+
stash name: "${target}_${toolchain}_${socket}", includes: '**/mbed-os-example-cellular.bin'
102120
archive '**/mbed-os-example-cellular.bin'
103121
step([$class: 'WsCleanup'])
104122
}
105123
}
106124
}
107125
}
108126

109-
def run_smoke(target_families, raasPort, suite_to_run, toolchains, targets) {
127+
def run_smoke(target_families, raasPort, suite_to_run, toolchains, targets, socket) {
110128
return {
111129
env.RAAS_USERNAME = "user"
112130
env.RAAS_PASSWORD = "user"
@@ -131,15 +149,15 @@ def run_smoke(target_families, raasPort, suite_to_run, toolchains, targets) {
131149
for (int i = 0; i < target_families.size(); i++) {
132150
for(int j = 0; j < toolchains.size(); j++) {
133151
for(int k = 0; k < targets.size(); k++) {
134-
def target_family = target_families.keySet().asList().get(i)
135-
def allowed_target_type = target_families.get(target_family)
136-
def target = targets.get(k)
137-
def toolchain = toolchains.keySet().asList().get(j)
138-
139-
if(allowed_target_type.contains(target)) {
140-
unstash "${target}_${toolchain}"
141-
}
142-
}
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+
}
143161
}
144162
}
145163
if ("${suiteName}" == "cellular_smoke_mts_dragonfly") {

0 commit comments

Comments
 (0)