| 1 | package receiver_testscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 6 | "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/" |
| 7 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | |
| 11 | "github.com/gokrazy/rsync/internal/rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/" |
| 12 | "github.com/gokrazy/rsync/internal/testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/" |
| 13 | ) |
| 14 | |
| 15 | func TestDaemonReceiverSyncscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/TestDaemonReceiverSync().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 16 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 17 | |
| 18 | rsyncBin := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.TridgeOrGTFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TridgeOrGTFO().(t, "TODO: reason") |
| 19 | |
| 20 | tmp := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 21 | source := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "source") |
| 22 | dest := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "dest") |
| 23 | destLarge := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, "large-data-file") |
| 24 | |
| 25 | headPattern := []byte{0x11} |
| 26 | bodyPattern := []byte{0xbb} |
| 27 | endPattern := []byte{0xee} |
| 28 | rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WriteLargeDataFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WriteLargeDataFile().(t, source, headPattern, bodyPattern, endPattern) |
| 29 | |
| 30 | // start a server which receives data |
| 31 | srv := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/New().(t, rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WritableInteropModulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WritableInteropModule().(dest)) |
| 32 | |
| 33 | rsync := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().(rsyncBin, |
| 34 | // "--debug=all4", |
| 35 | "--archive", |
| 36 | // A verbosity level of 3 is enough, any higher than that and rsync |
| 37 | // will start listing individual chunk matches. |
| 38 | "-v", "-v", "-v", // "-v", |
| 39 | "--port="+srv.Portscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TestServer#Port., |
| 40 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(source)+"/", // copy contents of source (relative to rsync.Dir) |
| 41 | "rsync://localhost/interop/") |
| 42 | rsync.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(source) |
| 43 | rsync.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = append(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().(), |
| 44 | // Ensure rsync does not localize decimal separators and fractional |
| 45 | // points based on the current locale: |
| 46 | "LANG=C.UTF-8") |
| 47 | rsync.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 48 | rsync.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 49 | if err := rsync.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().(); err != nil { |
| 50 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%v: %v", rsync.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., err) |
| 51 | } |
| 52 | |
| 53 | if err := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.DataFileMatchesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/DataFileMatches().(destLarge, headPattern, bodyPattern, endPattern); err != nil { |
| 54 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // like TestDaemonReceiverSync, but specifying a destination path that is a subdirectory |
| 59 | // within the module. |
| 60 | func TestDaemonReceiverSyncSubdirscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/TestDaemonReceiverSyncSubdir().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 61 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 62 | |
| 63 | rsyncBin := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.TridgeOrGTFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TridgeOrGTFO().(t, "TODO: reason") |
| 64 | |
| 65 | tests := []struct { |
| 66 | name string |
| 67 | destPath string |
| 68 | rsyncTarget string |
| 69 | }{ |
| 70 | { |
| 71 | name: "simple subdir", |
| 72 | destPath: "destsubdir", |
| 73 | rsyncTarget: "rsync://localhost/interop/destsubdir/", |
| 74 | }, |
| 75 | { |
| 76 | name: "nested subdir", |
| 77 | destPath: "subdir/destsubdir", |
| 78 | rsyncTarget: "rsync://localhost/interop/subdir/destsubdir/", |
| 79 | }, |
| 80 | } |
| 81 | |
| 82 | for _, tt := range tests { |
| 83 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 84 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 85 | |
| 86 | tmp := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 87 | source := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "source") |
| 88 | dest := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "dest") |
| 89 | destLarge := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, tt.destPath, "large-data-file") |
| 90 | |
| 91 | headPattern := []byte{0x11} |
| 92 | bodyPattern := []byte{0xbb} |
| 93 | endPattern := []byte{0xee} |
| 94 | rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WriteLargeDataFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WriteLargeDataFile().(t, source, headPattern, bodyPattern, endPattern) |
| 95 | |
| 96 | // start a server which receives data |
| 97 | srv := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/New().(t, rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WritableInteropModulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WritableInteropModule().(dest)) |
| 98 | |
| 99 | rsync := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().(rsyncBin, |
| 100 | // "--debug=all4", |
| 101 | "--archive", |
| 102 | // A verbosity level of 3 is enough, any higher than that and rsync |
| 103 | // will start listing individual chunk matches. |
| 104 | "-v", "-v", "-v", // "-v", |
| 105 | "--port="+srv.Portscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TestServer#Port., |
| 106 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(source)+"/", // copy contents of source (relative to rsync.Dir) |
| 107 | tt.rsyncTarget) |
| 108 | rsync.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(source) |
| 109 | rsync.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = append(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().(), |
| 110 | // Ensure rsync does not localize decimal separators and fractional |
| 111 | // points based on the current locale: |
| 112 | "LANG=C.UTF-8") |
| 113 | rsync.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 114 | rsync.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 115 | if err := rsync.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().(); err != nil { |
| 116 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%v: %v", rsync.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., err) |
| 117 | } |
| 118 | |
| 119 | if err := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.DataFileMatchesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/DataFileMatches().(destLarge, headPattern, bodyPattern, endPattern); err != nil { |
| 120 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 121 | } |
| 122 | }) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | // like TestDaemonReceiverSync, but specifying a destination path that is a subdirectory |
| 127 | // within the module. |
| 128 | func TestDaemonReceiverSyncSubdirTraversalscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/TestDaemonReceiverSyncSubdirTraversal().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 129 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 130 | |
| 131 | rsyncBin := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.TridgeOrGTFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TridgeOrGTFO().(t, "TODO: reason") |
| 132 | |
| 133 | tests := []struct { |
| 134 | name string |
| 135 | destPath string |
| 136 | rsyncTarget string |
| 137 | }{ |
| 138 | { |
| 139 | name: "simple subdir", |
| 140 | destPath: "destsubdir", |
| 141 | rsyncTarget: "rsync://localhost/interop/../", |
| 142 | }, |
| 143 | { |
| 144 | name: "nested subdir", |
| 145 | destPath: "subdir/destsubdir", |
| 146 | rsyncTarget: "rsync://localhost/interop/subdir/../../", |
| 147 | }, |
| 148 | } |
| 149 | |
| 150 | for _, tt := range tests { |
| 151 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 152 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 153 | |
| 154 | tmp := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 155 | source := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "source") |
| 156 | dest := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "dest") |
| 157 | destLarge := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, tt.destPath, "large-data-file") |
| 158 | |
| 159 | headPattern := []byte{0x11} |
| 160 | bodyPattern := []byte{0xbb} |
| 161 | endPattern := []byte{0xee} |
| 162 | rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WriteLargeDataFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WriteLargeDataFile().(t, source, headPattern, bodyPattern, endPattern) |
| 163 | |
| 164 | // start a server which receives data |
| 165 | srv := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/New().(t, rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WritableInteropModulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WritableInteropModule().(dest)) |
| 166 | |
| 167 | rsync := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().(rsyncBin, |
| 168 | // "--debug=all4", |
| 169 | "--archive", |
| 170 | // A verbosity level of 3 is enough, any higher than that and rsync |
| 171 | // will start listing individual chunk matches. |
| 172 | "-v", "-v", "-v", // "-v", |
| 173 | "--port="+srv.Portscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TestServer#Port., |
| 174 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(source)+"/", // copy contents of source (relative to rsync.Dir) |
| 175 | tt.rsyncTarget) |
| 176 | rsync.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(source) |
| 177 | rsync.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = append(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().(), |
| 178 | // Ensure rsync does not localize decimal separators and fractional |
| 179 | // points based on the current locale: |
| 180 | "LANG=C.UTF-8") |
| 181 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 182 | rsync.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = &buf |
| 183 | rsync.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = &buf |
| 184 | if err := rsync.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().(); err != nil { |
| 185 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), "path escapes from parent") { |
| 186 | return |
| 187 | } |
| 188 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%v: %v", rsync.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., err) |
| 189 | } |
| 190 | |
| 191 | if err := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.DataFileMatchesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/DataFileMatches().(destLarge, headPattern, bodyPattern, endPattern); err != nil { |
| 192 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 193 | } |
| 194 | }) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | func TestDaemonReceiverDeletescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/TestDaemonReceiverDelete().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 199 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 200 | |
| 201 | rsyncBin := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.TridgeOrGTFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TridgeOrGTFO().(t, "TODO: reason") |
| 202 | |
| 203 | tmp := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 204 | source := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "source") |
| 205 | dest := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "dest") |
| 206 | destLarge := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, "large-data-file") |
| 207 | |
| 208 | headPattern := []byte{0x11} |
| 209 | bodyPattern := []byte{0xbb} |
| 210 | endPattern := []byte{0xee} |
| 211 | rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WriteLargeDataFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WriteLargeDataFile().(t, source, headPattern, bodyPattern, endPattern) |
| 212 | |
| 213 | // start a server which receives data |
| 214 | srv := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/New().(t, rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WritableInteropModulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WritableInteropModule().(dest)) |
| 215 | |
| 216 | run := func() { |
| 217 | rsync := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().(rsyncBin, |
| 218 | // "--debug=all4", |
| 219 | "--archive", |
| 220 | "--delete", |
| 221 | // A verbosity level of 3 is enough, any higher than that and rsync |
| 222 | // will start listing individual chunk matches. |
| 223 | "-v", "-v", "-v", // "-v", |
| 224 | "--port="+srv.Portscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TestServer#Port., |
| 225 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(source)+"/", // copy contents of source (relative to rsync.Dir) |
| 226 | "rsync://localhost/interop/") |
| 227 | rsync.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(source) |
| 228 | rsync.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = append(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().(), |
| 229 | // Ensure rsync does not localize decimal separators and fractional |
| 230 | // points based on the current locale: |
| 231 | "LANG=C.UTF-8") |
| 232 | rsync.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 233 | rsync.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = testloggerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/testlogger`/New().(t) |
| 234 | if err := rsync.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().(); err != nil { |
| 235 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%v: %v", rsync.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., err) |
| 236 | } |
| 237 | } |
| 238 | run() |
| 239 | |
| 240 | if err := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.DataFileMatchesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/DataFileMatches().(destLarge, headPattern, bodyPattern, endPattern); err != nil { |
| 241 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 242 | } |
| 243 | |
| 244 | // Add more files to the destination, which should be deleted: |
| 245 | extra := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, "extrafile") |
| 246 | if err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.WriteFilescip-go gomod github.com/golang/go/src go1.25.0 os/WriteFile().(extra, []byte("deleteme"), 0644); err != nil { |
| 247 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 248 | } |
| 249 | run() |
| 250 | if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(extra); !osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { |
| 251 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("expected %s to be deleted, but it still exists", extra) |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | func TestDaemonReceiverSyncHardLinksscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/integration/receiver_test`/TestDaemonReceiverSyncHardLinks().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 256 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 257 | |
| 258 | rsyncBin := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.TridgeOrGTFOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TridgeOrGTFO().(t, "TODO: reason") |
| 259 | |
| 260 | tmp := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 261 | source := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "source") |
| 262 | dest := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tmp, "dest") |
| 263 | destLarge := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dest, "large-data-file") |
| 264 | |
| 265 | headPattern := []byte{0x11} |
| 266 | bodyPattern := []byte{0xbb} |
| 267 | endPattern := []byte{0xee} |
| 268 | rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WriteLargeDataFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WriteLargeDataFile().(t, source, headPattern, bodyPattern, endPattern) |
| 269 | |
| 270 | // start a server which receives data |
| 271 | srv := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.Newscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/New().(t, rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.WritableInteropModulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/WritableInteropModule().(dest)) |
| 272 | |
| 273 | rsync := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().(rsyncBin, |
| 274 | // "--debug=all4", |
| 275 | "--archive", |
| 276 | "--hard-links", |
| 277 | // A verbosity level of 3 is enough, any higher than that and rsync |
| 278 | // will start listing individual chunk matches. |
| 279 | "-v", "-v", "-v", // "-v", |
| 280 | "--port="+srv.Portscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/TestServer#Port., |
| 281 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(source)+"/", // copy contents of source (relative to rsync.Dir) |
| 282 | "rsync://localhost/interop/") |
| 283 | rsync.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(source) |
| 284 | rsync.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = append(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().(), |
| 285 | // Ensure rsync does not localize decimal separators and fractional |
| 286 | // points based on the current locale: |
| 287 | "LANG=C.UTF-8") |
| 288 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 289 | rsync.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = &buf |
| 290 | rsync.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = &buf |
| 291 | if err := rsync.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().(); err != nil { |
| 292 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), "gokr-rsync [receiver]: support for hard links not yet implemented") { |
| 293 | return |
| 294 | } |
| 295 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%v: %v", rsync.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., err) |
| 296 | } |
| 297 | |
| 298 | if err := rsynctestscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/.DataFileMatchesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsynctest`/DataFileMatches().(destLarge, headPattern, bodyPattern, endPattern); err != nil { |
| 299 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 300 | } |
| 301 | } |