[Pkg] The Trunk: NetworkTests-dtl.33.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Nov 3 18:17:55 UTC 2012


David T. Lewis uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-dtl.33.mcz

==================== Summary ====================

Name: NetworkTests-dtl.33
Author: dtl
Time: 3 November 2012, 2:17:02.043 pm
UUID: 3071c11f-8cef-43a2-b1b8-88c573ef9daf
Ancestors: NetworkTests-ul.32

Fix SocketTest>>testSendTimeout to accommodate platform differences.

Explanation: #sendDone means that the platform is reporting a send operation complete. The platform may or may not be able to accept addition write requests while sending is in process, depending on the buffering capability of the underlying platform. On Windows, the next write request fails immediately if a prior send is not complete, while unix platforms may be able to accept and buffer additional writes. Therefore change the test to expect a timeout exception to eventually occur, but not necessary on the next write operation.

=============== Diff against NetworkTests-ul.32 ===============

Item was changed:
  ----- Method: SocketTest>>testSendTimeout (in category 'tests') -----
  testSendTimeout
  	"Test data transfer and related methods"
  
+ 	| buffer ex |
- 	| buffer |
  	self testServerAccept.
  	buffer := ByteArray new: 1000.
+ 
+ 	"Write to the socket until the platform reports that sending is not complete."
  	[serverSocket sendDone] whileTrue:[
  		serverSocket sendSomeData: buffer.
  	].
+ 
+ 	"The network layer is now either blocked or in the process of sending data in its buffers.
+ 	It may or may not be able buffer additional write requests, depending on the platform
+ 	implemention. Keep sending data until the network reports that it is unable to process
+ 	the request, at which time a exception will be raised. On Windows, the exception will
+ 	be raised on the next write request, while unix platforms may provide additional buffering
+ 	that permit write requests to continue being accepted."
+ 	ex := nil.
+ 	[[serverSocket sendSomeData: buffer startIndex: 1 count: buffer size for: 1]
+ 		on: ConnectionTimedOut
+ 		do: [ :e | ex := e ].
+ 	ex isNil] whileTrue: [].
+ 	self assert: ex notNil.
- 	self should:[serverSocket sendSomeData: buffer startIndex: 1 count: buffer size for: 1]
- 		raise: ConnectionTimedOut.
  !



More information about the Packages mailing list