Skip to content

Commit

Permalink
Making jdk for jtreg build explicit (#1019)
Browse files Browse the repository at this point in the history
* Making jdk for jtreg build explicit

and so imune against change of system jdk on underlying system/image

* Removed the endless growth of path

Also put the "expected" java into the start, as otherwise the system JDK
would be always before the "expected" jdk. I think the meddling wiht
PATH is actually useless, but I do not see to the bottom of this script.
Am in temptation to remove that at all. But that can bite

* Removed duplicated build of jtreg 6_1

---------

Co-authored-by: Martijn Verburg <[email protected]>
  • Loading branch information
judovana and karianna authored Apr 25, 2024
1 parent 4de5af6 commit 2000dc4
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tools/code-tools/jtreg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ readonly JTREG_7_2='jtreg-7.2+1'
readonly JTREG_7_3='jtreg-7.3+1'
readonly JTREG_7_3_1='jtreg-7.3.1+1'

function checkJdks() {
jvm_dir="/usr/lib/jvm/"
find "${jvm_dir}" -maxdepth 1 | sort
}

function checkWorkspaceVar()
{
echo 'Checking WORKSPACE variable...'
Expand Down Expand Up @@ -50,53 +55,53 @@ buildJTReg()
if [ "$1" == "$JTREG_5" ]; then
export BUILD_NUMBER="b01"
export BUILD_VERSION="5.1"
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
elif [ "$1" == "$JTREG_6" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="6"
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
elif [ "$1" == "$JTREG_6_1" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="6.1"
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
elif [ "$1" == "$JTREG_7" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="7"
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
elif [ "$1" == "$JTREG_7_1" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="7.1.1"
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
elif [ "$1" == "$JTREG_7_2" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="7.2"
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
elif [ "$1" == "$JTREG_7_3" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="7.3"
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
elif [ "$1" == "$JTREG_7_3_1" ]; then
export JTREG_BUILD_NUMBER="1"
export BUILD_VERSION="7.3.1"
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
fi
git checkout $version
else
unset BUILD_NUMBER
unset BUILD_VERSION
unset JTREG_BUILD_NUMBER
export JAVA_HOME=/usr/lib/jvm/jdk-11
export PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME=/usr/lib/jvm/jdk-17
git checkout master
fi

export PATH="$JAVA_HOME/bin:$ORIGINAL_PATH"

echo ""
echo "***********************************************"
echo "Building JTREG $version..."
echo "***********************************************"
(
echo "PATH: $PATH"
echo "JAVA_HOME: $JAVA_HOME"
echo "Changing into $WORKSPACE"
cd "$WORKSPACE"
Expand Down Expand Up @@ -141,6 +146,9 @@ createChecksum()
sha256sum "${ARCHIVE_FULL_PATH}" > "${DESTINATION}/${ARCHIVE_NAME}.sha256sum.txt"
}

readonly ORIGINAL_PATH="${PATH}"

checkJdks
checkWorkspaceVar
clearWorkspace
echo 'Starting build process...'
Expand All @@ -149,7 +157,6 @@ cd "$WORKSPACE"
buildJTReg "$JTREG_5"
buildJTReg "$JTREG_6"
buildJTReg "$JTREG_6_1"
buildJTReg "$JTREG_6_1"
buildJTReg "$JTREG_7"
buildJTReg "$JTREG_7_1"
buildJTReg "$JTREG_7_2"
Expand Down

0 comments on commit 2000dc4

Please sign in to comment.