Skip to content

Commit

Permalink
servlet: Avoid lincheck for normal testing
Browse files Browse the repository at this point in the history
It is slow, and just tries a bunch of possibilities. Leave it around for
developers to run locally, but it isn't precise enough to run on every
build. This change reduces the build of servlet in isolation by
1 minute. I suspect the gains are larger in a full grpc build because it
is very CPU-intensive; it uses 600% CPU on my 8-thread CPU when running
by itself.
  • Loading branch information
ejona86 committed Sep 13, 2023
1 parent 134b049 commit 3eb5d20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description = "gRPC: Servlet"
def jettyVersion = '10.0.7'

sourceSets {
// Testing threading is more of a brute-force test and is very slow. No need to run it as part
// of normal suite.
threadingTest {}
// Create a test sourceset for each classpath - could be simplified if we made new test directories
undertowTest {}
tomcatTest {}
Expand Down Expand Up @@ -39,7 +42,11 @@ dependencies {
implementation project(':grpc-util'),
libraries.guava

testImplementation 'javax.servlet:javax.servlet-api:4.0.1',
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'

threadingTestImplementation project(':grpc-servlet'),
libraries.truth,
'javax.servlet:javax.servlet-api:4.0.1',
'org.jetbrains.kotlinx:lincheck:2.14.1'

itImplementation project(':grpc-servlet'),
Expand Down Expand Up @@ -74,6 +81,15 @@ tasks.named("test").configure {
}
}

tasks.register('threadingTest', Test) {
classpath = sourceSets.threadingTest.runtimeClasspath
testClassesDirs = sourceSets.threadingTest.output.classesDirs
}

tasks.named("assemble").configure {
dependsOn tasks.named('compileThreadingTestJava')
}

// Set up individual classpaths for each test, to avoid any mismatch,
// and ensure they are only used when supported by the current jvm
def undertowTest = tasks.register('undertowTest', Test) {
Expand Down

0 comments on commit 3eb5d20

Please sign in to comment.