Skip to content

Commit

Permalink
Support OPENJCEPLUS_GIT_REPO and OPENJCEPLUS_GIT_BRANCH in testenv.pr…
Browse files Browse the repository at this point in the history
…operties (#5291)

- create testenvSettings.sh for testenv variable settings
- export OPENJCEPLUS_GIT_REPO and OPENJCEPLUS_GIT_BRANCH values in testenvSettings.sh
- update functional/OpenJcePlusTests/build.xml to handle branch/tag/sha values
- add JDKXXX_OPENJCEPLUS_GIT_REPO and JDKXXX_OPENJCEPLUS_GIT_BRANCH in testenv.properties
- when DYNAMIC_COMPILE=true, we will run make test command directly (compile.sh will be skipped)
To fix #4509, testenvSettings.sh needs to run before make test command

resolves: #5290 and #4509

Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
llxia authored and pshipton committed May 9, 2024
1 parent cd7d11f commit 85a2850
Showing 5 changed files with 101 additions and 33 deletions.
5 changes: 3 additions & 2 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@ import org.tap4j.model.TestSet;

def makeTest(testParam) {
String tearDownCmd = "$RESOLVED_MAKE; \$MAKE -f ./aqa-tests/TKG/testEnv.mk testEnvTeardown"
String makeTestCmd = "$RESOLVED_MAKE; cd ./aqa-tests/TKG; \$MAKE $testParam"
// Note: keyword source cannot be used in Jenkins script. Therefore, using "." instead.
String makeTestCmd = "$RESOLVED_MAKE;cd ./aqa-tests; . ./scripts/testenv/testenvSettings.sh;cd ./TKG; \$MAKE $testParam"
//unset LD_LIBRARY_PATH workaround for issue https://github.com/adoptium/infrastructure/issues/2934
if (JDK_IMPL == 'hotspot' && JDK_VERSION == '8' && PLATFORM.contains('alpine-linux')) {
makeTestCmd = "unset LD_LIBRARY_PATH; $makeTestCmd"
@@ -600,7 +601,7 @@ def get_sources() {
}
}
def makeCompileTest(){
String makeTestCmd = "bash ./compile.sh ${USE_TESTENV_PROPERTIES}"
String makeTestCmd = "bash ./compile.sh"
//unset LD_LIBRARY_PATH workaround for issue https://github.com/adoptium/infrastructure/issues/2934
if (JDK_IMPL == 'hotspot' && JDK_VERSION == '8' && PLATFORM.contains('alpine-linux')) {
makeTestCmd = "unset LD_LIBRARY_PATH; $makeTestCmd"
30 changes: 1 addition & 29 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -8,36 +8,8 @@ if [ $(uname) = AIX ] || [ $(uname) = SunOS ] || [ $(uname) = *BSD ]; then
else
MAKE=make
fi
if [ $USE_TESTENV_PROPERTIES == true ]; then
testenv_file="./testenv/testenv.properties"
if [[ "$PLATFORM" == *"zos"* ]]; then
testenv_file="./testenv/testenv_zos.properties"
fi
if [[ "$PLATFORM" == *"arm"* ]] && [[ "$JDK_VERSION" == "8" ]]; then
testenv_file="./testenv/testenv_arm32.properties"
fi
while read line; do
export $line
done <$testenv_file
if [ $JDK_IMPL == "openj9" ] || [ $JDK_IMPL == "ibm" ]; then
repo=JDK${JDK_VERSION}_OPENJ9_REPO
branch=JDK${JDK_VERSION}_OPENJ9_BRANCH
else
repo=JDK${JDK_VERSION}_REPO
branch=JDK${JDK_VERSION}_BRANCH
fi

eval repo2='$'$repo
eval branch2='$'$branch
source ./scripts/testenv/testenvSettings.sh

export JDK_REPO=$repo2
export JDK_BRANCH=$branch2
echo "Set values based on ${testenv_file}:"
cat $testenv_file
echo ""
echo "JDK_REPO=${JDK_REPO}"
echo "JDK_BRANCH=${JDK_BRANCH}"

fi
cd ./TKG
$MAKE compile
43 changes: 41 additions & 2 deletions functional/OpenJcePlusTests/build.xml
Original file line number Diff line number Diff line change
@@ -56,8 +56,47 @@
</if>

<target name="getOpenJcePlusTests" depends="openJcePlusTests.check" unless="openJcePlusTests.exists">
<getFileWithRetry file="OpenJCEPlus" command="git clone --depth 1 -q ${openjceplusGitRepo} -b ${openjceplusGitBranch} OpenJCEPlus"/>
<checkGitRepoSha repoDir="OpenJCEPlus"/>
<getFileWithRetry file="OpenJCEPlus" command="git clone -q ${openjceplusGitRepo} OpenJCEPlus"/>
<echo message="git rev-parse ${openjceplusGitBranch} "/>
<exec executable="git" failonerror="false" dir="OpenJCEPlus" outputproperty="repo_sha1" resultproperty="code">
<arg value="rev-parse"/>
<arg value="${openjceplusGitBranch}"/>
</exec>
<if>
<equals arg1="${code}" arg2="128"/>
<then>
<echo message="git rev-parse origin/${openjceplusGitBranch}"/>
<exec executable="git" failonerror="true" dir="OpenJCEPlus" outputproperty="repo_sha2" resultproperty="code2">
<arg value="rev-parse"/>
<arg value="origin/${openjceplusGitBranch}"/>
</exec>
<property name="repo_sha" value="${repo_sha2}"/>
</then>
</if>
<if>
<not>
<isset property="repo_sha"/>
</not>
<then>
<property name="repo_sha" value="${repo_sha1}"/>
</then>
</if>
<if>
<isset property="isZOS"/>
<then>
<propertyregex property="repo_sha" input="${repo_sha}" regexp="\n" replace="" override="true"/>
</then>
</if>
<echo message="git checkout -q -f ${repo_sha} "/>
<exec executable="git" failonerror="true" dir="OpenJCEPlus">
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${repo_sha}"/>
</exec>
<checkGitRepoSha repoDir="OpenJCEPlus" />
<addTestenvProperties repoDir="OpenJCEPlus" repoName="OpenJCEPlus"/>

<delete dir="./OpenJCEPlus/src/main" />
</target>

48 changes: 48 additions & 0 deletions scripts/testenv/testenvSettings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set +x
set -eo pipefail

if [[ $USE_TESTENV_PROPERTIES == true ]]; then
testenv_file="./testenv/testenv.properties"
if [[ "$PLATFORM" == *"zos"* ]]; then
testenv_file="./testenv/testenv_zos.properties"
fi
if [[ "$PLATFORM" == *"arm"* ]] && [[ "$JDK_VERSION" == "8" ]]; then
testenv_file="./testenv/testenv_arm32.properties"
fi
while read line; do
export $line
done <$testenv_file
if [[ $JDK_IMPL == "openj9" ]] || [[ $JDK_IMPL == "ibm" ]]; then
repo=JDK${JDK_VERSION}_OPENJ9_REPO
branch=JDK${JDK_VERSION}_OPENJ9_BRANCH

openjceplus_repo=JDK${JDK_VERSION}_OPENJCEPLUS_GIT_REPO
openjceplus_branch=JDK${JDK_VERSION}_OPENJCEPLUS_GIT_BRANCH
eval openjceplus_repo2='$'$openjceplus_repo
eval openjceplus_branch2='$'$openjceplus_branch
export OPENJCEPLUS_GIT_REPO=$openjceplus_repo2
export OPENJCEPLUS_GIT_BRANCH=$openjceplus_branch2

else
repo=JDK${JDK_VERSION}_REPO
branch=JDK${JDK_VERSION}_BRANCH
fi

eval repo2='$'$repo
eval branch2='$'$branch

export JDK_REPO=$repo2
export JDK_BRANCH=$branch2
echo "Set values based on ${testenv_file}:"
echo "========="
cat $testenv_file
echo ""
echo "========="
echo ""
echo "JDK_REPO=${JDK_REPO}"
echo "JDK_BRANCH=${JDK_BRANCH}"
echo "OPENJCEPLUS_GIT_REPO=${OPENJCEPLUS_GIT_REPO}"
echo "OPENJCEPLUS_GIT_BRANCH=${OPENJCEPLUS_GIT_BRANCH}"

fi
8 changes: 8 additions & 0 deletions testenv/testenv.properties
Original file line number Diff line number Diff line change
@@ -28,4 +28,12 @@ JDK21_OPENJ9_REPO=https://github.com/ibmruntimes/openj9-openjdk-jdk21.git
JDK21_OPENJ9_BRANCH=v0.44.0-release
JDK22_OPENJ9_REPO=https://github.com/ibmruntimes/openj9-openjdk-jdk22.git
JDK22_OPENJ9_BRANCH=v0.45.0-release
JDK11_OPENJCEPLUS_GIT_REPO=https://github.com/ibmruntimes/OpenJCEPlus.git
JDK11_OPENJCEPLUS_GIT_BRANCH=semeru-java11.0.23
JDK17_OPENJCEPLUS_GIT_REPO=https://github.com/ibmruntimes/OpenJCEPlus.git
JDK17_OPENJCEPLUS_GIT_BRANCH=semeru-java17.0.11
JDK21_OPENJCEPLUS_GIT_REPO=https://github.com/ibmruntimes/OpenJCEPlus.git
JDK21_OPENJCEPLUS_GIT_BRANCH=semeru-java21.0.3
JDK22_OPENJCEPLUS_GIT_REPO=https://github.com/ibmruntimes/OpenJCEPlus.git
JDK22_OPENJCEPLUS_GIT_BRANCH=semeru-java22.0.1
AQA_REQUIRED_TARGETS=sanity.functional,extended.functional,special.functional,sanity.openjdk,extended.openjdk,sanity.system,extended.system,sanity.perf,extended.perf

0 comments on commit 85a2850

Please sign in to comment.