| plugins { | |
| id 'rhino.java-conventions' | |
| id 'jacoco' | |
| id 'jacoco-report-aggregation' | |
| } | |
| sourceSets { | |
| integrationTest { | |
| java.srcDir 'src/integrationTest/java' | |
| } | |
| } | |
| configurations { | |
| // Extra OSGi bundles the integration test installs alongside the rhino module bundles | |
| osgiIntegrationBundles | |
| } | |
| dependencies { | |
| implementation project(':rhino-engine') | |
| implementation project(':examples') | |
| implementation project(':rhino') | |
| implementation project(':rhino-tools') | |
| implementation project(':rhino-xml') | |
| testImplementation project(':testutils') | |
| testImplementation(libs.archunit.get()) { | |
| exclude group: 'junit' | |
| } | |
| testImplementation("org.slf4j:slf4j-simple:2.0.17") | |
| testImplementation "org.yaml:snakeyaml:2.6" | |
| testImplementation "javax.xml.soap:javax.xml.soap-api:1.4.0" | |
| testImplementation "javax.activation:javax.activation-api:1.2.0" | |
| integrationTestImplementation platform(libs.junit.platform.get()) | |
| integrationTestImplementation "org.junit.jupiter:junit-jupiter" | |
| integrationTestRuntimeOnly "org.junit.platform:junit-platform-launcher" | |
| integrationTestImplementation "org.apache.felix:org.apache.felix.framework:7.0.5" | |
| osgiIntegrationBundles platform("org.ow2.asm:asm-bom:9.9.1") | |
| osgiIntegrationBundles "org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle:1.3.7" | |
| } | |
| tasks.withType(Test).configureEach { | |
| if (project.hasProperty('jfrTestRecording')) { | |
| def jfrDir = layout.buildDirectory.dir("jfr/${name}").get().asFile | |
| def jfcFile = layout.projectDirectory.file("tests.jfc") | |
| doFirst { | |
| jfrDir.mkdirs() | |
| } | |
| // Ensure the stack depth is deep enough to avoid truncation. | |
| jvmArgs += "-XX:FlightRecorderOptions=stackdepth=256" | |
| // Set recording to run from start, and with a configuraiton that enables our internal event types. | |
| jvmArgs += "-XX:StartFlightRecording=settings=${jfcFile},dumponexit=true,filename=${jfrDir},maxsize=1GB" | |
| } | |
| } | |
| tasks.withType(JavaCompile) { | |
| // We have deprecated things, like "optimization level", and have | |
| // not yet removed them from all tests, so turn this warning off. | |
| options.compilerArgs = [ | |
| '-Xlint:-deprecation,unchecked,-removal' | |
| ] | |
| } | |
| tasks.register('integrationTest', Test) { | |
| description = 'Runs JPMS and OSGi integration tests against the built JARs.' | |
| group = 'verification' | |
| testClassesDirs = sourceSets.integrationTest.output.classesDirs | |
| classpath = sourceSets.integrationTest.runtimeClasspath | |
| useJUnitPlatform() | |
| dependsOn ':rhino:jar', ':rhino-engine:jar', ':rhino-tools:jar', ':rhino-xml:jar', ':rhino-kotlin:jar' | |
| [':rhino', ':rhino-engine', ':rhino-tools', ':rhino-xml', ':rhino-kotlin'].each { proj -> | |
| systemProperty "${proj.substring(1)}.jar", project(proj).jar.archiveFile.get().asFile.path | |
| } | |
| systemProperty "osgi.integration.bundles", | |
| configurations.osgiIntegrationBundles.files.collect { it.path }.join(",") | |
| } | |
| check.dependsOn integrationTest | |
| test { | |
| maxHeapSize = "1g" | |
| // Many tests do not clean up contexts properly. This makes the tests much | |
| // more resilient at the expense of performance. | |
| forkEvery = 1 | |
| maxParallelForks = 64 | |
| // Properties required for the legacy Mozilla tests. Tests will fail unless | |
| // the time zone and other properties are set as shown below | |
| systemProperty 'java.awt.headless', 'true' | |
| systemProperty 'mozilla.js.tests', 'testsrc/tests' | |
| systemProperty 'mozilla.js.tests.timeout', 60000 | |
| // Required for JWT GUI tests | |
| jvmArgs += ['--add-opens', 'java.desktop/javax.swing.table=ALL-UNNAMED'] | |
| // Required for some reflection tests | |
| jvmArgs += ['--add-opens', 'java.base/java.util=ALL-UNNAMED'] | |
| jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] | |
| systemProperty 'test262properties', System.getProperty('test262properties') | |
| if (System.getProperty('runTest262Debug') != null) { | |
| systemProperty 'runTest262Debug', System.getProperty('runTest262Debug') | |
| } | |
| if (System.getProperty('runTest262NonDebug') != null) { | |
| systemProperty 'runTest262NonDebug', System.getProperty('runTest262NonDebug') | |
| } | |
| if (System.getProperty('updateTest262properties') != null) { | |
| if (System.getenv("RHINO_TEST_JAVA_VERSION") != "17") { | |
| System.out.println("Test262 properties update is only accurate on Java 17 and you have " + JavaVersion.current()) | |
| System.out.println("Set RHINO_TEST_JAVA_VERSION in the environment to use this feature") | |
| throw new Exception("Incorrect Java version for Test 262 properties update") | |
| } | |
| systemProperty 'updateTest262properties', System.getProperty('updateTest262properties') | |
| } | |
| if (System.getProperty('updateSourceMapTestsExcludelist') != null) { | |
| systemProperty 'updateSourceMapTestsExcludelist', System.getProperty('updateSourceMapTestsExcludelist') | |
| } | |
| System.properties.each { k,v-> | |
| if (k.startsWith("rhino.")) { | |
| systemProperty k, v | |
| } | |
| } | |
| jacoco { | |
| // These particular tests produce Jacoco exceptions because of their size | |
| excludes = ['**perlstress**', '**start_unicode**', '**ojsc**'] | |
| } | |
| } | |
| jacocoTestReport { | |
| reports { | |
| xml.required = false | |
| csv.required = false | |
| html.outputLocation = layout.buildDirectory.dir('reports/jacoco') | |
| } | |
| } |