Skip to content

Commit

Permalink
Archive the test image for after the fact testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerboaa committed Sep 6, 2019
1 parent 80b59e0 commit af1589b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions configureBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ determineBuildProperties() {
setVariablesForConfigure() {

local openjdk_core_version=${BUILD_CONFIG[OPENJDK_CORE_VERSION]}
# test-image target is JDK 11+ only. Set to the empty string
# as build scripts check whether the variable is non-empty.
local openjdk_test_image_path=""

if [ "$openjdk_core_version" == "${JDK8_CORE_VERSION}" ]; then
local jdk_path="j2sdk-image"
Expand All @@ -136,10 +139,13 @@ setVariablesForConfigure() {
local jre_path="jre-bundle/jre-*.jre"
;;
esac
# Set the test image path for JDK 11+
openjdk_test_image_path="test"
fi

BUILD_CONFIG[JDK_PATH]=$jdk_path
BUILD_CONFIG[JRE_PATH]=$jre_path
BUILD_CONFIG[TEST_IMAGE_PATH]=$openjdk_test_image_path
}


Expand Down
2 changes: 2 additions & 0 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ class Build {
def type = "jdk"
if (file.contains("-jre")) {
type = "jre"
} else if (file.contains("-testimage")) {
type = "testimage"
}

String hash = context.sh(script: "sha256sum $file | cut -f1 -d' '", returnStdout: true, returnStatus: false)
Expand Down
22 changes: 21 additions & 1 deletion sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,16 @@ getJreArchivePath() {
echo "${jdkArchivePath}-jre"
}

getTestImageArchivePath() {
local jdkArchivePath=$(getJdkArchivePath)
echo "${jdkArchivePath}-test-image"
}

# Clean up
removingUnnecessaryFiles() {
local jdkTargetPath=$(getJdkArchivePath)
local jreTargetPath=$(getJreArchivePath)
local testImageTargetPath=$(getTestImageArchivePath)

echo "Removing unnecessary files now..."

Expand Down Expand Up @@ -521,6 +527,14 @@ removingUnnecessaryFiles() {
rm -rf "${dirToRemove}"/demo/jfc/Font2DTest || true
rm -rf "${dirToRemove}"/demo/jfc/SwingApplet || true
fi
# Test image is JDK 11+ only so add an additional
# check if the config is set
if [ ! -z "${BUILD_CONFIG[TEST_IMAGE_PATH]}" ] && [ -d "$(ls -d ${BUILD_CONFIG[TEST_IMAGE_PATH]})" ]
then
echo "moving $(ls -d ${BUILD_CONFIG[TEST_IMAGE_PATH]}) to ${testImageTargetPath}"
rm -rf "${testImageTargetPath}" || true
mv "$(ls -d ${BUILD_CONFIG[TEST_IMAGE_PATH]})" "${testImageTargetPath}"
fi

# Remove files we don't need
case "${BUILD_CONFIG[OS_KERNEL_NAME]}" in
Expand Down Expand Up @@ -645,6 +659,7 @@ createOpenJDKTarArchive()
{
local jdkTargetPath=$(getJdkArchivePath)
local jreTargetPath=$(getJreArchivePath)
local testImageTargetPath=$(getTestImageArchivePath)

COMPRESS=gzip

Expand All @@ -657,7 +672,12 @@ createOpenJDKTarArchive()
local jreName=$(echo "${BUILD_CONFIG[TARGET_FILE_NAME]}" | sed 's/-jdk/-jre/')
createArchive "${jreTargetPath}" "${jreName}"
fi
createArchive "${jdkTargetPath}" "${BUILD_CONFIG[TARGET_FILE_NAME]}"
if [ -d "${testImageTargetPath}" ]; then
echo "OpenJDK test image path will be ${testImageTargetPath}."
local testImageName=$(echo "${BUILD_CONFIG[TARGET_FILE_NAME]//-jdk/-testimage}")
createArchive "${testImageTargetPath}" "${testImageName}"
fi
createArchive "${jdkTargetPath}" "${BUILD_CONFIG[TARGET_FILE_NAME]}"
}

# Echo success
Expand Down
1 change: 1 addition & 0 deletions sbin/common/config_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ KEEP_CONTAINER
JDK_BOOT_DIR
JDK_PATH
JRE_PATH
TEST_IMAGE_PATH
JVM_VARIANT
MAKE_ARGS_FOR_ANY_PLATFORM
MAKE_COMMAND_NAME
Expand Down

0 comments on commit af1589b

Please sign in to comment.