Fix TestConfigurationHelper.
Change-Id: Ia33b9c66d7120f861a039affb8da559e44d1575d
diff --git a/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt b/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
index 976e2ac..bd9f8da 100644
--- a/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
+++ b/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
@@ -148,7 +148,12 @@
val printObfuscatedStacktraces = project.hasProperty("print_obfuscated_stacktraces")
if (isR8Lib || oneLinePerTest || hasUpdateTestTimestamp) {
- val updateTestTimestampPath = project.property("update_test_timestamp")!!.toString()
+ val updateTestTimestampPath =
+ if (hasUpdateTestTimestamp) {
+ project.property("update_test_timestamp")!!.toString()
+ } else {
+ null
+ }
test.addTestListener(
object : TestListener {
val testTimes = mutableMapOf<TestDescriptor?, Long>()
@@ -185,7 +190,9 @@
if (printTimes) {
testTimes[desc] = Date().getTime() - testTimes[desc]!!
}
- File(updateTestTimestampPath).writeText(Date().getTime().toString())
+ if (updateTestTimestampPath != null) {
+ File(updateTestTimestampPath).writeText(Date().getTime().toString())
+ }
if (result?.resultType == TestResult.ResultType.FAILURE && result.exception != null) {
val exception = result.exception as Throwable
if (isR8Lib) {