Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Jul 3, 2024
1 parent 1298f19 commit 7df63d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 10 additions & 7 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

assertCapturedSuccess() {
assertEquals 0 "${RETURN}"
if [ "$TRAVIS" = "true" ]; then
# Travis keeps injecting -Xmn option on JDK8 that causes a warning in STR_ERR
assertTrue true
else
assertEquals "" "$(cat ${STD_ERR})"
fi
}

setupJavaEnv() {
Expand All @@ -32,6 +26,10 @@ testCompileWithoutSystemProperties() {

assertCapturedSuccess

echo "================"
cat "$STD_OUT"
echo "================"

_assertMavenLatest
assertCaptured "Installing OpenJDK 1.8"
assertTrue "Java should be present in runtime." "[ -d ${BUILD_DIR}/.jdk ]"
Expand All @@ -49,7 +47,7 @@ testCompile()

_assertMavenLatest
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
assertContains "system.properties contains the wrong version" "java.runtime.version=1.8" "$(cat $CACHE_DIR/system.properties)"
assertContains "system.properties contains the wrong version" "java.runtime.version=21" "$(cat $CACHE_DIR/system.properties)"
}

testCompilationFailure()
Expand Down Expand Up @@ -122,6 +120,11 @@ testCustomSettingsXmlWithUrl()
testCustomSettingsXmlWithInvalidUrl()
{
createPom
# Set OpenJDK version explicitly to avoid getting a warning on stderr which would
# trip assertCapturedError
cat > ${BUILD_DIR}/system.properties <<EOF
java.runtime.version=21
EOF

export MAVEN_SETTINGS_URL="https://example.com/ha7s8duysadfuhasjd/settings.xml"

Expand Down
6 changes: 2 additions & 4 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ EOF

createSettingsXml()
{
[ "$TRAVIS" = "true" ] && rm -rf /home/travis/.m2/repository

if [ ! -z "${1:-}" ]; then
settings_file="$1"
else
Expand Down Expand Up @@ -119,6 +117,6 @@ _assertMavenLatest() {
assertFileMD5 "45ca660e83af83fa8213b55fb693326c" ${installDir}/.maven/bin/mvn
assertTrue "mvn should be executable" "[ -x ${installDir}/.maven/bin/mvn ]"

assertCaptured "Unexpected mvn command" "mvn -DskipTests clean dependency:list install"
assertCaptured "Build was not successful" "BUILD SUCCESS"
assertCaptured "mvn -DskipTests clean dependency:list install"
assertCaptured "BUILD SUCCESS"
}

0 comments on commit 7df63d3

Please sign in to comment.