|
@@ -15,13 +15,13 @@ import (
|
|
"io"
|
|
"io"
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
- "runtime"
|
|
|
|
rdebug "runtime/debug"
|
|
rdebug "runtime/debug"
|
|
"sort"
|
|
"sort"
|
|
"sync"
|
|
"sync"
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
"github.com/d4l3k/messagediff"
|
|
"github.com/d4l3k/messagediff"
|
|
|
|
+ "github.com/syncthing/syncthing/lib/build"
|
|
"github.com/syncthing/syncthing/lib/events"
|
|
"github.com/syncthing/syncthing/lib/events"
|
|
"github.com/syncthing/syncthing/lib/fs"
|
|
"github.com/syncthing/syncthing/lib/fs"
|
|
"github.com/syncthing/syncthing/lib/ignore"
|
|
"github.com/syncthing/syncthing/lib/ignore"
|
|
@@ -178,7 +178,7 @@ func TestVerify(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestNormalization(t *testing.T) {
|
|
func TestNormalization(t *testing.T) {
|
|
- if runtime.GOOS == "darwin" {
|
|
|
|
|
|
+ if build.IsDarwin {
|
|
t.Skip("Normalization test not possible on darwin")
|
|
t.Skip("Normalization test not possible on darwin")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -197,7 +197,7 @@ func TestNormalization(t *testing.T) {
|
|
}
|
|
}
|
|
numInvalid := 2
|
|
numInvalid := 2
|
|
|
|
|
|
- if runtime.GOOS == "windows" {
|
|
|
|
|
|
+ if build.IsWindows {
|
|
// On Windows, in case 5 the character gets replaced with a
|
|
// On Windows, in case 5 the character gets replaced with a
|
|
// replacement character \xEF\xBF\xBD at the point it's written to disk,
|
|
// replacement character \xEF\xBF\xBD at the point it's written to disk,
|
|
// which means it suddenly becomes valid (sort of).
|
|
// which means it suddenly becomes valid (sort of).
|
|
@@ -257,7 +257,7 @@ func TestNormalization(t *testing.T) {
|
|
func TestNormalizationDarwinCaseFS(t *testing.T) {
|
|
func TestNormalizationDarwinCaseFS(t *testing.T) {
|
|
// This tests that normalization works on Darwin, through a CaseFS.
|
|
// This tests that normalization works on Darwin, through a CaseFS.
|
|
|
|
|
|
- if runtime.GOOS != "darwin" {
|
|
|
|
|
|
+ if !build.IsDarwin {
|
|
t.Skip("Normalization test not possible on non-Darwin")
|
|
t.Skip("Normalization test not possible on non-Darwin")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -321,7 +321,7 @@ func TestIssue1507(_ *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestWalkSymlinkUnix(t *testing.T) {
|
|
func TestWalkSymlinkUnix(t *testing.T) {
|
|
- if runtime.GOOS == "windows" {
|
|
|
|
|
|
+ if build.IsWindows {
|
|
t.Skip("skipping unsupported symlink test")
|
|
t.Skip("skipping unsupported symlink test")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -351,7 +351,7 @@ func TestWalkSymlinkUnix(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestWalkSymlinkWindows(t *testing.T) {
|
|
func TestWalkSymlinkWindows(t *testing.T) {
|
|
- if runtime.GOOS != "windows" {
|
|
|
|
|
|
+ if !build.IsWindows {
|
|
t.Skip("skipping unsupported symlink test")
|
|
t.Skip("skipping unsupported symlink test")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -386,7 +386,7 @@ func TestWalkRootSymlink(t *testing.T) {
|
|
dest, _ := filepath.Abs("testdata/dir1")
|
|
dest, _ := filepath.Abs("testdata/dir1")
|
|
destFs := fs.NewFilesystem(testFsType, dest)
|
|
destFs := fs.NewFilesystem(testFsType, dest)
|
|
if err := fs.DebugSymlinkForTestsOnly(destFs, testFs, ".", "link"); err != nil {
|
|
if err := fs.DebugSymlinkForTestsOnly(destFs, testFs, ".", "link"); err != nil {
|
|
- if runtime.GOOS == "windows" {
|
|
|
|
|
|
+ if build.IsWindows {
|
|
// Probably we require permissions we don't have.
|
|
// Probably we require permissions we don't have.
|
|
t.Skip("Need admin permissions or developer mode to run symlink test on Windows: " + err.Error())
|
|
t.Skip("Need admin permissions or developer mode to run symlink test on Windows: " + err.Error())
|
|
} else {
|
|
} else {
|
|
@@ -406,7 +406,7 @@ func TestWalkRootSymlink(t *testing.T) {
|
|
files = walkDir(testFs, "link", nil, nil, 0)
|
|
files = walkDir(testFs, "link", nil, nil, 0)
|
|
|
|
|
|
// Verify that we got the one symlink, except on windows
|
|
// Verify that we got the one symlink, except on windows
|
|
- if runtime.GOOS == "windows" {
|
|
|
|
|
|
+ if build.IsWindows {
|
|
if len(files) != 0 {
|
|
if len(files) != 0 {
|
|
t.Errorf("expected no files, not %d", len(files))
|
|
t.Errorf("expected no files, not %d", len(files))
|
|
}
|
|
}
|
|
@@ -588,7 +588,7 @@ func TestScanOwnershipPOSIX(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestScanOwnershipWindows(t *testing.T) {
|
|
func TestScanOwnershipWindows(t *testing.T) {
|
|
- if runtime.GOOS != "windows" {
|
|
|
|
|
|
+ if !build.IsWindows {
|
|
t.Skip("This test only works on Windows")
|
|
t.Skip("This test only works on Windows")
|
|
}
|
|
}
|
|
|
|
|