Skip to content

Commit

Permalink
Now building also jcstress-tests-all-20240222.jar 20220908.jar (#1020)
Browse files Browse the repository at this point in the history
* Now buildign also jcstress-tests-all-20240222.jar 20220908.jar

Those are based on closest (which were actually that day last) commit
hashes. junit tests are passing.

In addtion shortened hash to 7 latters and uses jdk17 to tip

* Removed duplicated code

and unified names of output jars

* Removed 20220908 version

---------

Co-authored-by: Martijn Verburg <[email protected]>
  • Loading branch information
judovana and karianna authored Jun 14, 2024
1 parent 4d37754 commit 5866850
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions tools/code-tools/jcstress.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

###################################################################
# Script to build jcstress to be reused by jdk testing community #
# currently builds tip and latest released version #
###################################################################
#####################################################################
# Script to build jcstress to be reused by jdk testing community #
# currently builds tip and latest released version #
# It also build two snapshots, which are reused by adoptium testing #
#####################################################################

# shellcheck disable=SC2035,SC2155
set -euo pipefail
Expand All @@ -19,11 +20,34 @@ function hashArtifacts() {
function detectJdks() {
jvm_dir="/usr/lib/jvm/"
find ${jvm_dir} -maxdepth 1 | sort
echo "Available jdks 8 in ${jvm_dir}:"
echo " Note, that you need at at least jdk 11 to build 20240222, tip and 0.16. Listing all jdks anyway."
find ${jvm_dir} -maxdepth 1 | sort | grep -e java-1.8.0- -e jdk-1.8.0 -e java-8- -e jdk-8
echo "Available jdks 11 in ${jvm_dir}:"
find ${jvm_dir} -maxdepth 1 | sort | grep -e java-11- -e jdk-11
echo "Available jdks 17 in ${jvm_dir}:"
find ${jvm_dir} -maxdepth 1 | sort | grep -e java-17- -e jdk-17
jdk8=$(readlink -f $(find ${jvm_dir} -maxdepth 1 | sort | grep -e java-1.8.0- -e jdk-1.8.0 -e java-8- -e jdk-8 | head -n 1))
jdk11=$(readlink -f $(find ${jvm_dir} -maxdepth 1 | sort | grep -e java-11- -e jdk-11 | head -n 1))
jdk17=$(readlink -f $(find ${jvm_dir} -maxdepth 1 | sort | grep -e java-17- -e jdk-17 | head -n 1))
}

function buildJcstress {
local jdk="${1}"
local checkout="${2}"
local target="${3}"
export JAVA_HOME="${jdk}"
mvn clean
git checkout "${checkout}"
mvn clean install $TESTS
mv -v "tests-all/target/${main_name}.jar" "${target}"
mvn clean
git checkout master
unset JAVA_HOME
}

TESTS=
#TESTS=-DskipTests # comment me out!
REPO_DIR="jcstress"
main_name=$REPO_DIR
main_file=$main_name.jar
Expand All @@ -36,29 +60,22 @@ detectJdks
pushd $REPO_DIR
git checkout master
tip=`git log | head -n 1 | sed "s/.*\s\+//"` || true
tip_shortened=`echo ${tip:0:10}`
tip_shortened=`echo ${tip:0:7}`
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
mv tests-all/target/$main_name.jar $rc
buildJcstress "${jdk11}" "${latestRelease}" "${rc}"
echo "Manually renaming $rc as $main_file to provide latest-stable-recommended file"
ln -fv $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
buildJcstress "${jdk11}" "master" "${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 -fv $main_name-$tip_shortened.jar $main_name-tip.jar
mvn clean

echo "Resetting repo back to master"
git checkout master
# 20240222
buildJcstress "${jdk11}" "c565311051494f4b9f78ec86eac6282f1de977e2" "jcstress-20240222.jar"

hashArtifacts
popd

0 comments on commit 5866850

Please sign in to comment.