]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cover, cmd/covdata: actually delete temp dirs
authorIan Lance Taylor <iant@golang.org>
Fri, 30 Jan 2026 23:52:19 +0000 (15:52 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 2 Feb 2026 20:16:54 +0000 (12:16 -0800)
The code was using defer in TestMain, but was also calling os.Exit,
which meant that the deferred functions did not run.
TestMain does not require calling os.Exit, so stop doing it.

Change-Id: I25ca64c36acf65dae3dc3f46e5fa513b9460a8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/740781
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/covdata/tool_test.go
src/cmd/cover/cover_test.go

index 730adf4c8e62e0e3cf8e32b30804119d15b85935..a9669e7b6a3f3074fc7a6fcbad94023c4b99c5a9 100644 (file)
@@ -50,7 +50,7 @@ func TestMain(m *testing.M) {
                fmt.Fprintf(os.Stderr, "debug: preserving tmpdir %s\n", topTmpdir)
        }
        os.Setenv("CMDCOVDATA_TEST_RUN_MAIN", "true")
-       os.Exit(m.Run())
+       m.Run()
 }
 
 var tdmu sync.Mutex
index 431c0560f6eb23c5f3eee74a68981a971ee161ae..a1149e9e6e6b5d0638e9b01112dd49a01ad6732e 100644 (file)
@@ -87,7 +87,7 @@ func TestMain(m *testing.M) {
                fmt.Fprintf(os.Stderr, "debug: preserving tmpdir %s\n", topTmpdir)
        }
        os.Setenv("CMDCOVER_TEST_RUN_MAIN", "normal")
-       os.Exit(m.Run())
+       m.Run()
 }
 
 var tdmu sync.Mutex