build.gradle.kts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. plugins {
  2. id("otel.javaagent-testing")
  3. }
  4. dependencies {
  5. compileOnly(project(":testing-common:library-for-integration-tests"))
  6. testImplementation(project(":testing-common:library-for-integration-tests"))
  7. testCompileOnly(project(":instrumentation-api"))
  8. testCompileOnly(project(":javaagent-tooling"))
  9. testCompileOnly(project(":javaagent-extension-api"))
  10. testCompileOnly(project(":muzzle"))
  11. testImplementation("net.bytebuddy:byte-buddy")
  12. testImplementation("net.bytebuddy:byte-buddy-agent")
  13. testImplementation("com.google.guava:guava")
  14. testImplementation(project(":instrumentation-annotations"))
  15. testImplementation("cglib:cglib:3.3.0")
  16. // test instrumenting java 1.1 bytecode
  17. // TODO do we want this?
  18. testImplementation("net.sf.jt400:jt400:6.1")
  19. }
  20. tasks {
  21. val testFieldInjectionDisabled by registering(Test::class) {
  22. filter {
  23. includeTestsMatching("context.FieldInjectionDisabledTest")
  24. }
  25. include("**/FieldInjectionDisabledTest.*")
  26. jvmArgs("-Dotel.javaagent.experimental.field-injection.enabled=false")
  27. }
  28. val testFieldBackedImplementation by registering(Test::class) {
  29. filter {
  30. includeTestsMatching("context.FieldBackedImplementationTest")
  31. }
  32. include("**/FieldBackedImplementationTest.*")
  33. // this test uses reflection to access fields generated by FieldBackedProvider
  34. // internal-reflection needs to be disabled because it removes these fields from reflection results.
  35. jvmArgs("-Dotel.instrumentation.internal-reflection.enabled=false")
  36. // required on jdk17
  37. jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
  38. jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
  39. }
  40. val testIndyModuleOldBytecodeInstrumentation by registering(Test::class) {
  41. filter {
  42. includeTestsMatching("InstrumentOldBytecode")
  43. }
  44. include("**/InstrumentOldBytecode.*")
  45. jvmArgs("-Dotel.instrumentation.inline-ibm-resource-level.enabled=false")
  46. }
  47. val testInlineModuleOldBytecodeInstrumentation by registering(Test::class) {
  48. filter {
  49. includeTestsMatching("InstrumentOldBytecode")
  50. }
  51. include("**/InstrumentOldBytecode.*")
  52. jvmArgs("-Dotel.instrumentation.indy-ibm-resource-level.enabled=false")
  53. }
  54. test {
  55. filter {
  56. excludeTestsMatching("context.FieldInjectionDisabledTest")
  57. excludeTestsMatching("context.FieldBackedImplementationTest")
  58. excludeTestsMatching("InstrumentOldBytecode")
  59. }
  60. // this is needed for AgentInstrumentationSpecificationTest
  61. jvmArgs("-Dotel.javaagent.exclude-classes=config.exclude.packagename.*,config.exclude.SomeClass,config.exclude.SomeClass\$NestedClass")
  62. }
  63. check {
  64. dependsOn(testFieldInjectionDisabled)
  65. dependsOn(testFieldBackedImplementation)
  66. }
  67. }