Commit Graph

39 Commits

Author SHA1 Message Date
Dave Cheney 167ae32ca7 Handle osx returning EPERM not ENOTDIR
Fixes #57

Also fix the integration tests to run on darwin by default.
2015-12-22 13:34:21 +09:00
DrJosh9000 f76972fd8d rm extra f.Name in test 2015-09-25 18:17:46 +10:00
Josh Deprez a003aa966d Add test for new Name method 2015-09-25 18:05:59 +10:00
Mark Sheahan d80ae36051 rmdir and symlink packet handling 2015-09-07 01:05:16 -07:00
Mark Sheahan 7bb2083ca9 Address review comments; about to change decodePacket() 2015-09-06 23:55:15 -07:00
Mark Sheahan 0d8e136458 removing sftp server to client layer; using straight os.* calls 2015-09-06 19:36:47 -07:00
Mark Sheahan 348ee1a469 truncate + darwin VFS test 2015-08-04 22:21:35 -07:00
Mark Sheahan 2f3ef8b897 Merge branch 'master' into server 2015-08-04 21:11:01 -07:00
Mark Sheahan f4c4138a0e update client integration tests for more coverage 2015-08-04 20:47:26 -07:00
Mark Sheahan 0f2bc1aa17 server is passing the client integration tests now. I don't understand the ATTRs field, it has a name in it. 2015-07-31 23:09:51 -07:00
Mark Sheahan 435f753792 readdir, rename, remove 2015-07-31 15:46:13 -07:00
Mark Sheahan 2888b4a6b1 implement read 2015-07-29 17:24:24 -07:00
Dave Cheney 587af18cfc Fix integration tests on darwin 2015-07-15 16:36:15 -07:00
Dave Cheney c1748e2776 Fix typo in slice creation.
Fixes #43
2015-06-15 20:12:08 +10:00
Glenn Griffin 29600148e4 Handle recvPacket in a single goroutine.
Previously recvPacket would be invoked in several goroutines. This meant
that when multiple concurrent requests were in flight there were N
goroutines each waiting on recvPacket. For optimal throughput the goal
is to send a new request as quickly as possible once a response is
received. The previous mechanism worked counter to this because the
goroutine sending new requests would be competing against N recvPacket
goroutines that may become runnable as data streams in. Having a single
goroutine responsible for recvPacket means that the recv and send
goroutines will ping-pong back and forth optimizing throughput.

This changes shows a ~10-25% increase in throughput in the the *Delay*
benchmark tests.

$ go test -bench=. -integration
PASS
BenchmarkRead1k	       2	 840068631 ns/op	  12.48 MB/s
BenchmarkRead16k	      20	  72968548 ns/op	 143.70 MB/s
BenchmarkRead32k	      30	  56871347 ns/op	 184.38 MB/s
BenchmarkRead128k	     100	  34150953 ns/op	 307.05 MB/s
BenchmarkRead512k	     100	  15730685 ns/op	 666.59 MB/s
BenchmarkRead1MiB	     200	  10462421 ns/op	1002.24 MB/s
BenchmarkRead4MiB	     200	   7325236 ns/op	1431.47 MB/s
BenchmarkRead4MiBDelay10Msec	      10	 186893765 ns/op	  56.11 MB/s
BenchmarkRead4MiBDelay50Msec	       2	 907127114 ns/op	  11.56 MB/s
BenchmarkRead4MiBDelay150Msec	       1	2708025060 ns/op	   3.87 MB/s
BenchmarkWrite1k	       1	1623940932 ns/op	   6.46 MB/s
BenchmarkWrite16k	      10	 174293843 ns/op	  60.16 MB/s
BenchmarkWrite32k	      10	 120377272 ns/op	  87.11 MB/s
BenchmarkWrite128k	      20	  54592205 ns/op	 192.08 MB/s
BenchmarkWrite512k	      50	  66449591 ns/op	 157.80 MB/s
BenchmarkWrite1MiB	      50	  70965660 ns/op	 147.76 MB/s
BenchmarkWrite4MiB	      50	  69234861 ns/op	 151.45 MB/s
BenchmarkWrite4MiBDelay10Msec	       5	 276624260 ns/op	  37.91 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	1318396552 ns/op	   7.95 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	3918416658 ns/op	   2.68 MB/s
BenchmarkCopyDown10MiBDelay10Msec	      10	 152240808 ns/op	  68.88 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       2	 715003188 ns/op	  14.67 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	2116878801 ns/op	   4.95 MB/s
BenchmarkCopyUp10MiBDelay10Msec	      10	 192748258 ns/op	  54.40 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       2	 691486538 ns/op	  15.16 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	1997162991 ns/op	   5.25 MB/s
BenchmarkMarshalInit	 2000000	       644 ns/op
BenchmarkMarshalOpen	 3000000	       562 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     75166 ns/op
BenchmarkMarshalWrite1k	  500000	      3862 ns/op
ok  	github.com/pkg/sftp	71.174s
2015-06-02 13:13:32 -07:00
Glenn Griffin fdbec907ff Add integration tests that measure how throughput varies with latency.
This clearly shows the impact high latency networks have on the
throughput of sftp transfers. The current benchmark results on my
machine are:

$ go test -bench=. -integration
PASS
BenchmarkRead1k	      20	  93028268 ns/op	 112.72 MB/s
BenchmarkRead16k	     100	  14912438 ns/op	 703.16 MB/s
BenchmarkRead32k	     100	  12282661 ns/op	 853.71 MB/s
BenchmarkRead128k	     100	  10550935 ns/op	 993.83 MB/s
BenchmarkRead512k	     100	  12970518 ns/op	 808.44 MB/s
BenchmarkRead1MiB	     100	  11526693 ns/op	 909.70 MB/s
BenchmarkRead4MiB	     100	  15761135 ns/op	 665.30 MB/s
BenchmarkRead4MiBDelay10Msec	       1	2662626928 ns/op	   3.94 MB/s
BenchmarkRead4MiBDelay50Msec	       1	12977334971 ns/op	   0.81 MB/s
BenchmarkRead4MiBDelay150Msec	       1	38777294968 ns/op	   0.27 MB/s
BenchmarkWrite1k	       5	 235318220 ns/op	  44.56 MB/s
BenchmarkWrite16k	      50	  57347520 ns/op	 182.85 MB/s
BenchmarkWrite32k	      30	  66151560 ns/op	 158.51 MB/s
BenchmarkWrite128k	      20	  86642733 ns/op	 121.02 MB/s
BenchmarkWrite512k	      20	  72648883 ns/op	 144.34 MB/s
BenchmarkWrite1MiB	      20	  87145317 ns/op	 120.33 MB/s
BenchmarkWrite4MiB	      50	  64098344 ns/op	 163.59 MB/s
BenchmarkWrite4MiBDelay10Msec	       1	3360676836 ns/op	   3.12 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	16321294488 ns/op	   0.64 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	48731747397 ns/op	   0.22 MB/s
BenchmarkCopyDown10MiBDelay10Msec	       1	3369680836 ns/op	   3.11 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       1	16228310257 ns/op	   0.65 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	48505306499 ns/op	   0.22 MB/s
BenchmarkCopyUp10MiBDelay10Msec	       1	3393474907 ns/op	   3.09 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       1	16273951972 ns/op	   0.64 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	48461724780 ns/op	   0.22 MB/s
BenchmarkMarshalInit	 2000000	       779 ns/op
BenchmarkMarshalOpen	 2000000	       645 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     70954 ns/op
BenchmarkMarshalWrite1k	  300000	      5072 ns/op
ok  	github.com/pkg/sftp	296.179s
2015-06-02 10:48:10 -07:00
Dave Cheney 50631306d7 Push c.mu.Lock/Unlock down to sendRequest
Also includes gofmt cleanups
2015-05-23 17:10:22 +10:00
Maximilian Pachl 267a179e16 added integration test for client.StatVFS 2015-05-16 00:54:02 +02:00
Alexander Neumann c70639c68b Add benchmarks for Read() and Write() 2014-10-09 20:29:58 +02:00
Alexander Neumann 5af3cfa4ea Add sftp.NewClientPipe()
This method returns a Client from a pair of pipes.  This can be used for
connecting to an SFTP server over TCP/TLS or by using the system's ssh
client program (e.g. via exec.Command).

An Example function is added, and the client integration test uses the
function.
2014-09-30 00:49:01 +02:00
Alexander Neumann c01862b019 Add integration test flag for sftp binary path 2014-09-29 23:36:14 +02:00
Alexander Neumann 47028b98ef Run gofmt on client_integration_test.go 2014-09-29 23:36:13 +02:00
Dave Cheney f881033388 missed one MarshalBinary func 2014-09-28 12:52:54 +10:00
Dave Cheney 9ad0511df9 Added integration tests for all the MarshalBinary impls. 2014-09-28 12:48:54 +10:00
Sean Treadway b5d9767c0a Consistent puncutation, names and constants
* European sentence punctuation, consistent with package docs
  * Match os.SEEK_* constants instead of numeric constants from io.Seeker
  * Consistent (shorter) receiver name for quickcheck value
2014-06-13 10:22:04 +02:00
Sean Treadway 68aec0278e Implement io.Seeker for *sftp.File
Test that reads at the seeked offset of sftp.File are consistent with
the reads of offset of os.File for the same file.

Error conditions and undefined seeks are not tested.
2014-06-11 21:17:53 +02:00
Dave Cheney b8aa2fe3d1 Fixed Read, removed ReadAt
ReadAt should be replaced by Seek when the fs interface provides it.
2013-11-15 22:04:14 +11:00
Dave Cheney fd27263026 Added hashing check 2013-11-15 21:47:28 +11:00
Dave Cheney 7af199b09e Added more comprehensive read test 2013-11-15 21:17:11 +11:00
Dave Cheney 4d6ea4f122 Added OpenFile support
Close #3
2013-11-14 15:32:21 +11:00
Dave Cheney 31b82445b2 Switched back to kr/fs 2013-11-11 12:57:03 +11:00
Dave Cheney b45014c025 Added ReadAt tests 2013-11-08 22:11:02 +11:00
Dave Cheney 216912b085 Added Client.sendRequest, and more tests 2013-11-08 21:56:25 +11:00
Dave Cheney d4d73b4a58 Added better walk tests 2013-11-08 21:24:50 +11:00
Dave Cheney a54570ce91 Added Write tests 2013-11-08 21:00:26 +11:00
Dave Cheney 0a82d462b2 more integration tests 2013-11-06 19:29:59 +11:00
Dave Cheney 44d7769a0d added File.Stat/fstat coverage 2013-11-06 16:03:08 +11:00
Dave Cheney fc1d4adce0 more integration tests 2013-11-06 15:53:14 +11:00
Dave Cheney ec6ff9e634 Initial integration tests 2013-11-06 15:40:35 +11:00