Skip to content

Commit cdc1378

Browse files
CI: run tests with 32-bit JVM and ObjectBox.
1 parent e3385d1 commit cdc1378

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

ci/Jenkinsfile-Windows

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,46 @@ pipeline {
3030
stage('init') {
3131
steps {
3232
bat 'gradlew -version'
33-
34-
// "cmd /c" for an OK exit code if no file is found
35-
bat 'cmd /c del tests\\objectbox-java-test\\hs_err_pid*.log'
3633
}
3734
}
3835

39-
stage('build-java') {
36+
stage('build-java-x64') {
4037
steps {
38+
// Remove files to avoid archiving them again.
39+
bat 'del /q /s hs_err_pid*.log'
40+
4141
bat "gradlew $gradleArgs $MVN_REPO_ARGS cleanTest build test"
4242
}
43+
post {
44+
always {
45+
junit '**/build/test-results/**/TEST-*.xml'
46+
archiveArtifacts artifacts: '**/hs_err_pid*.log', allowEmptyArchive: true
47+
}
48+
}
49+
}
50+
51+
stage('build-java-x86') {
52+
steps {
53+
// Remove files to avoid archiving them again.
54+
bat 'del /q /s hs_err_pid*.log'
55+
56+
// TEST_WITH_JAVA_X86 makes objectbox-java-test use 32-bit java executable and therefore
57+
// 32-bit ObjectBox to run tests (see build.gradle file).
58+
// Note: assumes JAVA_HOME_X86 is set to 32-bit JDK path.
59+
// Note: no space before && or value has space as well.
60+
bat "set TEST_WITH_JAVA_X86=true&& gradlew $gradleArgs $MVN_REPO_ARGS cleanTest build test"
61+
}
62+
post {
63+
always {
64+
junit '**/build/test-results/**/TEST-*.xml'
65+
archiveArtifacts artifacts: '**/hs_err_pid*.log', allowEmptyArchive: true
66+
}
67+
}
4368
}
4469
}
4570

4671
// For global vars see /jenkins/pipeline-syntax/globals
4772
post {
48-
always {
49-
junit '**/build/test-results/**/TEST-*.xml'
50-
archiveArtifacts artifacts: 'tests/*/hs_err_pid*.log', allowEmptyArchive: true // Only on JVM crash.
51-
// currently unused: archiveArtifacts '**/build/reports/findbugs/*'
52-
}
53-
5473
failure {
5574
updateGitlabCommitStatus name: 'build-windows', state: 'failed'
5675
}

tests/objectbox-java-test/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ dependencies {
3737
}
3838

3939
test {
40+
// to run tests with 32-bit ObjectBox
41+
if (System.getenv('TEST_WITH_JAVA_X86') == 'true') {
42+
def javaExecutablePath = System.getenv("JAVA_HOME_X86") + "\\bin\\java"
43+
println "Running tests with ${javaExecutablePath}"
44+
executable = javaExecutablePath
45+
}
46+
4047
// This is pretty useless now because it floods console with warnings about internal Java classes
4148
// However we might check from time to time, also with Java 9.
4249
// jvmArgs '-Xcheck:jni'

0 commit comments

Comments
 (0)