From 457410ea4e1771a9058c214f4a1e4539a808b1c6 Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Tue, 3 Sep 2019 13:03:16 -0400 Subject: [PATCH 1/2] Run all tests on all java version --- dd-java-agent/dd-java-agent.gradle | 6 ------ .../hibernate/core-3.3/core-3.3.gradle | 7 ------- .../hibernate/core-4.0/core-4.0.gradle | 7 ------- .../hibernate/core-4.3/core-4.3.gradle | 7 ------- .../http-url-connection.gradle | 6 ------ .../akka-2.5-testing/akka-2.5-testing.gradle | 2 -- .../akka-testing/akka-testing.gradle | 6 ------ .../java-concurrent/java-concurrent.gradle | 6 ------ .../scala-testing/scala-testing.gradle | 6 ------ dd-java-agent/instrumentation/jdbc/jdbc.gradle | 6 ------ gradle/java.gradle | 18 +----------------- 11 files changed, 1 insertion(+), 76 deletions(-) diff --git a/dd-java-agent/dd-java-agent.gradle b/dd-java-agent/dd-java-agent.gradle index ed33f225b97..fcb616fbda6 100644 --- a/dd-java-agent/dd-java-agent.gradle +++ b/dd-java-agent/dd-java-agent.gradle @@ -2,12 +2,6 @@ plugins { id "com.github.johnrengelman.shadow" version "4.0.4" } -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - integrationTests = true -} - description = 'dd-java-agent' apply from: "${rootDir}/gradle/java.gradle" diff --git a/dd-java-agent/instrumentation/hibernate/core-3.3/core-3.3.gradle b/dd-java-agent/instrumentation/hibernate/core-3.3/core-3.3.gradle index 08b59249179..eee6b19b465 100644 --- a/dd-java-agent/instrumentation/hibernate/core-3.3/core-3.3.gradle +++ b/dd-java-agent/instrumentation/hibernate/core-3.3/core-3.3.gradle @@ -5,13 +5,6 @@ * instrumentation isn't able to reference it. */ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true - minJavaVersionForTests = JavaVersion.VERSION_1_7 -} - muzzle { pass { group = "org.hibernate" diff --git a/dd-java-agent/instrumentation/hibernate/core-4.0/core-4.0.gradle b/dd-java-agent/instrumentation/hibernate/core-4.0/core-4.0.gradle index 6b3183382dc..cacf01f4e53 100644 --- a/dd-java-agent/instrumentation/hibernate/core-4.0/core-4.0.gradle +++ b/dd-java-agent/instrumentation/hibernate/core-4.0/core-4.0.gradle @@ -1,10 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true - minJavaVersionForTests = JavaVersion.VERSION_1_7 -} - muzzle { pass { group = "org.hibernate" diff --git a/dd-java-agent/instrumentation/hibernate/core-4.3/core-4.3.gradle b/dd-java-agent/instrumentation/hibernate/core-4.3/core-4.3.gradle index 91111b0143a..b937b53fbb4 100644 --- a/dd-java-agent/instrumentation/hibernate/core-4.3/core-4.3.gradle +++ b/dd-java-agent/instrumentation/hibernate/core-4.3/core-4.3.gradle @@ -1,10 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true - minJavaVersionForTests = JavaVersion.VERSION_1_7 -} - muzzle { pass { group = "org.hibernate" diff --git a/dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle b/dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle index 4e43e643c60..38851b24a8f 100644 --- a/dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle +++ b/dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle @@ -1,9 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true -} - apply from: "${rootDir}/gradle/java.gradle" dependencies { diff --git a/dd-java-agent/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle b/dd-java-agent/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle index ea3a871dfde..28871f7057d 100644 --- a/dd-java-agent/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle +++ b/dd-java-agent/instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle @@ -1,8 +1,6 @@ // Set properties before any plugins get loaded ext { minJavaVersionForTests = JavaVersion.VERSION_1_8 - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true } apply from: "${rootDir}/gradle/java.gradle" diff --git a/dd-java-agent/instrumentation/java-concurrent/akka-testing/akka-testing.gradle b/dd-java-agent/instrumentation/java-concurrent/akka-testing/akka-testing.gradle index 30cb8ba25dd..49fee8699bb 100644 --- a/dd-java-agent/instrumentation/java-concurrent/akka-testing/akka-testing.gradle +++ b/dd-java-agent/instrumentation/java-concurrent/akka-testing/akka-testing.gradle @@ -1,9 +1,3 @@ -// Set properties before any plugins get loaded -ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true -} - apply from: "${rootDir}/gradle/java.gradle" apply from: "${rootDir}/gradle/test-with-scala.gradle" diff --git a/dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle b/dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle index 507a782af53..4ff2d984aba 100644 --- a/dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle +++ b/dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle @@ -1,9 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true -} - apply from: "${rootDir}/gradle/java.gradle" apply from: "${rootDir}/gradle/test-with-scala.gradle" apply from: "${rootDir}/gradle/test-with-kotlin.gradle" diff --git a/dd-java-agent/instrumentation/java-concurrent/scala-testing/scala-testing.gradle b/dd-java-agent/instrumentation/java-concurrent/scala-testing/scala-testing.gradle index 4c6a34c862f..35e1187652d 100644 --- a/dd-java-agent/instrumentation/java-concurrent/scala-testing/scala-testing.gradle +++ b/dd-java-agent/instrumentation/java-concurrent/scala-testing/scala-testing.gradle @@ -1,9 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true -} - apply from: "${rootDir}/gradle/java.gradle" apply from: "${rootDir}/gradle/test-with-scala.gradle" diff --git a/dd-java-agent/instrumentation/jdbc/jdbc.gradle b/dd-java-agent/instrumentation/jdbc/jdbc.gradle index 8a99d7661af..98f019826f0 100644 --- a/dd-java-agent/instrumentation/jdbc/jdbc.gradle +++ b/dd-java-agent/instrumentation/jdbc/jdbc.gradle @@ -1,9 +1,3 @@ -// Set properties before any plugins get loaded -project.ext { - // Execute tests on all JVMs, even rare and outdated ones - coreJavaInstrumentation = true -} - apply from: "${rootDir}/gradle/java.gradle" apply plugin: 'org.unbroken-dome.test-sets' diff --git a/gradle/java.gradle b/gradle/java.gradle index 9b16d4f21c8..621e69b3b29 100644 --- a/gradle/java.gradle +++ b/gradle/java.gradle @@ -255,22 +255,6 @@ def isJdkForced(String javaName) { return (project.hasProperty('forceJdk') && project.getProperty('forceJdk').contains(javaName)) } -// JVM names we would like to run complete test suite on -// Note: complete test suite is always run on JVM used for compilation -// Note2: apparently there is no way to have a 'global' variable, so instead we have per project -// attribute that has same value in all projects -project.ext.majorSupportedJVMs = ["7", "11"] - -def isTestingEnabled(String javaName) { - if (javaName in project.majorSupportedJVMs) { - return true - } - if (project.findProperty("coreJavaInstrumentation") || project.findProperty("integrationTests")) { - return true - } - return false -} - // Disable default test tasks if current JVM doesn't match version requirements tasks.withType(Test).configureEach { if (name.endsWith("Generated")) { @@ -326,7 +310,7 @@ for (def env : System.getenv().entrySet()) { jvmArgs '-XX:CompileCommand=exclude,net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor::onParameterizedType' } - onlyIf { (isJavaVersionAllowed(javaVersion) && isTestingEnabled(javaName)) || isJdkForced(javaName) } + onlyIf { isJavaVersionAllowed(javaVersion) || isJdkForced(javaName) } if (applyCodeCoverage) { jacoco { // Disable jacoco for additional JVM tests to speed things up a bit From 619ecb8170888a5dcd335a40e5a78234758e88ce Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Tue, 3 Sep 2019 17:19:46 -0400 Subject: [PATCH 2/2] Fix a couple tests failing with IBM 8 --- .../src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy | 4 ++-- .../src/test/groovy/datadog/trace/tracer/TracerTest.groovy | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy b/dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy index 269bd59a8e8..7268c43f8ad 100644 --- a/dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy +++ b/dd-trace/src/test/groovy/datadog/trace/tracer/SpanImplTest.groovy @@ -346,9 +346,9 @@ class SpanImplTest extends Specification { def "test JSON rendering with big ID values"() { setup: "create span" def parentContext = new SpanContextImpl( - new BigInteger(2).pow(64).subtract(1).toString(), + BigInteger.valueOf(2).pow(64).subtract(1).toString(), "123", - new BigInteger(2).pow(64).subtract(2).toString()) + BigInteger.valueOf(2).pow(64).subtract(2).toString()) def span = new SpanImpl(trace, parentContext, startTimestamp) span.finish() diff --git a/dd-trace/src/test/groovy/datadog/trace/tracer/TracerTest.groovy b/dd-trace/src/test/groovy/datadog/trace/tracer/TracerTest.groovy index ac2a203f57e..4df7b864afb 100644 --- a/dd-trace/src/test/groovy/datadog/trace/tracer/TracerTest.groovy +++ b/dd-trace/src/test/groovy/datadog/trace/tracer/TracerTest.groovy @@ -7,6 +7,7 @@ import datadog.trace.tracer.writer.AgentWriter import datadog.trace.tracer.writer.SampleRateByService import datadog.trace.tracer.writer.Writer import datadog.trace.util.gc.GCUtils +import spock.lang.Requires import spock.lang.Shared import spock.lang.Specification @@ -14,6 +15,7 @@ import java.lang.ref.WeakReference import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger +@Requires({ !System.getProperty("java.vm.name").contains("IBM J9 VM") }) class TracerTest extends Specification { @Shared