diff options
author | Audrius Butkevicius <audrius.butkevicius@gmail.com> | 2017-03-07 12:44:16 +0000 |
---|---|---|
committer | Jakob Borg <jakob@kastelo.net> | 2017-03-07 12:44:16 +0000 |
commit | 0da0774ce4eb5ac9e338dcb21f568e6f07e2101a (patch) | |
tree | a3fe94ae8cf8f67cac7b0bcfa29c56862e670de3 /test | |
parent | 151004d645550046b6518ca0e5ca9281d495612a (diff) | |
download | syncthing-0da0774ce4eb5ac9e338dcb21f568e6f07e2101a.tar.gz syncthing-0da0774ce4eb5ac9e338dcb21f568e6f07e2101a.zip |
lib/connections: Add KCP support (fixes #804)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3489
Diffstat (limited to 'test')
-rw-r--r-- | test/h1/config.xml | 13 | ||||
-rw-r--r-- | test/h2/config.xml | 8 | ||||
-rw-r--r-- | test/transfer-bench_test.go | 24 | ||||
-rw-r--r-- | test/usage_unix.go | 30 | ||||
-rw-r--r-- | test/usage_windows.go | 28 |
5 files changed, 70 insertions, 33 deletions
diff --git a/test/h1/config.xml b/test/h1/config.xml index f221cb186..65556d1c5 100644 --- a/test/h1/config.xml +++ b/test/h1/config.xml @@ -36,19 +36,19 @@ <disableTempIndexes>false</disableTempIndexes> </folder> <device id="EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK" name="s4" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22004</address> + <address>kcp://127.0.0.1:22004</address> </device> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22001</address> + <address>kcp://127.0.0.1:22001</address> </device> <device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" name="s2" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22002</address> + <address>kcp://127.0.0.1:22002</address> </device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" name="s3" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22003</address> + <address>kcp://127.0.0.1:22003</address> </device> <device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" name="s4" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22004</address> + <address>kcp://127.0.0.1:22004</address> </device> <gui enabled="true" tls="false" debugging="true"> <address>127.0.0.1:8081</address> @@ -58,8 +58,7 @@ <theme>default</theme> </gui> <options> - <listenAddress>dynamic+https://relays.syncthing.net/endpoint</listenAddress> - <listenAddress>tcp://127.0.0.1:22001</listenAddress> + <listenAddress>kcp://127.0.0.1:22001</listenAddress> <globalAnnounceServer>default</globalAnnounceServer> <globalAnnounceEnabled>false</globalAnnounceEnabled> <localAnnounceEnabled>true</localAnnounceEnabled> diff --git a/test/h2/config.xml b/test/h2/config.xml index c688583fd..5aabb7df2 100644 --- a/test/h2/config.xml +++ b/test/h2/config.xml @@ -55,13 +55,13 @@ <disableWeakHash>false</disableWeakHash> </folder> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22001</address> + <address>kcp://127.0.0.1:22001</address> </device> <device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" name="s2" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22002</address> + <address>kcp://127.0.0.1:22002</address> </device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" name="s3" compression="metadata" introducer="false"> - <address>tcp://127.0.0.1:22003</address> + <address>kcp://127.0.0.1:22003</address> </device> <gui enabled="true" tls="false" debugging="true"> <address>127.0.0.1:8082</address> @@ -70,7 +70,7 @@ </gui> <options> <listenAddress>dynamic+https://relays.syncthing.net/endpoint</listenAddress> - <listenAddress>tcp://127.0.0.1:22002</listenAddress> + <listenAddress>kcp://127.0.0.1:22002</listenAddress> <globalAnnounceServer>default</globalAnnounceServer> <globalAnnounceEnabled>false</globalAnnounceEnabled> <localAnnounceEnabled>true</localAnnounceEnabled> diff --git a/test/transfer-bench_test.go b/test/transfer-bench_test.go index 5a5d05cfe..b79f3a35c 100644 --- a/test/transfer-bench_test.go +++ b/test/transfer-bench_test.go @@ -11,8 +11,6 @@ package integration import ( "log" "os" - "runtime" - "syscall" "testing" "time" ) @@ -142,24 +140,6 @@ loop: log.Println("Result: Wall time:", t1.Sub(t0)) log.Printf("Result: %.1f MiB/s synced", float64(total)/1024/1024/t1.Sub(t0).Seconds()) - if rusage, ok := recvProc.SysUsage().(*syscall.Rusage); ok { - log.Println("Receiver: Utime:", time.Duration(rusage.Utime.Nano())) - log.Println("Receiver: Stime:", time.Duration(rusage.Stime.Nano())) - if runtime.GOOS == "darwin" { - // Darwin reports in bytes, Linux seems to report in KiB even - // though the manpage says otherwise. - rusage.Maxrss /= 1024 - } - log.Println("Receiver: MaxRSS:", rusage.Maxrss, "KiB") - } - if rusage, ok := sendProc.SysUsage().(*syscall.Rusage); ok { - log.Println("Sender: Utime:", time.Duration(rusage.Utime.Nano())) - log.Println("Sender: Stime:", time.Duration(rusage.Stime.Nano())) - if runtime.GOOS == "darwin" { - // Darwin reports in bytes, Linux seems to report in KiB even - // though the manpage says otherwise. - rusage.Maxrss /= 1024 - } - log.Println("Sender: MaxRSS:", rusage.Maxrss, "KiB") - } + printUsage("Receiver", recvProc) + printUsage("Sender", sendProc) } diff --git a/test/usage_unix.go b/test/usage_unix.go new file mode 100644 index 000000000..efb70db3f --- /dev/null +++ b/test/usage_unix.go @@ -0,0 +1,30 @@ +// Copyright (C) 2014 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// +build integration,benchmark,!windows + +package integration + +import ( + "log" + "os" + "runtime" + "syscall" + "time" +) + +func printUsage(name string, proc *os.ProcessState) { + if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok { + log.Printf("%s: Utime: %s", name, time.Duration(rusage.Utime.Nano())) + log.Printf("%s: Stime: %s", name, time.Duration(rusage.Stime.Nano())) + if runtime.GOOS == "darwin" { + // Darwin reports in bytes, Linux seems to report in KiB even + // though the manpage says otherwise. + rusage.Maxrss /= 1024 + } + log.Printf("%s: MaxRSS: %d KiB", name, rusage.Maxrss) + } +} diff --git a/test/usage_windows.go b/test/usage_windows.go new file mode 100644 index 000000000..6dfbb2fa8 --- /dev/null +++ b/test/usage_windows.go @@ -0,0 +1,28 @@ +// Copyright (C) 2014 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// +build integration,benchmark,windows + +package integration + +import ( + "log" + "os" + "syscall" + "time" +) + +func ftToDuration(ft *syscall.Filetime) time.Duration { + n := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) // in 100-nanosecond intervals + return time.Duration(n*100) * time.Nanosecond +} + +func printUsage(name string, proc *os.ProcessState) { + if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok { + log.Printf("%s: Utime: %s", name, ftToDuration(&rusage.UserTime)) + log.Printf("%s: Stime: %s", name, ftToDuration(&rusage.KernelTime)) + } +} |