Skip to content

Commit

Permalink
Expect doubles in CSVs
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Sep 18, 2020
1 parent c63e453 commit 36f143e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ genrule(
assert lines.get(1) == "version,Gradle ${gradleVersion}"
assert lines.get(2) == "tasks,${tasks.join(", ")}"
assert lines.get(3) == "value,execution"
assert lines.get(4).matches("warm-up build #1,\\d+")
assert lines.get(9).matches("warm-up build #6,\\d+")
assert lines.get(10).matches("measured build #1,\\d+")
assert lines.get(11).matches("measured build #2,\\d+")
assert lines.get(19).matches("measured build #10,\\d+")
assert lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
assert lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?/)
assert lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?/)
assert lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?/)
assert lines.get(19).matches(/measured build #10,\d+(?:\.\d+)?/)
}

/**
Expand All @@ -176,10 +176,10 @@ genrule(
assert lines.get(1) == "version,Gradle ${gradleVersion}"
assert lines.get(2) == "tasks,${tasks.join(", ")}"
assert lines.get(3) == "value,execution"
assert lines.get(4).matches("warm-up build #1,\\d+")
assert lines.get(5).matches("measured build #1,\\d+")
assert lines.get(6).matches("measured build #2,\\d+")
assert lines.get(14).matches("measured build #10,\\d+")
assert lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
assert lines.get(5).matches(/measured build #1,\d+(?:\.\d+)?/)
assert lines.get(6).matches(/measured build #2,\d+(?:\.\d+)?/)
assert lines.get(14).matches(/measured build #10,\d+(?:\.\d+)?/)
}

/**
Expand All @@ -192,10 +192,10 @@ genrule(
assert lines.get(1) == "version,Gradle ${gradleVersion}"
assert lines.get(2) == "tasks,${tasks.join(", ")}"
assert lines.get(3) == "value,execution"
assert lines.get(4).matches("warm-up build #1,\\d+")
assert lines.get(5).matches("measured build #1,\\d+")
assert lines.get(6).matches("measured build #2,\\d+")
assert lines.get(14).matches("measured build #10,\\d+")
assert lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
assert lines.get(5).matches(/measured build #1,\d+(?:\.\d+)?/)
assert lines.get(6).matches(/measured build #2,\d+(?:\.\d+)?/)
assert lines.get(14).matches(/measured build #10,\d+(?:\.\d+)?/)
}
}

Expand Down
42 changes: 21 additions & 21 deletions src/test/groovy/org/gradle/profiler/BenchmarkIntegrationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
lines.get(1) == "version,Gradle ${minimalSupportedGradleVersion},Gradle 5.0"
lines.get(2) == "tasks,assemble,assemble"
lines.get(3) == "value,execution,execution"
lines.get(4).matches("warm-up build #1,\\d+,\\d+")
lines.get(9).matches("warm-up build #6,\\d+,\\d+")
lines.get(10).matches("measured build #1,\\d+,\\d+")
lines.get(11).matches("measured build #2,\\d+,\\d+")
lines.get(12).matches("measured build #3,,\\d+")
lines.get(19).matches("measured build #10,,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(12).matches(/measured build #3,,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,,\d+(?:\.\d+)?/)
}

def "recovers from failure in warm-up build while running benchmarks"() {
Expand Down Expand Up @@ -62,15 +62,15 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
lines.get(1) == "version,Gradle ${minimalSupportedGradleVersion},Gradle 5.0"
lines.get(2) == "tasks,assemble,assemble"
lines.get(3) == "value,execution,execution"
lines.get(4).matches("warm-up build #1,\\d+,\\d+")
lines.get(5).matches("warm-up build #2,\\d+,\\d+")
lines.get(6).matches("warm-up build #3,\\d+,\\d+")
lines.get(7).matches("warm-up build #4,,\\d+")
lines.get(8).matches("warm-up build #5,,\\d+")
lines.get(9).matches("warm-up build #6,,\\d+")
lines.get(10).matches("measured build #1,,\\d+")
lines.get(11).matches("measured build #2,,\\d+")
lines.get(19).matches("measured build #10,,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(5).matches(/warm-up build #2,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(6).matches(/warm-up build #3,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(7).matches(/warm-up build #4,,\d+(?:\.\d+)?/)
lines.get(8).matches(/warm-up build #5,,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,,\d+(?:\.\d+)?/)
}

def "recovers from failure to run any builds while running benchmarks"() {
Expand Down Expand Up @@ -99,12 +99,12 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
lines.get(1) == "version,Gradle ${minimalSupportedGradleVersion},Gradle 5.0"
lines.get(2) == "tasks,assemble,assemble"
lines.get(3) == "value,execution,execution"
lines.get(4).matches("warm-up build #1,,\\d+")
lines.get(5).matches("warm-up build #2,,\\d+")
lines.get(6).matches("warm-up build #3,,\\d+")
lines.get(10).matches("measured build #1,,\\d+")
lines.get(11).matches("measured build #2,,\\d+")
lines.get(19).matches("measured build #10,,\\d+")
lines.get(4).matches(/warm-up build #1,,\d+(?:\.\d+)?/)
lines.get(5).matches(/warm-up build #2,,\d+(?:\.\d+)?/)
lines.get(6).matches(/warm-up build #3,,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,,\d+(?:\.\d+)?/)
}

def brokenBuild(int successfulIterations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class BuildOperationInstrumentationIntegrationTest extends AbstractProfilerInteg
lines.get(1) == "version,Gradle ${gradleVersion},Gradle ${gradleVersion}"
lines.get(2) == "tasks,assemble,assemble"
lines.get(3) == "value,execution,task start"
lines.get(4).matches("warm-up build #1,\\d+,\\d+")
lines.get(9).matches("warm-up build #6,\\d+,\\d+")
lines.get(10).matches("measured build #1,\\d+,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)

and:
def taskStart = lines.get(10) =~ /measured build #1,\d+,(\d+)/
def taskStart = lines.get(10) =~ /measured build #1,\d+(?:\.\d+)?,(\d+(?:\.\d+)?)/
taskStart.matches()
Long.valueOf(taskStart[0][1]) > 0
Double.valueOf(taskStart[0][1]) > 0

where:
gradleVersion | configurationCache
Expand Down Expand Up @@ -98,12 +98,12 @@ class BuildOperationInstrumentationIntegrationTest extends AbstractProfilerInteg
lines.get(3) == "value,execution,SnapshotTaskInputsBuildOperationType"

def firstWarmup = lines.get(4)
def snapshottingDuration = firstWarmup =~ /warm-up build #1,\d+,(\d+)/
def snapshottingDuration = firstWarmup =~ /warm-up build #1,\d+(?:\.\d+)?,(\d+(?:\.\d+)?)/
snapshottingDuration.matches()
Long.valueOf(snapshottingDuration[0][1]) > 0
Double.valueOf(snapshottingDuration[0][1]) > 0

lines.get(9).matches("warm-up build #6,\\d+,\\d+")
lines.get(10).matches("measured build #1,\\d+,\\d+")
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)

where:
[via, commandLine, scenarioConfiguration, gradleVersion, configurationCache] << [
Expand Down Expand Up @@ -167,9 +167,9 @@ class BuildOperationInstrumentationIntegrationTest extends AbstractProfilerInteg
lines.get(1) == "version,Gradle ${gradleVersion},Gradle ${gradleVersion},Gradle ${gradleVersion}"
lines.get(2) == "tasks,assemble,assemble,assemble"
lines.get(3) == "value,execution,task start,SnapshotTaskInputsBuildOperationType"
lines.get(4).matches("warm-up build #1,\\d+,\\d+,\\d+")
lines.get(9).matches("warm-up build #6,\\d+,\\d+,\\d+")
lines.get(10).matches("measured build #1,\\d+,\\d+,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)

and:
def buildLines = lines.subList(10, 19).collect { it.tokenize(',') }
Expand Down
44 changes: 22 additions & 22 deletions src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,11 @@ println "<daemon: " + gradle.services.get(org.gradle.internal.environment.Gradle
lines.get(1) == "version,Gradle ${minimalSupportedGradleVersion}"
lines.get(2) == "tasks,help"
lines.get(3) == "value,execution"
lines.get(4).matches("warm-up build #1,\\d+")
lines.get(9).matches("warm-up build #6,\\d+")
lines.get(10).matches("measured build #1,\\d+")
lines.get(11).matches("measured build #2,\\d+")
lines.get(19).matches("measured build #10,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,\d+(?:\.\d+)?/)
}

def "runs benchmarks using single scenario defined in scenario file"() {
Expand Down Expand Up @@ -699,8 +699,8 @@ println "<dry-run: " + gradle.startParameter.dryRun + ">"
lines.get(1) == "version,Gradle 3.0,Gradle ${minimalSupportedGradleVersion},Gradle ${minimalSupportedGradleVersion}"
lines.get(2) == "tasks,assemble,assemble,clean assemble"
lines.get(3) == "value,execution,execution,execution"
lines.get(4).matches("warm-up build #1,\\d+,\\d+,\\d+")
lines.get(5).matches("measured build #1,\\d+,\\d+,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(5).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
}

def "can define system property when benchmarking using tooling API"() {
Expand Down Expand Up @@ -1110,11 +1110,11 @@ help {
lines.get(1) == "version,buck,buck,buck"
lines.get(2) == "tasks,,//some/target,"
lines.get(3) == "value,execution,execution,execution"
lines.get(4).matches("warm-up build #1,\\d+,\\d+,\\d+")
lines.get(9).matches("warm-up build #6,\\d+,\\d+,\\d+")
lines.get(10).matches("measured build #1,\\d+,\\d+,\\d+")
lines.get(11).matches("measured build #2,\\d+,\\d+,\\d+")
lines.get(19).matches("measured build #10,\\d+,\\d+,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,\d+(?:\.\d+)?,\d+(?:\.\d+)?,\d+(?:\.\d+)?/)
}

def "cannot profile a buck build"() {
Expand Down Expand Up @@ -1210,11 +1210,11 @@ buildTarget {
lines.get(1) == "version,bazel"
lines.get(2) == "tasks,some:assemble"
lines.get(3) == "value,execution"
lines.get(4).matches("warm-up build #1,\\d+")
lines.get(9).matches("warm-up build #6,\\d+")
lines.get(10).matches("measured build #1,\\d+")
lines.get(11).matches("measured build #2,\\d+")
lines.get(19).matches("measured build #10,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,\d+(?:\.\d+)?/)
}

def "cannot profile a bazel build"() {
Expand Down Expand Up @@ -1305,11 +1305,11 @@ buildGoal {
lines.get(1) == "version,maven"
lines.get(2) == "tasks,-v"
lines.get(3) == "value,execution"
lines.get(4).matches("warm-up build #1,\\d+")
lines.get(9).matches("warm-up build #6,\\d+")
lines.get(10).matches("measured build #1,\\d+")
lines.get(11).matches("measured build #2,\\d+")
lines.get(19).matches("measured build #10,\\d+")
lines.get(4).matches(/warm-up build #1,\d+(?:\.\d+)?/)
lines.get(9).matches(/warm-up build #6,\d+(?:\.\d+)?/)
lines.get(10).matches(/measured build #1,\d+(?:\.\d+)?/)
lines.get(11).matches(/measured build #2,\d+(?:\.\d+)?/)
lines.get(19).matches(/measured build #10,\d+(?:\.\d+)?/)
}

def "clears build cache when asked"() {
Expand Down

0 comments on commit 36f143e

Please sign in to comment.