Fix "cleanup" flag

This commit is contained in:
Alexander Neumann 2015-04-26 15:40:25 +02:00
parent d19b23d4f1
commit edfd86624c
3 changed files with 3 additions and 6 deletions

View file

@ -99,7 +99,7 @@ func testBackend(b backend.Backend, t *testing.T) {
} }
// remove content if requested // remove content if requested
if *testCleanup { if *TestCleanup {
for _, test := range TestStrings { for _, test := range TestStrings {
id, err := backend.ParseID(test.id) id, err := backend.ParseID(test.id)
OK(t, err) OK(t, err)

View file

@ -1,7 +1,6 @@
package backend_test package backend_test
import ( import (
"flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"testing" "testing"
@ -10,8 +9,6 @@ import (
. "github.com/restic/restic/test" . "github.com/restic/restic/test"
) )
var testCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
func setupLocalBackend(t *testing.T) *local.Local { func setupLocalBackend(t *testing.T) *local.Local {
tempdir, err := ioutil.TempDir("", "restic-test-") tempdir, err := ioutil.TempDir("", "restic-test-")
OK(t, err) OK(t, err)
@ -25,7 +22,7 @@ func setupLocalBackend(t *testing.T) *local.Local {
} }
func teardownLocalBackend(t *testing.T, b *local.Local) { func teardownLocalBackend(t *testing.T, b *local.Local) {
if !*testCleanup { if !*TestCleanup {
t.Logf("leaving local backend at %s\n", b.Location()) t.Logf("leaving local backend at %s\n", b.Location())
return return
} }

View file

@ -25,7 +25,7 @@ func setupSFTPBackend(t *testing.T) *sftp.SFTP {
} }
func teardownSFTPBackend(t *testing.T, b *sftp.SFTP) { func teardownSFTPBackend(t *testing.T, b *sftp.SFTP) {
if !*testCleanup { if !*TestCleanup {
t.Logf("leaving backend at %s\n", b.Location()) t.Logf("leaving backend at %s\n", b.Location())
return return
} }