Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added builder scripts for more code-tools - jcstress, jtharness, sigtest and jcov #766

Merged
merged 6 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion tools/code-tools/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ pipeline {
build('asmtools')
}
}
stage('jcstress') {
agent {
label NODE_LABEL
}
steps {
build('jcstress')
}
}
stage('jtreg') {
agent {
label NODE_LABEL
Expand All @@ -26,6 +34,22 @@ pipeline {
build('jtreg')
}
}
stage('javatest') {
agent {
label NODE_LABEL
}
steps {
build('javatest')
}
}
stage('sigtest') {
agent {
label NODE_LABEL
}
steps {
build('sigtest')
}
}
stage('temurin-sbom') {
agent {
label NODE_LABEL
Expand All @@ -52,7 +76,7 @@ def build(stageName) {
checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${stageName}"]], submoduleCfg: [], userRemoteConfigs: [[url: toolsUrl]]])
}
sh label: "${stageName}", script: "./tools/code-tools/${stageName}.sh"
archiveArtifacts artifacts: "**/temurin-*-sbom.jar, ${stageName}/*.tar.gz, ${stageName}/${stageName}*.jar, ${stageName}/${stageName}*.jar.*.txt, ${stageName}/*.tar.gz.*sum*.txt, ${stageName}/${stageName}*.jar.html, ${stageName}/${stageName}*.jar.md", followSymlinks: false
archiveArtifacts artifacts: "**/temurin-*-sbom.jar, ${stageName}/*.tar.gz, ${stageName}/${stageName}*.jar, ${stageName}/${stageName}*.jar.*.txt,${stageName}/${stageName}*.tar.gz.*.txt, ${stageName}/*.tar.gz.*sum*.txt, ${stageName}/${stageName}*.jar.html, ${stageName}/${stageName}*.jar.md, ${stageName}/${stageName}*.zip", followSymlinks: false
} catch (Exception e) {
slackSend channel: 'jenkins', color: 'danger', message: "${env.JOB_NAME} : #${env.BUILD_NUMBER} : ${stageName}() FAILED with following error message:\n${e}", teamDomain: 'adoptium'
throw new Exception("[ERROR] ${stageName} FAILED\n${e}")
Expand Down
9 changes: 8 additions & 1 deletion tools/code-tools/asmtools.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@

#!/bin/bash

###################################################################
# Script to build asmtools to be reused by jdk testing community #
# currently builds tip of master and tip of at8 branch #
# In future, it should clone and build: #
# tip of master, latest release in master, and tip of at7 branch #
###################################################################

# shellcheck disable=SC2035,SC2155
set -euo pipefail
WORKSPACE=$PWD
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

###################################################################
# Script to build jtharness reusable by jdk testing community #
# currently 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.jar
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
161 changes: 161 additions & 0 deletions tools/code-tools/jcov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#!/bin/bash

###################################################################
# Script to build jcov reusable by jdk testing community #
# It requires asm jars - downloaded during build #
# It optionally requires javatest.jar - #
# obtained from older release, buildable on demand or skipped #
# currently builds tip and latest released version #
###################################################################

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

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

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

function resetRepo() {
local branch=${1}
rm -f .git/index.lock ;
git reset --hard ;
git checkout $branch
}

function cleanRepo() {
pushd build
ant clean
popd
rm -rf ../$BUILD_PATH
}

function getAsmDeps() {
asm_version=$1
tools="asm asm-tree asm-util"
main_url="https://repository.ow2.org/nexus/content/repositories/releases/org/ow2/asm"
ASM_TITLE="Built against '$tools' tools in version '$asm_version'"
ASM_URLS=""
ASM_JARS=""
ASM_PROPS=""
for tool in $tools; do
tool_prop="`echo $tool|sed "s/-/./g"`.jar"
tool_versioned="$tool-$asm_version.jar"
tool_url="$main_url/$tool/$asm_version/$tool_versioned"
if [ ! -e $tool_versioned ] ; then
wget $tool_url
fi
ASM_URLS="$ASM_URLS$tool_url
" #ne per line
ASM_PROPS="$ASM_PROPS -D$tool_prop=`pwd`/$tool_versioned"
ASM_JARS="$ASM_JARS$tool_versioned:"
done
}

function getReadme() {
echo $ASM_TITLE
echo ""
echo "Get:"
echo "$ASM_URLS"
echo ""
echo "Use on CP:"
echo $ASM_JARS=""
echo ""
echo "In addition jtobserver.jar requires javatest.sh"
echo "You can get one at adoptium: https://ci.adoptium.net/view/Dependencies/job/dependency_pipeline/" #TODO add better link?
echo "Or build one from: https://github.com/openjdk/jtharness/"
}

function getJavatest() {
local javatest=javatest.jar
pushd build
if [ ! -e $javatest ] ; then
# For local usage you can build local javatest.jar by running javatest.sh
# Then also the jtobserver.jar will be built
# FIXME replace by wget of latest javatest.jar downloaded from published javatest.sh artifacts
if [ -e ../../jtharness/$javatest ] ; then
cp ../../jtharness/$javatest .
else
# unsetting the javatestjar will exclude build of
sed "s/javatestjar.*/javatestjar=/g" -i build.properties
fi
fi
if [ ! -e testng.jar ] ; then
local testngv=6.9.10
wget https://repo1.maven.org/maven2/org/testng/testng/$testngv/testng-$testngv.jar
mv testng-$testngv.jar testng.jar
fi
if [ ! -e jcommander.jar ] ; then
jcommanderv=1.81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jcommanderv=1.81
local jcommanderv=1.81

wget https://repo1.maven.org/maven2/com/beust/jcommander/$jcommanderv/jcommander-$jcommanderv.jar
mv jcommander-$jcommanderv.jar jcommander.jar
fi
popd
}

REPO_DIR="jcov"
BUILD_PATH=JCOV_BUILD/
main_file=jcov
if [ ! -e $REPO_DIR ] ; then
git clone https://github.com/openjdk/$REPO_DIR.git
else
rm -vf $REPO_DIR/$main_file*.tar.gz
fi

detectJdks

pushd $REPO_DIR

resetRepo 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 | sed "s/rc/b000/g" | sort -Vr | sed "s/b000/rc/" | head -n 1`
rc=$main_file-$latestRelease

# latest released
resetRepo "$latestRelease"
getAsmDeps "8.0.1"
getJavatest
pushd build
ant $ASM_PROPS build
popd
pushd $BUILD_PATH/jcov*/
getReadme > readme.txt
tar -czf ../../$rc.tar.gz *.jar readme.txt
popd
echo "Manually renaming $rc.tar.gz as $main_file.tar.gz to provide latest-stable-recommended file"
ln -sfv $rc.tar.gz $main_file.tar.gz
cleanRepo

# tip
resetRepo master
getAsmDeps "9.0"
getJavatest
pushd build
ant $ASM_PROPS test | tee ../$main_file-$tip_shortened.tar.gz.txt || true
ant $ASM_PROPS build
popd
pushd $BUILD_PATH/jcov*/
getReadme > readme.txt
tar -czf ../../$main_file-$tip_shortened.tar.gz *.jar readme.txt
popd
echo "Manually renaming $main_file-$tip_shortened.tar.gz as $main_file-tip..tar.gz to provide latest-unstable-recommended file"
ln -sfv $main_file-$tip_shortened.tar.gz $main_file-tip.tar.gz
cleanRepo

echo "Resetting repo back to master"
resetRepo master
hashArtifacts
popd
64 changes: 64 additions & 0 deletions tools/code-tools/jcstress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

###################################################################
# Script to build jcstress to be reused by jdk testing community #
# currently builds tip and latest released version #
###################################################################

# shellcheck disable=SC2035,SC2155
set -euo pipefail
karianna marked this conversation as resolved.
Show resolved Hide resolved
WORKSPACE=$PWD

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

function detectJdks() {
jvm_dir="/usr/lib/jvm/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only builds on Linux, I wonder if there's a more O/S independent way to pass the java in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For our CI farm we can of course pin to a Linux node if need be

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like below that Java 11 is required?

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="jcstress"
main_name=$REPO_DIR
main_file=$main_name.jar
if [ ! -e $REPO_DIR ] ; then
git clone https://github.com/openjdk/$REPO_DIR.git
else
rm -vf $REPO_DIR/$main_name*.jar $REPO_DIR/$main_name*.sha256sum.txt
fi
detectJdks
pushd $REPO_DIR
git checkout master
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_name-$latestRelease.jar

# latest released
git checkout $latestRelease
export JAVA_HOME=$jdk11
mvn clean install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assumes mvn is installed on build host

mv tests-all/target/$main_name.jar $rc
echo "Manually renaming $rc as $main_file to provide latest-stable-recommended file"
ln -sfv $rc $main_file
mvn clean

# tip
git checkout master
export JAVA_HOME=$jdk11
mvn clean install
mv tests-all/target/$main_file $main_name-$tip_shortened.jar
echo "Manually renaming $main_name-$tip_shortened.jar as $main_name-tip.jar to provide latest-unstable-recommended file"
ln -sfv $main_name-$tip_shortened.jar $main_name-tip.jar
mvn clean

echo "Resetting repo back to master"
git checkout master
hashArtifacts
popd
6 changes: 6 additions & 0 deletions tools/code-tools/jtreg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash

###################################################################
# Script to build jtreg test suite harness #
# currently builds tip, 5.1, 6, 6.1, 7, 7.1, 7.2 #
###################################################################

# shellcheck disable=SC2035,SC2116

set -eu
Expand Down
Loading