mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 03:34:39 -06:00
Fix TestEntryExcludeByAttribute on linux
Modern linux distros often make /tmp a tmpfs which does not support xattrs, so this test will fail.
This commit is contained in:
@@ -249,10 +249,16 @@ func TestEntryExcludeByAttribute(t *testing.T) {
|
|||||||
t.Skip("skipping test, not darwin, linux, freebsd, or netbsd")
|
t.Skip("skipping test, not darwin, linux, freebsd, or netbsd")
|
||||||
}
|
}
|
||||||
|
|
||||||
testDir := filepath.Join(os.TempDir(), "duplicacy_test")
|
tmpDir := ""
|
||||||
|
// on linux TempDir is usually a tmpfs which does not support xattrs
|
||||||
os.RemoveAll(testDir)
|
if runtime.GOOS == "linux" {
|
||||||
os.MkdirAll(testDir, 0700)
|
tmpDir = "."
|
||||||
|
}
|
||||||
|
testDir, err := os.MkdirTemp(tmpDir, "duplicacy_test")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Mkdirtmp() failed: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Files or folders named with "exclude" below will have the exclusion attribute set on them
|
// Files or folders named with "exclude" below will have the exclusion attribute set on them
|
||||||
// When ListEntries is called with excludeByAttribute true, they should be excluded.
|
// When ListEntries is called with excludeByAttribute true, they should be excluded.
|
||||||
@@ -356,10 +362,9 @@ func TestEntryExcludeByAttribute(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !t.Failed() {
|
if tmpDir != "" || !t.Failed() {
|
||||||
os.RemoveAll(testDir)
|
os.RemoveAll(testDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEntryEncoding(t *testing.T) {
|
func TestEntryEncoding(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user