aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@canonical.com>2018-01-31 11:11:39 +1300
committerMichael Hudson-Doyle <michael.hudson@canonical.com>2018-01-31 00:49:35 +0000
commitd30591c18df9c4deaae5048d0a8426fb5da17c66 (patch)
treed182013706c1edb829a72becd2eb223b768a0ca2
parentbcc86d5f42fddc2eca1bb066668388aa6807c38c (diff)
downloadgo-d30591c18df9c4deaae5048d0a8426fb5da17c66.tar.gz
go-d30591c18df9c4deaae5048d0a8426fb5da17c66.zip
cmd/vendor/github.com/google/pprof: cherry-pick fix to cope with $HOME not being writable
Upstream PRs: https://github.com/google/pprof/pull/305, https://github.com/google/pprof/pull/306. Change-Id: I28969118f52ee08fcaf3572ad5da015ae756fd7a Reviewed-on: https://go-review.googlesource.com/90935 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
index 32af2e9b20..abce5b5c70 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
@@ -362,6 +362,18 @@ func TestHttpsInsecure(t *testing.T) {
if runtime.GOOS == "nacl" {
t.Skip("test assumes tcp available")
}
+ saveHome := os.Getenv(homeEnv())
+ tempdir, err := ioutil.TempDir("", "home")
+ if err != nil {
+ t.Fatal("creating temp dir: ", err)
+ }
+ defer os.RemoveAll(tempdir)
+
+ // pprof writes to $HOME/pprof by default which is not necessarily
+ // writeable (e.g. on a Debian buildd) so set $HOME to something we
+ // know we can write to for the duration of the test.
+ os.Setenv(homeEnv(), tempdir)
+ defer os.Setenv(homeEnv(), saveHome)
baseVars := pprofVariables
pprofVariables = baseVars.makeCopy()