]> Cypherpunks repositories - gostls13.git/commit
testing: make TempDir idempotent for both Cleanup and Benchmark
authorChangkun Ou <hi@changkun.us>
Fri, 28 Aug 2020 10:13:37 +0000 (12:13 +0200)
committerEmmanuel Odeke <emm.odeke@gmail.com>
Sat, 5 Sep 2020 04:21:49 +0000 (04:21 +0000)
commit721819e7bad078ac350bdebebb28793e13081e82
treec39399ac8056da864bd0bdb3d91f8c672c906c2f
parent93810ac1f4574e1e2a79ea156781bafaf8b8ebe0
testing: make TempDir idempotent for both Cleanup and Benchmark

Ensures that calling TempDir() in either of Cleanup or Benchmark
doesn't cause test failures which were previously caused by the
created directory having been deleted after the first run, yet
we prevented the recreation of the directory due to our selection
of concurrency primitive sync.Once. This change recreates the
temporary directory if it doesn't exist, regardless of how
many times Cleanup and Benchmark are invoked.

Fixes #41062

Change-Id: I925d9f7207d7c369a193d1e17da7a59a586244a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/251297
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/testing/testing.go
src/testing/testing_test.go