[Pkg] The Trunk: NetworkTests-dtl.34.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Nov 15 05:06:05 UTC 2012
David T. Lewis uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-dtl.34.mcz
==================== Summary ====================
Name: NetworkTests-dtl.34
Author: dtl
Time: 15 November 2012, 12:05:37.979 am
UUID: 661c04dd-3386-4424-aa92-944ad27fa74a
Ancestors: NetworkTests-dtl.33
SocketTest>>testSocketReuse will fail on platforms that do not implement the SO_REUSEPORT socket option. Update the test comment to explain this, and provide assertions that identify the cause of the failure.
Note that failure on setting SO_REUSEPORT reflects a limitation of the underlying platform network support, and does not indicate an error in Squeak networking.
=============== Diff against NetworkTests-dtl.33 ===============
Item was changed:
----- Method: SocketTest>>testSocketReuse (in category 'tests') -----
testSocketReuse
+ "Test for SO_REUSEADDR/SO_REUSEPORT. Test will fail if the platform does
+ not implement these socket options. Support for SO_REUSEPORT is not
+ present on many systems, and a failure on setting this socket option reflects
+ a limitation of the underlying platform."
- "Test for SO_REUSEADDR/SO_REUSEPORT"
| address port udp1 send1 udp2 recv2 sendProc recvProc received |
address := #[255 255 255 255]. "broadcast"
port := 31259.
[
udp1 := Socket newUDP.
+ self assert: (udp1 setOption: 'SO_REUSEADDR' value: 1) notNil
+ description: 'SO_REUSEADDR not supported'.
+ self assert: (udp1 setOption: 'SO_REUSEPORT' value: 1) notNil
+ description: 'SO_REUSEPORT not supported'.
- udp1 setOption: 'SO_REUSEADDR' value: 1.
- udp1 setOption: 'SO_REUSEPORT' value: 1.
udp1 setPort: port.
+ self assert: (udp1 setOption: 'SO_BROADCAST' value: 1) notNil
+ description: 'SO_BROADCAST not supported'.
- udp1 setOption: 'SO_BROADCAST' value: 1.
send1 := UUID new.
udp2 := Socket newUDP.
+ self assert: (udp2 setOption: 'SO_REUSEADDR' value: 1) notNil
+ description: 'SO_REUSEADDR not supported'.
+ self assert: (udp2 setOption: 'SO_REUSEPORT' value: 1) notNil
+ description: 'SO_REUSEPORT not supported'.
- udp2 setOption: 'SO_REUSEADDR' value: 1.
- udp2 setOption: 'SO_REUSEPORT' value: 1.
udp2 setPort: port.
+ self assert: (udp2 setOption: 'SO_BROADCAST' value: 1) notNil
+ description: 'SO_BROADCAST not supported'.
- udp2 setOption: 'SO_BROADCAST' value: 1.
recv2 := UUID new.
received := 0.
recvProc := [
[received < 16] whileTrue:[
received := received + (udp2 receiveDataInto: recv2 startingAt: received + 1).
]
] fork.
sendProc := [
udp1 setPeer: address port: port.
udp1 sendData: send1 count: 16.
] fork.
(Delay forMilliseconds: 200) wait.
self should: [recvProc isTerminated].
self should: [sendProc isTerminated].
self should: [send1 = recv2].
] ensure:[
+ udp1 ifNotNilDo: [:s | s destroy].
+ udp2 ifNotNilDo: [:s | s destroy].
- udp1 destroy.
- udp2 destroy.
].
!
More information about the Packages
mailing list