From 36f143e833405653bc5716bf08733ef5a60e9f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3r=C3=A1nt=20Pint=C3=A9r?= Date: Fri, 18 Sep 2020 15:19:21 +0200 Subject: [PATCH] Expect doubles in CSVs --- .../AbstractProfilerIntegrationTest.groovy | 26 +++++------ .../profiler/BenchmarkIntegrationTest.groovy | 42 +++++++++--------- ...ationInstrumentationIntegrationTest.groovy | 24 +++++----- .../profiler/ProfilerIntegrationTest.groovy | 44 +++++++++---------- 4 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/test/groovy/org/gradle/profiler/AbstractProfilerIntegrationTest.groovy b/src/test/groovy/org/gradle/profiler/AbstractProfilerIntegrationTest.groovy index 0b553fb56..c65a5c5a5 100644 --- a/src/test/groovy/org/gradle/profiler/AbstractProfilerIntegrationTest.groovy +++ b/src/test/groovy/org/gradle/profiler/AbstractProfilerIntegrationTest.groovy @@ -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+)?/) } /** @@ -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+)?/) } /** @@ -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+)?/) } } diff --git a/src/test/groovy/org/gradle/profiler/BenchmarkIntegrationTest.groovy b/src/test/groovy/org/gradle/profiler/BenchmarkIntegrationTest.groovy index efefe5adb..a95efda5c 100644 --- a/src/test/groovy/org/gradle/profiler/BenchmarkIntegrationTest.groovy +++ b/src/test/groovy/org/gradle/profiler/BenchmarkIntegrationTest.groovy @@ -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"() { @@ -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"() { @@ -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) { diff --git a/src/test/groovy/org/gradle/profiler/BuildOperationInstrumentationIntegrationTest.groovy b/src/test/groovy/org/gradle/profiler/BuildOperationInstrumentationIntegrationTest.groovy index e1597ea91..8423379f6 100644 --- a/src/test/groovy/org/gradle/profiler/BuildOperationInstrumentationIntegrationTest.groovy +++ b/src/test/groovy/org/gradle/profiler/BuildOperationInstrumentationIntegrationTest.groovy @@ -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 @@ -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] << [ @@ -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(',') } diff --git a/src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy b/src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy index a28ecdfe2..d9091d060 100644 --- a/src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy +++ b/src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy @@ -622,11 +622,11 @@ println "" 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"() { @@ -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"() { @@ -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"() { @@ -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"() {