Skip to content

Commit

Permalink
Added builder for jtharness
Browse files Browse the repository at this point in the history
  • Loading branch information
judovana committed Aug 8, 2023
1 parent 53f0dee commit 761188d
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/code-tools/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ pipeline {
build('jtreg')
}
}
stage('javatest') {
agent {
label NODE_LABEL
}
steps {
build('javatest')
}
}
stage('temurin-sbom') {
agent {
label NODE_LABEL
Expand Down
77 changes: 77 additions & 0 deletions tools/code-tools/javatest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

###################################################################
# Scrtipt to build jtharness reusable by jdk testing community #
# currenlty builds tip and latest released version #
###################################################################

# shellcheck disable=SC2035,SC2155
set -euo pipefail
WORKSPACE=$PWD

function hashArtifacts() {
echo "Creating checksums all jtharness*.jar"
for file in `ls javatest*.jar` ; do
sha256sum $file > $file.sha256sum.txt
done
}

function detectJdks() {
jvm_dir="/usr/lib/jvm/"
find ${jvm_dir} -maxdepth 1 | sort
echo "Available jdks 11 in ${jvm_dir}:"
find ${jvm_dir} -maxdepth 1 | sort | grep -e java-11- -e jdk-11
jdk11=$(readlink -f $(find ${jvm_dir} -maxdepth 1 | sort | grep -e java-11- -e jdk-11 | head -n 1))
}

REPO_DIR="jtharness"
BUILD_PATH=JTHarness-build/binaries/lib
main_file=javatest
if [ ! -e $REPO_DIR ] ; then
git clone https://github.com/openjdk/$REPO_DIR.git
else
rm -vf $REPO_DIR/$main_file*.jar
fi
detectJdks
pushd $REPO_DIR
git checkout master
rm -rf ../$BUILD_PATH
tip=`git log | head -n 1 | sed "s/.*\s\+//"` || true
tip_shortened=`echo ${tip:0:10}`
latestRelease=`git tag -l | sort -Vr | head -n 1`
rc=$main_file-$latestRelease

# latest released
git checkout $latestRelease
export JAVA_HOME=$jdk11
pushd build
ant test | tee ../$rc.jar.txt || true
ant build
popd
mv ../$BUILD_PATH/$main_file.jar $rc.jar
echo "Manually renaming $rc.jar as $main_file.jar to provide latest-stable-recommended file"
ln -sfv $rc.jar $main_file
pushd build
ant clean
popd
rm -rf ../$BUILD_PATH

# tip
git checkout master
export JAVA_HOME=$jdk11
pushd build
ant test | tee ../$main_file-$tip_shortened.jar.txt || true
ant build
popd
mv ../$BUILD_PATH/$main_file.jar $main_file-$tip_shortened.jar
echo "Manually renaming $main_file-$tip_shortened.jar as $main_file-tip.jar to provide latest-unstable-recommended file"
ln -sfv $main_file-$tip_shortened.jar $main_file-tip.jar
pushd build
ant clean
popd
rm -rf ../$BUILD_PATH

echo "Resetting repo back to master"
git checkout master
hashArtifacts
popd

0 comments on commit 761188d

Please sign in to comment.