From 866c873daa97f90f0bf6d303a1ea92d248f17b1d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 29 Jun 2022 11:51:46 +0100 Subject: [PATCH] backend: allow wrapping backend tests to run in make quicktest --- backend/chunker/chunker_test.go | 1 + backend/combine/combine_test.go | 2 ++ backend/compress/compress_test.go | 1 + backend/crypt/crypt_test.go | 13 +++++++++++++ backend/hasher/hasher_test.go | 1 + backend/local/local_test.go | 5 +++-- backend/memory/memory_test.go | 5 +++-- backend/union/union_test.go | 6 ++++++ fstest/fstests/fstests.go | 3 ++- 9 files changed, 32 insertions(+), 5 deletions(-) diff --git a/backend/chunker/chunker_test.go b/backend/chunker/chunker_test.go index 4acdf5b5a..cca76f9e7 100644 --- a/backend/chunker/chunker_test.go +++ b/backend/chunker/chunker_test.go @@ -53,6 +53,7 @@ func TestIntegration(t *testing.T) { {Name: name, Key: "type", Value: "chunker"}, {Name: name, Key: "remote", Value: tempDir}, } + opt.QuickTestOK = true } fstests.Run(t, &opt) } diff --git a/backend/combine/combine_test.go b/backend/combine/combine_test.go index c6274c562..46b49bcf0 100644 --- a/backend/combine/combine_test.go +++ b/backend/combine/combine_test.go @@ -35,6 +35,7 @@ func TestLocal(t *testing.T) { {Name: name, Key: "type", Value: "combine"}, {Name: name, Key: "upstreams", Value: upstreams}, }, + QuickTestOK: true, }) } @@ -50,6 +51,7 @@ func TestMemory(t *testing.T) { {Name: name, Key: "type", Value: "combine"}, {Name: name, Key: "upstreams", Value: upstreams}, }, + QuickTestOK: true, }) } diff --git a/backend/compress/compress_test.go b/backend/compress/compress_test.go index 76baf22aa..356e9dd43 100644 --- a/backend/compress/compress_test.go +++ b/backend/compress/compress_test.go @@ -61,5 +61,6 @@ func TestRemoteGzip(t *testing.T) { {Name: name, Key: "remote", Value: tempdir}, {Name: name, Key: "compression_mode", Value: "gzip"}, }, + QuickTestOK: true, }) } diff --git a/backend/crypt/crypt_test.go b/backend/crypt/crypt_test.go index 8369a60f7..d4b9dc1e4 100644 --- a/backend/crypt/crypt_test.go +++ b/backend/crypt/crypt_test.go @@ -4,6 +4,7 @@ package crypt_test import ( "os" "path/filepath" + "runtime" "testing" "github.com/rclone/rclone/backend/crypt" @@ -46,6 +47,7 @@ func TestStandardBase32(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -67,6 +69,7 @@ func TestStandardBase64(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -88,6 +91,7 @@ func TestStandardBase32768(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -109,6 +113,7 @@ func TestOff(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -117,6 +122,9 @@ func TestObfuscate(t *testing.T) { if *fstest.RemoteName != "" { t.Skip("Skipping as -remote set") } + if runtime.GOOS == "darwin" { + t.Skip("Skipping on macOS as obfuscating control characters makes filenames macOS can't cope with") + } tempdir := filepath.Join(os.TempDir(), "rclone-crypt-test-obfuscate") name := "TestCrypt3" fstests.Run(t, &fstests.Opt{ @@ -131,6 +139,7 @@ func TestObfuscate(t *testing.T) { SkipBadWindowsCharacters: true, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -139,6 +148,9 @@ func TestNoDataObfuscate(t *testing.T) { if *fstest.RemoteName != "" { t.Skip("Skipping as -remote set") } + if runtime.GOOS == "darwin" { + t.Skip("Skipping on macOS as obfuscating control characters makes filenames macOS can't cope with") + } tempdir := filepath.Join(os.TempDir(), "rclone-crypt-test-obfuscate") name := "TestCrypt4" fstests.Run(t, &fstests.Opt{ @@ -154,5 +166,6 @@ func TestNoDataObfuscate(t *testing.T) { SkipBadWindowsCharacters: true, UnimplementableFsMethods: []string{"OpenWriterAt"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } diff --git a/backend/hasher/hasher_test.go b/backend/hasher/hasher_test.go index 09d60f33d..23feb9b96 100644 --- a/backend/hasher/hasher_test.go +++ b/backend/hasher/hasher_test.go @@ -33,6 +33,7 @@ func TestIntegration(t *testing.T) { {Name: "TestHasher", Key: "remote", Value: tempDir}, } opt.RemoteName = "TestHasher:" + opt.QuickTestOK = true } fstests.Run(t, &opt) } diff --git a/backend/local/local_test.go b/backend/local/local_test.go index 8ecab2dbd..d0d54ec26 100644 --- a/backend/local/local_test.go +++ b/backend/local/local_test.go @@ -11,7 +11,8 @@ import ( // TestIntegration runs integration tests against the remote func TestIntegration(t *testing.T) { fstests.Run(t, &fstests.Opt{ - RemoteName: "", - NilObject: (*local.Object)(nil), + RemoteName: "", + NilObject: (*local.Object)(nil), + QuickTestOK: true, }) } diff --git a/backend/memory/memory_test.go b/backend/memory/memory_test.go index 3d768fec0..9989bc60d 100644 --- a/backend/memory/memory_test.go +++ b/backend/memory/memory_test.go @@ -10,7 +10,8 @@ import ( // TestIntegration runs integration tests against the remote func TestIntegration(t *testing.T) { fstests.Run(t, &fstests.Opt{ - RemoteName: ":memory:", - NilObject: (*Object)(nil), + RemoteName: ":memory:", + NilObject: (*Object)(nil), + QuickTestOK: true, }) } diff --git a/backend/union/union_test.go b/backend/union/union_test.go index 8b69c4c27..f5a9948f6 100644 --- a/backend/union/union_test.go +++ b/backend/union/union_test.go @@ -41,6 +41,7 @@ func TestStandard(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -62,6 +63,7 @@ func TestRO(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -83,6 +85,7 @@ func TestNC(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -104,6 +107,7 @@ func TestPolicy1(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -125,6 +129,7 @@ func TestPolicy2(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } @@ -146,5 +151,6 @@ func TestPolicy3(t *testing.T) { }, UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"}, UnimplementableObjectMethods: []string{"MimeType"}, + QuickTestOK: true, }) } diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go index 9cc95896e..7a72ef5f5 100644 --- a/fstest/fstests/fstests.go +++ b/fstest/fstests/fstests.go @@ -327,6 +327,7 @@ type Opt struct { SkipFsCheckWrap bool // if set skip FsCheckWrap SkipObjectCheckWrap bool // if set skip ObjectCheckWrap SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks + QuickTestOK bool // if set, run this test with make quicktest } // returns true if x is found in ss @@ -392,7 +393,7 @@ func Run(t *testing.T, opt *Opt) { unwrappableFsMethods = []string{"Command"} // these Fs methods don't need to be wrapped ever ) - if strings.HasSuffix(os.Getenv("RCLONE_CONFIG"), "/notfound") && *fstest.RemoteName == "" { + if strings.HasSuffix(os.Getenv("RCLONE_CONFIG"), "/notfound") && *fstest.RemoteName == "" && !opt.QuickTestOK { t.Skip("quicktest only") }