Skip to content

Commit

Permalink
Set up jdk for jck interactive (adoptium#4239)
Browse files Browse the repository at this point in the history
* Set up jdk for jck interactive

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Add parameter SETUP_JCK_RUN explicitely

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

---------

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>
  • Loading branch information
sophia-guo committed Mar 10, 2023
1 parent c8c73bb commit 2366fe3
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
55 changes: 52 additions & 3 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,8 @@ def setup() {
CODE_COVERAGE_OPTION = params.CODE_COVERAGE ? "--code_coverage true" : ""

CURL_OPTS = (params.CURL_OPTS) ? "--curl_opts \"${params.CURL_OPTS}\"" : ""


GET_SH_CMD = "./get.sh -s `pwd`/.. -p $PLATFORM -r ${SDK_RESOURCE} ${JDK_VERSION_OPTION} ${JDK_IMPL_OPTION} ${CUSTOMIZED_SDK_URL_OPTION} ${CLONE_OPENJ9_OPTION} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${TKG_REPO_OPTION} ${TKG_BRANCH_OPTION} ${VENDOR_TEST_REPOS} ${VENDOR_TEST_BRANCHES} ${VENDOR_TEST_DIRS} ${VENDOR_TEST_SHAS} ${TEST_IMAGES_REQUIRED} ${DEBUG_IMAGES_REQUIRED} ${CODE_COVERAGE_OPTION} ${CURL_OPTS}"
RESOLVED_MAKE = "if [ `uname` = AIX ] || [ `uname` = SunOS ] || [ `uname` = *BSD ]; then MAKE=gmake; else MAKE=make; fi"

dir( WORKSPACE) {
// use sshagent with Jenkins credentials ID for all platforms except zOS
// on zOS use the user's ssh key
Expand All @@ -440,6 +437,55 @@ def setup() {
}
}

def setup_jck_interactives() {
def targetDir = "${env.WORKSPACE}/../../jck_run/jdk${JDK_VERSION}/jdk"
if (PLATFORM.contains("windows")) {
targetDir = "c:/Users/jenkins/jck_run/jdk${JDK_VERSION}/jdk"
}
def tarBall = CUSTOMIZED_SDK_URL.tokenize('/').last()
echo "tarBall is ${tarBall}"
def jckRunDirExists = sh(script: """
if [ -d "${targetDir}" ]; then
echo true
else
echo false
fi
""", returnStdout: true).toBoolean()

if (jckRunDirExists) {
def jdkDir = ""
if (PLATFORM.contains("windows")) {
jdkDir = sh(script: "unzip -l `pwd`/openjdkbinary/${tarBall} | head -n 4 | tail -n 1 | xargs -n 1 echo | tail -n 1", returnStdout: true).trim().replaceFirst(".\$","")
if (PLATFORM.contains("x86-32_windows")) {
jdkDir = "${jdkDir}_32"
} else if (PLATFORM.contains("x86-64_windows")) {
jdkDir = "${jdkDir}_64"
}
} else {
jdkDir = sh(script: "tar -tf `pwd`/openjdkbinary/${tarBall} | head -1", returnStdout: true).trim().replaceFirst(".\$","")
}
def jckRunDir = "${targetDir}/${jdkDir}"
def jckRunJDKExists = sh(script: """
if [ -d "${jckRunDir}" ]; then
echo true
else
echo false
fi
""", returnStdout: true).toBoolean()

if (!jckRunJDKExists) {
sh returnStatus: true, script: """
cd ${targetDir}
mkdir ${jdkDir}
cd ${jdkDir}
cp -r ${TEST_JDK_HOME}/* .
chgrp -R jck ${targetDir}/${jdkDir}
chmod -R 775 ${targetDir}/${jdkDir}
"""
}
}
}

def getJobProperties() {
def jobProperties = "./aqa-tests/job.properties"
if (fileExists("${jobProperties}")) {
Expand Down Expand Up @@ -469,6 +515,9 @@ def get_sources() {
sh "$GET_SH_CMD"
}
}
if (env.BUILD_LIST.contains('jck') && SDK_RESOURCE.contains('customized' && params.SETUP_JCK_RUN )) {
setup_jck_interactives()
}
}
def makeCompileTest(){
String makeTestCmd = "bash ./compile.sh ${USE_TESTENV_PROPERTIES}"
Expand Down
5 changes: 4 additions & 1 deletion buildenv/jenkins/aqaTestPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def LABEL = (params.LABEL) ?: ""
def LABEL_ADDITION = (params.LABEL_ADDITION) ?: ""
def TEST_FLAG = (params.TEST_FLAG) ?: ""
def APPLICATION_OPTIONS = (params.APPLICATION_OPTIONS) ?: ""
def SETUP_JCK_RUN = params.SETUP_JCK_RUN ?: false


// Use BUILD_USER_ID if set and jdk-JDK_VERSIONS
def DEFAULT_SUFFIX = (env.BUILD_USER_ID) ? "${env.BUILD_USER_ID} - jdk-${params.JDK_VERSIONS}" : "jdk-${params.JDK_VERSIONS}"
Expand Down Expand Up @@ -116,7 +118,8 @@ JDK_VERSIONS.each { JDK_VERSION ->
string(name: 'LABEL_ADDITION', value: LABEL_ADDITION),
string(name: 'TEST_FLAG', value: TEST_FLAG),
string(name: 'APPLICATION_OPTIONS', value: APPLICATION_OPTIONS),
booleanParam(name: 'KEEP_REPORTDIR', value: keep_reportdir)
booleanParam(name: 'KEEP_REPORTDIR', value: keep_reportdir),
booleanParam(name: 'SETUP_JCK_RUN', value: SETUP_JCK_RUN)
], wait: true
def result = downstreamJob.getResult()
echo " ${TEST_JOB_NAME} result is ${result}"
Expand Down
2 changes: 2 additions & 0 deletions buildenv/jenkins/testJobTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def OPENJ9_REPO = "https://github.com/eclipse-openj9/openj9.git"
def ADOPTOPENJDK_REPO = "https://github.com/adoptium/aqa-tests.git"
def ADOPTOPENJDK_BRANCH = "master"
def USE_TESTENV_PROPERTIES = false
def SETUP_JCK_RUN = false

// Jenkins does not support using Repository URL and Branch build parameters with lightweight checkout together
// (See https://issues.jenkins.io/browse/JENKINS-48431)
Expand Down Expand Up @@ -438,6 +439,7 @@ ARCH_OS_LIST.each { ARCH_OS ->
booleanParam('PERSONAL_BUILD', false, "Is this a personal build?")
booleanParam('USE_TESTENV_PROPERTIES', USE_TESTENV_PROPERTIES.toBoolean(), "use properties defined in the testenv.properties")
stringParam('RERUN_ITERATIONS', RERUN_ITERATIONS, "Optional. Number of times to repeat execution of failed test target(s).")
booleanParam('SETUP_JCK_RUN', SETUP_JCK_RUN.toBoolean(), "setup jdk during release for jck interactive run")
}
cpsScm {
scm {
Expand Down

0 comments on commit 2366fe3

Please sign in to comment.