jjb: integration: rework lttng-tools 32-64
[lttng-ci.git] / pipelines / integration / lttng-tools-_version_-32-64_testsuite.groovy.j2
1 #!groovy
2
3 // SPDX-FileCopyrightText: 2022 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 // SPDX-FileCopyrightText: 2024 Michael Jeanson <mjeanson@efficios.com>
5 //
6 // SPDX-License-Identifier: GPL-3.0-or-later
7
8 pipeline {
9 agent none
10
11 /* Global options for the pipeline */
12 options {
13 preserveStashes()
14 buildDiscarder(logRotator(numToKeepStr: '5'))
15 timeout(time: 2, unit: 'HOURS')
16 disableConcurrentBuilds()
17 timestamps()
18 skipDefaultCheckout()
19 }
20
21 triggers {
22 pollSCM('@hourly')
23 }
24
25 parameters {
26 string(name: 'LIBURCU_GIT_URL', defaultValue: 'https://github.com/urcu/userspace-rcu', description: 'The http git repo to be cloned for the liburcu project')
27 string(name: 'LIBURCU_GIT_BRANCH', defaultValue: '{{ urcu_version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
28 string(name: 'LTTNG_MODULES_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-modules', description: 'The http git repo to be cloned for the lttng-modules project')
29 string(name: 'LTTNG_MODULES_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
30 string(name: 'LTTNG_UST_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-ust', description: 'The http git repo to be cloned for the lttng-ust project')
31 string(name: 'LTTNG_UST_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
32 string(name: 'LTTNG_TOOLS_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-tools', description: 'The http git repo to be cloned for the lttng-tools project')
33 string(name: 'LTTNG_TOOLS_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
34 }
35
36 /* Default environment for the pipeline */
37 environment {
38 PREFIX = '/build'
39 CXXFLAGS = '-g -O0'
40 CFLAGS = '-g -O0'
41 JAVA_HOME = '/usr/lib/jvm/default-java'
42 CLASSPATH = '/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar'
43 }
44
45 stages {
46 /*
47 * i386 artifacts cannot be reused because we need to ensure that the
48 * lttng-ust used is the same for the amd64 and i386 and that for now we do
49 * not have this guarantee since we used 2 different jobs.
50 */
51 stage('Checkout all sources') {
52 agent { label 'deb12-amd64' }
53
54 steps {
55 cleanWs()
56
57 dir("src/userspace-rcu") {
58 checkout([$class: 'GitSCM', branches: [[name: "${params.LIBURCU_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LIBURCU_GIT_URL}"]]])
59 }
60
61 dir("src/lttng-modules") {
62 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_MODULES_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_MODULES_GIT_URL}"]]])
63 }
64
65 dir("src/lttng-ust") {
66 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_UST_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_UST_GIT_URL}"]]])
67 }
68
69 dir("src/lttng-tools") {
70 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_TOOLS_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_TOOLS_GIT_URL}"]]])
71 }
72
73 stash name: 'dep-sources', includes: 'src/userspace-rcu/**,src/lttng-ust/**'
74 stash name: 'modules-sources', includes: 'src/lttng-modules/**'
75 stash name: 'tools-sources', includes: 'src/lttng-tools/**,'
76 }
77 }
78
79 stage('Parallel build of i386 and amd64 artifacts') {
80 /* Build the i386 and amd64 artifacts in parallel */
81 parallel {
82 stage('Build amd64 artifacts') {
83 agent { label 'deb12-amd64' }
84
85 environment {
86 BASEDIR_64 = "$WORKSPACE/deps-64"
87 BASEDIR_BUILD_64 = "$BASEDIR_64/build"
88 INCLUDE_DIR_64 = "$BASEDIR_BUILD_64/include"
89
90 CPPFLAGS = "-I$INCLUDE_DIR_64"
91 LDFLAGS = "-L$BASEDIR_BUILD_64/lib"
92 PKG_CONFIG_PATH = "$BASEDIR_BUILD_64/lib/pkgconfig"
93 LD_LIBRARY_PATH = "$BASEDIR_BUILD_64/lib:$LD_LIBRARY_PATH"
94 PATH = "$PATH:$BASEDIR_64/bin"
95 }
96
97 stages {
98 stage('Unstash sources') {
99 steps {
100 cleanWs()
101
102 unstash name: 'dep-sources'
103 }
104 }
105
106 stage('Build amd64 liburcu') {
107 steps {
108 /* Prevent non existent include dir warnings */
109 sh 'mkdir -p $INCLUDE_DIR_64'
110
111 dir("src/userspace-rcu") {
112 sh './bootstrap'
113 sh './configure --prefix="$PREFIX"'
114 sh 'make -j"$(nproc)" V=1'
115 sh 'make install DESTDIR="$WORKSPACE"'
116 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
117 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
118 }
119
120 /* Move the artifacts of the recently built project to the deps
121 * directory and remove the "build" directory to prevent `make install`
122 * shenanigans for lttng-ust 2.12 */
123 sh 'cp -rv build $BASEDIR_64/'
124 sh 'rm -rf build'
125 }
126 }
127
128 stage('Build amd64 lttng-ust') {
129 steps {
130 dir("src/lttng-ust") {
131 sh './bootstrap'
132 sh './configure --prefix="$PREFIX" --enable-java-agent-all --enable-jni-interface --enable-python-agent'
133 sh 'make -j"$(nproc)" V=1'
134 sh 'make install DESTDIR="$WORKSPACE"'
135
136 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
137 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
138 }
139
140 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
141 sh 'cp -rv build $BASEDIR_64/'
142 sh 'rm -rf build'
143 }
144 }
145
146 stage('Stash amd64 artifacts') {
147 steps {
148 stash name: "amd64-deps-lttng-tools", includes: 'deps-64/**'
149 }
150 }
151 } /* stages */
152
153 post {
154 cleanup {
155 cleanWs cleanWhenFailure: false
156 }
157 }
158 } /* stage('Build amd64 artifacts') */
159
160 stage('Build i386 artifacts') {
161 agent { label 'deb12-i386' }
162
163 environment {
164 BASEDIR_32 = "$WORKSPACE/deps-32"
165 BASEDIR_BUILD_32 = "$BASEDIR_32/build"
166 INCLUDE_DIR_32 = "$BASEDIR_BUILD_32/include"
167
168 CPPFLAGS = "-I$INCLUDE_DIR_32"
169 LDFLAGS = "-L$BASEDIR_BUILD_32/lib"
170 PKG_CONFIG_PATH = "$BASEDIR_BUILD_32/lib/pkgconfig"
171 LD_LIBRARY_PATH = "$BASEDIR_BUILD_32/lib"
172 PATH = "$PATH:$BASEDIR_32/bin"
173 }
174
175 stages {
176 stage('Unstash sources and artifacts') {
177 steps {
178 cleanWs()
179
180 /* Fetch the babeltrace artifacts */
181 copyArtifacts projectName: "babeltrace_{{ babelversion }}_portbuild/platform=deb12-i386,conf=std,build=std", selector: lastCompleted(), filter: 'build/**', target: 'deps-32', fingerprintArtifacts: false
182
183 unstash name: 'dep-sources'
184 unstash name: 'tools-sources'
185 }
186 }
187
188 stage('Build i386 liburcu') {
189 steps {
190
191 /* Prevent non existent include dir warnings */
192 sh 'mkdir -p $INCLUDE_DIR_32'
193
194 dir("src/userspace-rcu") {
195 sh './bootstrap'
196 sh './configure --prefix="$PREFIX"'
197 sh 'make -j"$(nproc)" V=1'
198 sh 'make install DESTDIR="$WORKSPACE"'
199
200 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
201 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
202 }
203
204 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
205 sh 'cp -rv build $BASEDIR_32/'
206 sh 'rm -rf build'
207 }
208 }
209
210 stage('Build i386 lttng-ust') {
211 steps {
212 dir("src/lttng-ust") {
213 sh './bootstrap'
214 sh './configure --prefix="$PREFIX"'
215 sh 'make V=1'
216 sh 'make install DESTDIR="$WORKSPACE"'
217 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
218 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
219 }
220
221 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
222 sh 'cp -rv build $BASEDIR_32/'
223 sh 'rm -rf build'
224 }
225 }
226
227 stage('Build i386 lttng-tools') {
228 steps {
229 dir("src/lttng-tools") {
230 sh './bootstrap'
231 sh './configure --prefix="$PREFIX"'
232 sh 'make V=1'
233 sh 'make install DESTDIR="$WORKSPACE"'
234 sh 'find "$WORKSPACE/build/bin" -type f -perm -0500 -exec chrpath --delete {} \\;'
235 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
236 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
237 }
238
239 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
240 sh 'cp -rv build $BASEDIR_32/'
241 sh 'rm -rf build'
242 }
243 }
244
245 stage('Stash i386 artifacts') {
246 steps {
247 stash name: "i386-deps-lttng-tools", includes: 'deps-32/**'
248
249 {% if version != 'stable-2.12' %}
250 /* Save the i386 ld_preloaded libraries for sessiond pausing */
251 stash name: "i386-deps-sessiond-notification-pause-lib", includes: 'src/lttng-tools/tests/regression/tools/notification/.libs/libpause_sessiond.so'
252 {% endif %}
253 }
254 }
255 } /* stages */
256
257 post {
258 cleanup {
259 cleanWs cleanWhenFailure: false
260 }
261 }
262 } /* stage('Build i386 artifacts') */
263 }
264 } /* stage('Parallel build of all artifacts') */
265
266 stage('Testing on rootnodes') {
267 parallel {
268 {% for test_type in ["64bit-canary", "32bit-sessiond", "32bit-relayd", "32bit-cli" ] %}
269 stage('Testing {{ test_type }}') {
270 {% if version == 'stable-2.12' %}
271 agent { label 'deb12-amd64-rootnode-linux5' }
272 {% else %}
273 agent { label 'deb12-amd64-rootnode' }
274 {% endif %}
275
276 environment {
277 BASEDIR_32 = "$WORKSPACE/deps-32"
278 BASEDIR_BUILD_32 = "$BASEDIR_32/build"
279 INCLUDE_DIR_32 = "$BASEDIR_BUILD_32/include"
280
281 BASEDIR_64 = "$WORKSPACE/deps-64"
282 BASEDIR_BUILD_64 = "$BASEDIR_64/build"
283 INCLUDE_DIR_64 = "$BASEDIR_BUILD_64/include"
284
285 CPPFLAGS = "-I$BASEDIR_BUILD_64/include"
286 LDFLAGS = "-L$BASEDIR_BUILD_64/lib"
287 PKG_CONFIG_PATH = "$BASEDIR_BUILD_64/lib/pkgconfig"
288 LD_LIBRARY_PATH = "$BASEDIR_BUILD_64/lib:$BASEDIR_BUILD_32/lib"
289 PATH = "$PATH:$BASEDIR_BUILD_64/bin"
290
291 /*
292 * Disable the TAP autotime feature, it uses stdbuf which doesn't work in a
293 * mixed 32/64 environment.
294 */
295 LTTNG_TESTS_TAP_AUTOTIME = 0
296
297 BABELTRACE_PLUGIN_PATH = "$BASEDIR_BUILD_64/lib/babeltrace2/plugins/"
298 LIBBABELTRACE2_PLUGIN_PROVIDER_DIR = "$BASEDIR_BUILD_64/lib/babeltrace2/plugin-providers/"
299
300 DEPS_JAVA = "$WORKSPACE/deps-64/build/share/java"
301 CLASSPATH = "$DEPS_JAVA/lttng-ust-agent-all.jar:/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar"
302
303 P3_VERSION="""${sh(
304 returnStdout: true,
305 script: 'python3 -c \'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))\''
306 ).trim()}"""
307
308 /*
309 * Most build configs require access to the babeltrace 2 python bindings.
310 * This also makes the lttngust python agent available for `agents` builds.
311 */
312 PYTHONPATH = "$BASEDIR_BUILD_64/lib/python$P3_VERSION/site-packages"
313
314 LTTNG_CONSUMERD32_BIN = "$BASEDIR_BUILD_32/lib/lttng/libexec/lttng-consumerd"
315 LTTNG_CONSUMERD32_LIBDIR = "$BASEDIR_BUILD_32/lib"
316 LTTNG_CONSUMERD64_BIN = "$BASEDIR_BUILD_64/lib/lttng/libexec/lttng-consumerd"
317 LTTNG_CONSUMERD64_LIBDIR = "$BASEDIR_BUILD_64/lib/"
318 }
319
320 stages {
321 stage('Unstash sources and artifacts') {
322 steps {
323 cleanWs()
324
325 /* Fetch the babeltrace artifacts */
326 copyArtifacts projectName: "babeltrace_{{ babelversion }}_linuxbuild/platform=deb12-amd64,conf=std,build=std", selector: lastCompleted(), filter: 'build/**', target: 'deps-64', fingerprintArtifacts: false
327
328 unstash name: 'modules-sources'
329 unstash name: 'tools-sources'
330 unstash name: "i386-deps-lttng-tools"
331 unstash name: "amd64-deps-lttng-tools"
332
333 {% if version != 'stable-2.12' %}
334 dir('testing-overlay/sessiond') {
335 /* Save the i386 LD_PRELOAD libraries for sessiond pausing */
336 unstash name: "i386-deps-sessiond-notification-pause-lib"
337 }
338 {% endif %}
339
340 /* Stable 2.12 and 2.13 still look for "babeltrace" */
341 sh 'ln -s "$BASEDIR_BUILD_64/bin/babeltrace2" "$BASEDIR_BUILD_64/bin/babeltrace"'
342 }
343 }
344
345 stage('Build and install lttng-modules for the current kernel') {
346 steps {
347 dir("src/lttng-modules") {
348 sh 'make -j"$(nproc)" V=1'
349 sh 'make modules_install'
350 sh 'depmod -a'
351 }
352 }
353 }
354
355 stage('Build amd64 lttng-tools') {
356 steps {
357 /* Bootstrap and configure lttng-tools */
358 dir("src/lttng-tools") {
359 sh './bootstrap'
360 sh './configure --prefix="$PREFIX" --enable-test-java-agent-all --enable-test-python3-agent'
361 }
362
363 // Deativate health test, simply because there is little value
364 // for this integration testing and because the ld_preloaded
365 // object is for both lttng-sessiond/consumer leading to
366 // difficult ld_preloading Deactivate clock plugin test since
367 // the app must load the correct bitness so and the sessiond its
368 // bitness so, this is simply not feasible from outside the
369 // script. There is little value for this test in this testing
370 // context.
371 dir("src/lttng-tools/tests/regression") {
372 sh 'sed -i "#tools/health/test_thread_ok#d" Makefile.am'
373 sh 'sed -i "#ust/clock-override/test_clock_override#d" Makefile.am'
374 }
375
376 /* Build lttng-tools */
377 dir("src/lttng-tools") {
378 sh 'make -j"$(nproc)" V=1'
379 }
380 }
381 }
382
383 stage('Run lttng-tools testsuite') {
384 options {
385 timeout(time: 15, unit: 'MINUTES', activity: true)
386 }
387
388 steps {
389 {% if test_type == '64bit-canary' %}
390 /* Nothing to do for 64bit-canary */
391
392 {% elif test_type == '32bit-sessiond' %}
393
394 /* Replace the lttng-sessiond binary with the 32-bit version */
395 dir("src/lttng-tools/src/bin/lttng-sessiond") {
396 sh 'rm -f lttng-sessiond'
397 sh 'ln -s "$BASEDIR_32/bin/lttng-sessiond" lttng-sessiond'
398 }
399
400 {% if version != 'stable-2.12' %}
401 sh 'cp -rv "testing-overlay/sessiond/"* ./'
402 {% endif %}
403
404 {% elif test_type == '32bit-relayd' %}
405
406 /* Replace the lttng-relayd binary with the 32-bit version */
407 dir("src/lttng-tools/src/bin/lttng-relayd") {
408 sh 'rm -f lttng-relayd'
409 sh 'ln -s "$BASEDIR_32/bin/lttng-relayd" lttng-relayd'
410 }
411
412 {% elif test_type == '32bit-cli' %}
413
414 /* Replace the lttng cli binary with the 32-bit version */
415 dir("src/lttng-tools/src/bin/lttng") {
416 sh 'rm lttng'
417 sh 'ln -s "$BASEDIR_32/bin/lttng" lttng'
418 }
419
420 {% else %}
421 {% include 'error: invalid test_type' %}
422 {% endif %}
423
424 /* Run the test suite */
425 dir("src/lttng-tools/tests") {
426 /*
427 * This will mark the job as FAILED if the test suite is not
428 * successful but will continue the execution of the stages.
429 */
430 catchError {
431 sh 'make --keep-going check'
432 }
433 }
434 }
435 } /* stage('Build amd64 artifacts') */
436 } /* stages */
437
438 post {
439 always {
440 dir("src/lttng-tools/tests") {
441 /* Gather the TAP logs */
442 sh '''
443 mkdir -p "$WORKSPACE/tap/{{ test_type }}"
444 rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' ./ "$WORKSPACE/tap/{{ test_type }}"
445 '''
446
447 /* Gather the test suites top-level log which includes all tests failures */
448 sh '''
449 mkdir -p "$WORKSPACE/log/{{ test_type }}"
450 rsync -a --include 'test-suite.log' --include '*/' --exclude='*' ./ "$WORKSPACE/log/{{ test_type }}"
451 '''
452 }
453
454 step([$class: 'TapPublisher', testResults: 'tap/**/*.log', verbose: true, failIfNoResults: true, failedTestsMarkBuildAsFailure: true, planRequired: true])
455 archiveArtifacts artifacts: 'tap/**,log/**', fingerprint: false
456
457 recordIssues skipBlames: true, tools: [gcc(id: "{{ test_type }}")]
458 }
459
460 cleanup {
461 cleanWs cleanWhenFailure: false
462 }
463 }
464 }
465 {% endfor %}
466 } /* parallel */
467 } /* stage('Testing on rootnodes') */
468 }
469 }
This page took 0.041278 seconds and 4 git commands to generate.