diff --git a/test/common_test.go b/test/common_test.go index 1474d6f0..2b480a01 100644 --- a/test/common_test.go +++ b/test/common_test.go @@ -48,10 +48,8 @@ const ( var env = []string{ "HOME=.", - "STTRACE=model,protocol", "STGUIAPIKEY=" + apiKey, "STNORESTART=1", - "STPERFSTATS=1", } type syncthingProcess struct { @@ -78,7 +76,7 @@ func (p *syncthingProcess) start() error { cmd := exec.Command("../bin/syncthing", p.argv...) cmd.Stdout = p.logfd cmd.Stderr = p.logfd - cmd.Env = append(env, fmt.Sprintf("STPROFILER=:%d", p.port+1000)) + cmd.Env = append(os.Environ(), env...) err := cmd.Start() if err != nil { @@ -97,7 +95,7 @@ func (p *syncthingProcess) start() error { } func (p *syncthingProcess) stop() error { - p.cmd.Process.Signal(os.Interrupt) + p.cmd.Process.Signal(os.Kill) p.cmd.Wait() fd, err := os.Open(p.log) @@ -320,6 +318,16 @@ func (i *inifiteReader) Read(bs []byte) (int, error) { // rm -rf func removeAll(dirs ...string) error { for _, dir := range dirs { + // Set any non-writeable files and dirs to writeable. This is necessary for os.RemoveAll to work on Windows. + filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.Mode()&0700 != 0700 { + os.Chmod(path, 0777) + } + return nil + }) os.RemoveAll(dir) } return nil diff --git a/test/reconnect_test.go b/test/reconnect_test.go index 04ac3dc0..bf62855d 100644 --- a/test/reconnect_test.go +++ b/test/reconnect_test.go @@ -81,7 +81,8 @@ func testRestartDuringTransfer(t *testing.T, restartSender, restartReceiver bool for { comp, err := sender.peerCompletion() if err != nil { - if strings.Contains(err.Error(), "use of closed network connection") { + if strings.Contains(err.Error(), "use of closed network connection") || + strings.Contains(err.Error(), "request cancelled while waiting") { time.Sleep(250 * time.Millisecond) continue } diff --git a/test/symlink_test.go b/test/symlink_test.go index 025e4fa9..edece4fc 100644 --- a/test/symlink_test.go +++ b/test/symlink_test.go @@ -18,8 +18,10 @@ package integration_test import ( + "io/ioutil" "log" "os" + "path/filepath" "strings" "testing" "time" @@ -29,7 +31,21 @@ import ( "github.com/syncthing/syncthing/internal/symlinks" ) +func symlinksSupported() bool { + tmp, err := ioutil.TempDir("", "symlink-test") + if err != nil { + return false + } + defer os.RemoveAll(tmp) + err = os.Symlink("tmp", filepath.Join(tmp, "link")) + return err == nil +} + func TestSymlinks(t *testing.T) { + if !symlinksSupported() { + t.Skip("symlinks unsupported") + } + // Use no versioning id, _ := protocol.DeviceIDFromString(id2) cfg, _ := config.Load("h2/config.xml", id) @@ -42,6 +58,10 @@ func TestSymlinks(t *testing.T) { } func TestSymlinksSimpleVersioning(t *testing.T) { + if !symlinksSupported() { + t.Skip("symlinks unsupported") + } + // Use no versioning id, _ := protocol.DeviceIDFromString(id2) cfg, _ := config.Load("h2/config.xml", id) @@ -57,6 +77,10 @@ func TestSymlinksSimpleVersioning(t *testing.T) { } func TestSymlinksStaggeredVersioning(t *testing.T) { + if !symlinksSupported() { + t.Skip("symlinks unsupported") + } + // Use no versioning id, _ := protocol.DeviceIDFromString(id2) cfg, _ := config.Load("h2/config.xml", id)