From 682037a8d7207ea2ad0855a1a6297140f6dd02eb Mon Sep 17 00:00:00 2001 From: Babneet Singh Date: Mon, 13 Jun 2022 13:21:29 -0400 Subject: [PATCH] PR Builds: New Features 1. Ubuntu 16 (Ub16) is out of service. Thus, Ub16 x86_64 Dockerfile has been removed. 2. We can write a script to generate Dockerfiles to support different operating systems (OSs) and architectures. For the time being, only a Dockerfile for Ubuntu 20 x86_64 has been added. This Dockerfile can be used to derive a script to generate Dockerfiles for other OSs and architectures since it has all the fundamental components. 3. OMR_RUNNING_IN_DOCKER=1 environment variable is set when the PR builds are run inside Docker. This will be used in tests to verify the behaviour port library sysinfo functions. 4. PortStrTest.str_test4 is temporarily disabled since it fails in a container. Issue tracker: #6566. 5. Changes to the default behaviour: a) linux_x86 PR builds will be run on cgroup.v1 nodes. b) linux_x86-64 PR builds will be run on cgroup.v2 nodes inside a container. 6. PR build changes: a) Existing PR build syntax should have no impact. b) All new features are additive. c) New features allow PR builds to be configurable. 7. New command example: jenkins build xlinux(OPTION1,OPTION2,...) 8. The following options are added: a) cgroupv1 -> add label to run the build on a cgroup.v1 node. E.g. jenkins build xlinux(cgroupv1) b) !cgroupv1 -> remove label to run the build on a cgroup.v1 node. E.g. jenkins build xlinux(!cgroupv1) c) cgroupv2 -> add label to run the build on a cgroup.v2 node. E.g. jenkins build xlinux(cgroupv2) d) !cgroupv2 -> remove label to run the build on a cgroup.v2 node. E.g. jenkins build xlinux(!cgroupv2) e) docker -> run the build inside a Docker container. E.g. jenkins build xlinux(cgroupv2,docker) f) !docker -> do not run the build inside a Docker container. E.g. jenkins build xlinux(cgroupv1,!docker) g) configure:'ARGS' -> ARGS will be appended during the configure phase. E.g. jenkins build xlinux(configure:'-DCMAKE_C_FLAGS=-DDUMP_DBG') h) compile:'ARGS' -> ARGS will be appended during the compile phase. E.g. jenkins build xlinux(compile:'-d') i) test:'ARGS' -> ARGS will be appended while running the tests. E.g. jenkins build xlinux(test:'-R porttest') j) env:'VAR1=VAL1,VAR2=VAL2' -> environment variables will be added. E.g. jenkins build xlinux(env:'GTEST_FILTER=PortDumpTest.*') 9. Example: jenkins build xlinux(),all In this example, the xlinux PR build will use OPTIONS_A whereas all other PR builds will use their default settings/options. 10. Example: jenkins build xlinux(),all() In this example, the xlinux PR build will use OPTIONS_A whereas all other PR builds will use OPTIONS_B. 11. Example: jenkins build xlinux(),all,linux_x86-64 In this example, xlinux is an alias for linux_x86-64. Two different sets of options are provided for the same PR build specfication. The set of options of provided at the end will be enforced. In this example, OPTIONS_B will be used whereas OPTIONS_A will be ignored. The same analogy is also used if N-sets of options are specified for the a PR build specification. 12. Related: - #1281 - #6468 - #6477 - #6501 Signed-off-by: Babneet Singh --- buildenv/docker/x86_64/ubuntu16/Dockerfile | 61 --- buildenv/docker/x86_64/ubuntu20/Dockerfile | 68 ++++ buildenv/jenkins/omrbuild.groovy | 451 +++++++++++++++------ fvtest/porttest/CMakeLists.txt | 12 +- 4 files changed, 416 insertions(+), 176 deletions(-) delete mode 100644 buildenv/docker/x86_64/ubuntu16/Dockerfile create mode 100644 buildenv/docker/x86_64/ubuntu20/Dockerfile diff --git a/buildenv/docker/x86_64/ubuntu16/Dockerfile b/buildenv/docker/x86_64/ubuntu16/Dockerfile deleted file mode 100644 index 193aaaac35b..00000000000 --- a/buildenv/docker/x86_64/ubuntu16/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2018, 2018 IBM Corp. and others -# -# This program and the accompanying materials are made available under -# the terms of the Eclipse Public License 2.0 which accompanies this -# distribution and is available at https://www.eclipse.org/legal/epl-2.0/ -# or the Apache License, Version 2.0 which accompanies this distribution and -# is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# This Source Code may also be made available under the following -# Secondary Licenses when the conditions for such availability set -# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU -# General Public License, version 2 with the GNU Classpath -# Exception [1] and GNU General Public License, version 2 with the -# OpenJDK Assembly Exception [2]. -# -# [1] https://www.gnu.org/software/classpath/license.html -# [2] http://openjdk.java.net/legal/assembly-exception.html -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception -# -# -# Create OMR build environment with Ubuntu 16.04 -# Basic usage (adapt to your environment and scenario): -# git clone https://github.com/eclipse/omr (or cd to a directory that contains an OMR repository) -# cd omr/buildenv/docker && docker build -f x86_64/ubuntu16/Dockerfile -t buildomr . -# cd ../../../ -# docker run --privileged -v $PWD/omr:/omr -it buildomr -# -# The container will automatically run cmake to configure itself and then initiate the build. -# Once the build completes, you'll be left sitting at a prompt in the container so you can -# run more commands. - -FROM ubuntu:16.04 - -# build requirements are everything before "gdb"....others are useful for working test failures -RUN apt-get update -y \ - && apt-get install -y \ - python3 \ - git \ - cmake \ - bison \ - flex \ - libelf-dev \ - libdwarf-dev \ - gcc-4.8 \ - g++-4.8-multilib \ - gdb \ - vim emacs \ - && ln -s /usr/bin/g++-4.8 /usr/bin/g++ - -ARG OMRDIR -ENV OMRDIR ${OMRDIR:-/omr} - -COPY doBuild.sh /doBuild.sh -RUN chmod +x /doBuild.sh - -# Uncomment this line to copy your host omr repository into the docker container -# (can help build go faster but changes NOT persisted to host file system) -#COPY omr $OMRDIR - -CMD ["/bin/bash", "--init-file", "/doBuild.sh"] diff --git a/buildenv/docker/x86_64/ubuntu20/Dockerfile b/buildenv/docker/x86_64/ubuntu20/Dockerfile new file mode 100644 index 00000000000..554c8b656ce --- /dev/null +++ b/buildenv/docker/x86_64/ubuntu20/Dockerfile @@ -0,0 +1,68 @@ +# Copyright (c) 2022, 2022 IBM Corp. and others +# +# This program and the accompanying materials are made available under +# the terms of the Eclipse Public License 2.0 which accompanies this +# distribution and is available at https://www.eclipse.org/legal/epl-2.0/ +# or the Apache License, Version 2.0 which accompanies this distribution and +# is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# This Source Code may also be made available under the following +# Secondary Licenses when the conditions for such availability set +# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU +# General Public License, version 2 with the GNU Classpath +# Exception [1] and GNU General Public License, version 2 with the +# OpenJDK Assembly Exception [2]. +# +# [1] https://www.gnu.org/software/classpath/license.html +# [2] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception + +# Create the OMR build environment with Ubuntu 20.04. + +FROM nvidia/cuda:9.0-devel-ubuntu16.04 AS cuda-dev + +FROM ubuntu:20.04 AS base + +# Workaround for a hang during docker build. +ENV TZ=America/Toronto +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update -y + +RUN apt-get install -y \ + tzdata \ + python3 \ + git \ + cmake \ + bison \ + flex \ + libelf-dev \ + libdwarf-dev \ + gdb \ + vim \ + gcc-7-multilib \ + g++-7-multilib \ + gcc-7 \ + g++-7 \ + ninja-build \ + ccache + +RUN apt-get clean +RUN apt-get autoremove +RUN rm -rf /var/lib/apt/lists/* + +# Add user home and copy authorized_keys and known_hosts. +RUN groupadd -r jenkins \ +&& useradd -rm -u 1000 -g jenkins jenkins \ +&& mkdir -p /home/jenkins/.ssh \ +&& echo "Host git.eclipse.org*\n\tStrictHostKeyChecking no\n" > /home/jenkins/.ssh/config \ +&& chown -R jenkins:jenkins /home/jenkins + +# Copy header files necessary to build with CUDA support. +RUN mkdir -p /usr/local/cuda/nvvm +COPY --from=cuda-dev /usr/local/cuda-9.0/include /usr/local/cuda/include +COPY --from=cuda-dev /usr/local/cuda-9.0/nvvm/include /usr/local/cuda/nvvm/include +ENV CUDA_HOME=/usr/local/cuda + +ENV CC=gcc-7 CXX=g++-7 diff --git a/buildenv/jenkins/omrbuild.groovy b/buildenv/jenkins/omrbuild.groovy index 0be15139c4d..2b5ade98785 100644 --- a/buildenv/jenkins/omrbuild.groovy +++ b/buildenv/jenkins/omrbuild.groovy @@ -20,26 +20,38 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ -def setBuildStatus(String message, String state, String sha) { - context = "continuous-integration/eclipse-omr/branch/${params.BUILDSPEC}" - step([ - $class: "GitHubCommitStatusSetter", - contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context], - errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], - commitShaSource: [$class: "ManuallyEnteredShaSource", sha: sha ], - statusBackrefSource: [$class: "ManuallyEnteredBackrefSource", backref: "${BUILD_URL}flowGraphTable/"], - statusResultSource: [$class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] - ]); -} +defaultCompile = 'make -j4' +defaultReference = '${HOME}/gitcache' +autoconfBuildDir = '.' +cmakeBuildDir = 'build' +workspaceName = 'Build' +scmVars = null + +dockerImage = null +dockerImageName = (params.IMAGE_NAME) ? params.IMAGE_NAME : "buildomr" + +os = (params.OS) ? params.OS : "ubuntu20" +arch = (params.ARCH) ? params.ARCH : "x86_64" -def defaultCompile = 'make -j4' -def defaultReference = '${HOME}/gitcache' -def autoconfBuildDir = '.' -def cmakeBuildDir = 'build' -def workspaceName = 'Build' +buildSpec = (params.BUILDSPEC) ? params.BUILDSPEC : null +cmdLine = (params.ghprbCommentBody) ? params.ghprbCommentBody : null +pullId = (params.ghprbPullId) ? params.ghprbPullId : null -def SPECS = [ +cgroupV1Specs = ["linux_x86"] +cgroupV2Specs = ["linux_x86-64"] +dockerSpecs = ["linux_x86-64"] + +nodeLabels = [] +runInDocker = false + +configureAppend = "" +compileAppend = "" +testAppend = "" +envAppend = [] + +SPECS = [ 'aix_ppc-64' : [ + 'alias': 'aix', 'label' : 'compile:aix', 'reference' : defaultReference, 'environment' : [ @@ -62,6 +74,7 @@ def SPECS = [ 'junitPublish' : true ], 'linux_390-64' : [ + 'alias': 'zlinux', 'label': 'compile:zlinux', 'reference' : defaultReference, 'environment' : [ @@ -82,6 +95,7 @@ def SPECS = [ 'junitPublish' : true ], 'linux_aarch64' : [ + 'alias': 'aarch64', 'label' : 'compile:aarch64:cross', 'reference' : defaultReference, 'environment' : [ @@ -101,6 +115,7 @@ def SPECS = [ 'test' : false ], 'linux_arm' : [ + 'alias': 'arm', 'label' : 'compile:arm:cross', 'reference' : defaultReference, 'environment' : [ @@ -120,6 +135,7 @@ def SPECS = [ 'test' : false ], 'linux_ppc-64_le_gcc' : [ + 'alias': 'plinux', 'label' : 'compile:plinux', 'reference' : defaultReference, 'environment' : [ @@ -140,6 +156,7 @@ def SPECS = [ 'junitPublish' : true ], 'linux_riscv64' : [ + 'alias': 'riscv', 'label' : 'compile:riscv64', 'reference' : defaultReference, 'environment' : [ @@ -159,6 +176,7 @@ def SPECS = [ 'junitPublish' : true ], 'linux_riscv64_cross' : [ + 'alias': 'riscv', 'label' : 'compile:riscv64:cross', 'reference' : defaultReference, 'environment' : [ @@ -178,7 +196,8 @@ def SPECS = [ 'junitPublish' : true ], 'linux_x86' : [ - 'label' : 'compile:xlinux && cgroup.v1', + 'alias': 'x32linux', + 'label' : 'compile:xlinux', 'reference' : defaultReference, 'environment' : [ 'PATH+CCACHE=/usr/lib/ccache/', @@ -198,7 +217,8 @@ def SPECS = [ 'junitPublish' : true ], 'linux_x86-64' : [ - 'label' : 'compile:xlinux && cgroup.v2', + 'alias': 'xlinux', + 'label' : 'compile:xlinux', 'reference' : defaultReference, 'environment' : [ 'PATH+CCACHE=/usr/lib/ccache/', @@ -218,6 +238,7 @@ def SPECS = [ 'junitPublish' : true ], 'linux_x86-64_cmprssptrs' : [ + 'alias': 'xcrlinux', 'label' : 'compile:xlinux', 'reference' : defaultReference, 'environment' : [ @@ -238,6 +259,7 @@ def SPECS = [ 'junitPublish' : true ], 'osx_x86-64' : [ + 'alias': 'osx', 'label' : 'compile:xosx', 'reference' : defaultReference, 'environment' : [ @@ -259,6 +281,7 @@ def SPECS = [ 'junitPublish' : true ], 'win_x86-64' : [ + 'alias': 'win', 'label' : 'compile:xwindows', 'reference' : defaultReference, 'environment' : [ @@ -279,6 +302,7 @@ def SPECS = [ 'junitPublish' : true ], 'zos_390-64' : [ + 'alias': 'zos', 'label' : 'compile:zos', 'reference' : '', 'environment' : [ @@ -301,103 +325,304 @@ def SPECS = [ ] ] +def setBuildStatus(String message, String state, String sha) { + context = "continuous-integration/eclipse-omr/branch/" + buildSpec + step([ + $class: "GitHubCommitStatusSetter", + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], + commitShaSource: [$class: "ManuallyEnteredShaSource", sha: sha ], + statusBackrefSource: [$class: "ManuallyEnteredBackrefSource", backref: "${BUILD_URL}flowGraphTable/"], + statusResultSource: [$class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] + ]); +} + +def getSources() { + stage('Get Sources') { + def gitConfig = scm.getUserRemoteConfigs().get(0) + def refspec = (gitConfig.getRefspec()) ? gitConfig.getRefspec() : '' + scmVars = checkout poll: false, + scm: [$class: 'GitSCM', + branches: [[name: "${scm.branches[0].name}"]], + extensions: [[$class: 'CloneOption', honorRefspec: true, timeout: 30, reference: SPECS[buildSpec].reference]], + userRemoteConfigs: [[name: 'origin', + refspec: "${refspec}", + url: "${gitConfig.getUrl()}"] + ] + ] + if (!pullId) { + setBuildStatus("In Progress","PENDING","${scmVars.GIT_COMMIT}") + } + } +} + +def build() { + stage('Build') { + if (SPECS[buildSpec].ccache) { + echo 'Output CCACHE stats before running and clear them' + sh 'ccache -s -z' + } + + for (build in SPECS[buildSpec].builds) { + dir("${build.buildDir}") { + echo 'Configure...' + switch (SPECS[buildSpec].buildSystem) { + case 'cmake': + sh "cmake ${build.configureArgs} ${configureAppend} .." + break + case 'autoconf': + sh "make -f run_configure.mk OMRGLUE=./example/glue ${build.configureArgs} ${configureAppend}" + break + default: + error("Unknown buildSystem type") + } + + echo 'Compile...' + sh "${build.compile} ${compileAppend}" + } + } + + if (SPECS[buildSpec].ccache) { + echo 'Output CCACHE stats after running' + sh 'ccache -s' + } + } +} + +def test() { + stage('Test') { + if (SPECS[buildSpec].test) { + echo 'Sanity Test...' + switch (SPECS[buildSpec].buildSystem) { + case 'cmake': + dir("${cmakeBuildDir}") { + sh "ctest -V ${SPECS[buildSpec].testArgs} ${testAppend}" + if (SPECS[buildSpec].junitPublish) { + junit '**/*results.xml' + } + } + break + case 'autoconf': + sh "make test ${SPECS[buildSpec].testArgs} ${testAppend}" + break + default: + error("Unknown buildSystem type") + } + } else { + echo "Currently no sanity tests..." + } + } +} + +def cleanDockerContainers() { + println("Listing docker containers to attempt removal") + sh "docker ps -a" + def containers = sh (script: "docker ps -a --format \"{{.ID}}\"", returnStdout: true).trim() + if (containers) { + println("Stop all docker containers") + sh "docker ps -a --format \"{{.ID}}\" | xargs docker stop" + println("Remove all docker containers") + sh "docker ps -a --format \"{{.ID}}\" | xargs docker rm --force" + } +} + +def buildDockerImage() { + stage("Docker Build") { + getSources() + dir("buildenv/docker/${arch}/${os}") { + dockerImage = docker.build(dockerImageName) + } + } +} + +def runAllStages() { + /* Use a custom workspace name. + * This is becasue the LIBPATH on z/os includes the build's workspace. + * Since we cannot add a variable to the 'environment' in the SPECS, as + * it will get evaluated early, we'll use a custom ws in order to + * hardcode the value in the SPECS. + */ + def customWorkspace = WORKSPACE - "/${JOB_NAME}" + "/${workspaceName}" + ws(customWorkspace) { + try { + timeout(time: 2, unit: 'HOURS') { + def tmpDesc = (currentBuild.description) ? currentBuild.description + "
" : "" + currentBuild.description = tmpDesc + "${NODE_NAME}" + + def environmentVars = SPECS[buildSpec].environment + + if (runInDocker) { + environmentVars += "OMR_RUNNING_IN_DOCKER=1" + } + + if (!envAppend.isEmpty()) { + environmentVars.addAll(envAppend) + } + + println "env vars: " + environmentVars + + withEnv(environmentVars) { + sh 'printenv' + getSources() + build(); + test(); + } + } + } finally { + if (!pullId && scmVars) { + setBuildStatus("Complete", currentBuild.currentResult, "${scmVars.GIT_COMMIT}") + } + cleanWs() + } + } +} + +def runAllStagesInDocker() { + def customWorkspace = WORKSPACE - "/${JOB_NAME}" + "/${workspaceName}_docker" + ws(customWorkspace) { + try { + cleanDockerContainers() + buildDockerImage() + dockerImage.inside("-v /home/jenkins:/home/jenkins:rw,z") { + runAllStages() + } + } finally { + cleanWs() + } + } +} + +def parseCmdLine() { + def selectedMatcher = null + + def specMatcher = (cmdLine =~ /.*jenkins build.*${buildSpec}?(?\(.*\))?.*/) + + def alias = SPECS[buildSpec].alias + def aliasMatcher = (cmdLine =~ /.*jenkins build.*${alias}?(?\(.*\))?.*/) + + def allMatcher = (cmdLine =~ /.*jenkins build.*all?(?\(.*\))?.*/) + + def specIndex = -1 + if (specMatcher.find()) { + specIndex = specMatcher.start("match") + } + + def aliasIndex = -1 + if (aliasMatcher.find()) { + aliasIndex = aliasMatcher.start("match") + } + + def allIndex = -1 + if (allMatcher.find()) { + allIndex = allMatcher.start("match") + } + + if ((specIndex != -1) || (aliasIndex != -1)) { + if (specIndex > aliasIndex) { + selectedMatcher = specMatcher + } else { + selectedMatcher = aliasMatcher + } + } else if (allIndex != -1) { + selectedMatcher = allMatcher + } + + println "custom option matcher: " + selectedMatcher + + if (selectedMatcher != null) { + def customConfig = selectedMatcher.group("match") + println "custom options: " + customConfig + + if (customConfig != null) { + def configureMatcher = (customConfig =~ /configure:'(?.*?)'/) + if (configureMatcher.find()) { + configureAppend += configureMatcher.group("match") + customConfig -= ~/configure:'(?.*?)'/ + } + println "configure append: " + configureAppend + + def compileMatcher = (customConfig =~ /compile:'(?.*?)'/) + if (compileMatcher.find()) { + compileAppend += compileMatcher.group("match") + customConfig -= ~/compile:'(?.*?)'/ + } + println "compile append: " + compileAppend + + def testMatcher = (customConfig =~ /test:'(?.*?)'/) + if (testMatcher.find()) { + testAppend += testMatcher.group("match") + customConfig -= ~/test:'(?.*?)'/ + } + println "test append: " + testAppend + + def envMatcher = (customConfig =~ /env:'(?.*?)'/) + if (envMatcher.find()) { + envAppend.addAll(envMatcher.group("match").split(",").removeAll(it.isEmpty())) + customConfig -= ~/env:'(?.*?)'/ + } + println "env append: " + envAppend + println "remaining custom options: " + customConfig + + def options = customConfig.replace("(", "").replace(")", "").split(",") + for (option in options) { + if (option == "cgroupv1") { + nodeLabels += "cgroup.v1" + nodeLabels -= "cgroup.v2" + } + + if (option == "cgroupv2") { + nodeLabels += "cgroup.v2" + nodeLabels -= "cgroup.v1" + } + + if (option == "!cgroupv1") { + nodeLabels -= "cgroup.v1" + } + + if (option == "!cgroupv2") { + nodeLabels -= "cgroup.v2" + } + + if (option == "docker") { + runInDocker = true + } + + if (option == "!docker") { + runInDocker = false + } + } + } + } +} + timestamps { timeout(time: 8, unit: 'HOURS') { stage('Queue') { - node(SPECS[params.BUILDSPEC].label) { - /* - * Use a custom workspace name. - * This is becasue the LIBPATH on z/os includes the build's workspace. - * Since we cannot add a variable to the 'environment' in the SPECS, as - * it will get evaluated early, we'll use a custom ws in order to - * hardcode the value in the SPECS. - */ - def customWorkspace = WORKSPACE - "/${JOB_NAME}" + "/${workspaceName}" - scmVars = null - ws(customWorkspace) { - try { - timeout(time: 2, unit: 'HOURS') { - def tmpDesc = (currentBuild.description) ? currentBuild.description + "
" : "" - currentBuild.description = tmpDesc + "${NODE_NAME}" - - withEnv(SPECS[params.BUILDSPEC].environment) { - sh 'printenv' - stage('Get Sources') { - def gitConfig = scm.getUserRemoteConfigs().get(0) - def refspec = (gitConfig.getRefspec()) ? gitConfig.getRefspec() : '' - scmVars = checkout poll: false, - scm: [$class: 'GitSCM', - branches: [[name: "${scm.branches[0].name}"]], - extensions: [[$class: 'CloneOption', honorRefspec: true, timeout: 30, reference: SPECS[params.BUILDSPEC].reference]], - userRemoteConfigs: [[name: 'origin', - refspec: "${refspec}", - url: "${gitConfig.getUrl()}"] - ] - ] - if (!params.ghprbPullId) { - setBuildStatus("In Progress","PENDING","${scmVars.GIT_COMMIT}") - } - } - stage('Build') { - if (SPECS[params.BUILDSPEC].ccache) { - echo 'Output CCACHE stats before running and clear them' - sh 'ccache -s -z' - } - - for (build in SPECS[params.BUILDSPEC].builds) { - dir("${build.buildDir}") { - echo 'Configure...' - switch (SPECS[params.BUILDSPEC].buildSystem) { - case 'cmake': - sh "cmake ${build.configureArgs} .." - break - case 'autoconf': - sh "make -f run_configure.mk OMRGLUE=./example/glue ${build.configureArgs}" - break - default: - error("Unknown buildSystem type") - } - - echo 'Compile...' - sh "${build.compile}" - } - } - - if (SPECS[params.BUILDSPEC].ccache) { - echo 'Output CCACHE stats after running' - sh 'ccache -s' - } - } - stage('Test') { - if (SPECS[params.BUILDSPEC].test) { - echo 'Sanity Test...' - switch (SPECS[params.BUILDSPEC].buildSystem) { - case 'cmake': - dir("${cmakeBuildDir}") { - sh "ctest -V ${SPECS[params.BUILDSPEC].testArgs}" - if (SPECS[params.BUILDSPEC].junitPublish) { - junit '**/*results.xml' - } - } - break - case 'autoconf': - sh "make test ${SPECS[params.BUILDSPEC].testArgs}" - break - default: - error("Unknown buildSystem type") - } - } else { - echo "Currently no sanity tests..." - } - } - } - } - } finally { - if (!params.ghprbPullId && scmVars) { - setBuildStatus("Complete", currentBuild.currentResult, "${scmVars.GIT_COMMIT}") - } - cleanWs() - } + nodeLabels += SPECS[buildSpec].label + runInDocker = dockerSpecs.contains(buildSpec) + + if (cgroupV1Specs.contains(buildSpec)) { + nodeLabels += "cgroup.v1" + } + + if (cgroupV2Specs.contains(buildSpec)) { + nodeLabels += "cgroup.v2" + } + + parseCmdLine() + + nodeLabels = nodeLabels.unique() + + println nodeLabels + println "run in docker: " + runInDocker + + assert !(nodeLabels.contains("cgroup.v1") && nodeLabels.contains("cgroup.v2")) + + node(nodeLabels.join(" && ")) { + if (runInDocker) { + runAllStagesInDocker() + } else { + runAllStages() } } } diff --git a/fvtest/porttest/CMakeLists.txt b/fvtest/porttest/CMakeLists.txt index 589802fe7f3..b876d15c0fd 100644 --- a/fvtest/porttest/CMakeLists.txt +++ b/fvtest/porttest/CMakeLists.txt @@ -130,7 +130,7 @@ if(OMR_OS_AIX) ) endif() -if (OMR_OS_ZOS AND OMR_ENV_DATA64) +if(OMR_OS_ZOS AND OMR_ENV_DATA64) omr_add_library(sltestlib31 SHARED sltestlib31/sltest.cpp ) @@ -205,7 +205,15 @@ elseif(OMR_OS_LINUX AND OMR_ENV_DATA32) set(EXCLUDE_LIST "${EXCLUDE_LIST}-PortVmemTest.vmem_test_reserveExecutableMemory") endif() -if (EXCLUDE_LIST) +if($ENV{OMR_RUNNING_IN_DOCKER}) + if(EXCLUDE_LIST) + set(EXCLUDE_LIST "${EXCLUDE_LIST}:PortStrTest.str_test4") + else() + set(EXCLUDE_LIST "${EXCLUDE_LIST}-PortStrTest.str_test4") + endif() +endif() + +if(EXCLUDE_LIST) set(EXCLUDE_LIST "--gtest_filter=${EXCLUDE_LIST}") message(WARNING "Excluded omrport tests: ${EXCLUDE_LIST}") endif()