From ef498a987b69ad57bac3caff77a8e113d6eed0bb Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 21 Feb 2015 16:53:14 +0100 Subject: [PATCH] Allow configuring temp dir for tests --- key_test.go | 3 ++- tree_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/key_test.go b/key_test.go index 920cb2dd0..8ef704d0d 100644 --- a/key_test.go +++ b/key_test.go @@ -16,9 +16,10 @@ import ( var testPassword = "foobar" var testCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)") var testLargeCrypto = flag.Bool("test.largecrypto", false, "also test crypto functions with large payloads") +var testTempDir = flag.String("test.tempdir", "", "use this directory for temporary storage (default: system temp dir)") func setupBackend(t testing.TB) restic.Server { - tempdir, err := ioutil.TempDir("", "restic-test-") + tempdir, err := ioutil.TempDir(*testTempDir, "restic-test-") ok(t, err) b, err := backend.CreateLocal(tempdir) diff --git a/tree_test.go b/tree_test.go index 4f293a088..080293e9b 100644 --- a/tree_test.go +++ b/tree_test.go @@ -21,7 +21,7 @@ var testFiles = []struct { // prepareDir creates a temporary directory and returns it. func prepareDir(t *testing.T) string { - tempdir, err := ioutil.TempDir("", "restic-test-") + tempdir, err := ioutil.TempDir(*testTempDir, "restic-test-") ok(t, err) for _, test := range testFiles {