[BUG][FIX} Linux 2.8 VM running the Network Unit tests

Rob Withers slosher2 at home.com
Wed Jul 19 03:00:01 UTC 2000


Rob Withers wrote:
> 
> All,
> 
> Here are some subclasses for the Resolver and Socket tests for Unix.  I
> overrode the error code accessor methods and modified a few of the tests
> for getting the localAddress from the socket itself.  I am on 2 networks
> so the NetNameResolver localHostAddress gives me 127.0.0.1 and a
> connected socket, to outside, will respond to #localAddress with my ip
> to the external subnet.  The test for the equality is redundant but the
> test of getting the localAddress isn't, IMHO.
> 
> I included a few fixes of John's base test code.  Load John's test
> changesets
> http://www.smalltalkconsulting.com/papers/tipsAndThoughts/codeFragments.html
> then load the Network-Tests-fix-rww.2.cs followed by
> NetworkTests-Unix.2.cs    SUnit is required of course.


Here is a little update to fix the ping: test.   All Resolver tests
work.  There are 7 failures and 2 errors left in the Socket test and I
hacked around the error code values.  I'm interested to hear the outcome
of that discussion (internal platform table).  Perhaps a list of the
various error codes/exceptions that the Network code can throw would be
of use?  Does the new asynchronous model use exceptions to notify of
error states?

On the failures, there is problem with isOtherEndClosed that will clean
up about half of those problems.

Rob

> Cheers,
> Rob

-- 
--------------------------------------------------
Smalltalking by choice.  Isn't it nice to have one!
-------------- next part --------------
'From Squeak2.8 of 16 July 2000 [latest update: #2348] on 17 July 2000 at 11:39:24 pm'!

!NetworkResolverTest methodsFor: 'testing' stamp: 'rww 7/17/2000 19:15'!
testNameForAddress
	| appleAddress |

	addressString _ self goodNameForAddress: ourLocalHostAddress timeout: self timeOutValue.
	self shouldnt: [addressString isNil].
	self checkStatusOk.

	address _ self goodAddressForName: addressString timeout: self timeOutValue.
	self should: [address = ourLocalHostAddress].
	self checkStatusOk.

	appleAddress _ self goodAddressForName: 'apple.com' timeout: self timeOutValue.
	self shouldnt: [appleAddress isNil].
	self checkStatusOk.

	addressString _ self goodNameForAddress: appleAddress timeout: self timeOutValue.
	self should: [addressString = 'apple.com'].
	self checkStatusOk.

	address _ self goodAddressForName: addressString timeout: self timeOutValue.
	self should: [address = appleAddress].
	self checkStatusOk.

	addressString _ self badNameForAddress: (NetNameResolver addressFromString: '1.2.3.4') timeout: self timeOutValue.
	self checkStatusAddressStringIsBad.
	! !


!NetworkSocketOpenTest methodsFor: 'constants' stamp: 'rww 7/17/2000 23:27'!
timeServerHostName
	^'squeak.cs.uiuc.edu'
! !

-------------- next part --------------
'From Squeak2.8 of 13 June 2000 [latest update: #2348] on 18 July 2000 at 7:36:32 pm'!
Smalltalk renameClassNamed: #NetworkResolverTestOT as: #NetworkResolverTestUnix!
NetworkResolverTest subclass: #NetworkResolverTestUnix
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Network Tests'!

!NetworkResolverTestUnix commentStamp: '<historical>' prior: 0!
SUnit Class to test Squeak Resolver
By: John M McIntosh 
johnmci at smalltalkconsulting.com
www.smalltalkconsulting.com
2000/05/03

v1.0 2000/5/13 seems to work ok for  Open Transport

Note constants about web sites, echo ip etc etc WILL need to change for your site!
NetworkSocketOpenTest subclass: #NetworkSocketOpenTestUnix
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Network Tests'!

!NetworkSocketOpenTestUnix commentStamp: '<historical>' prior: 0!
SUnit Class to test Squeak socket code
By: John M McIntosh 
johnmci at smalltalkconsulting.com
www.smalltalkconsulting.com
2000/05/03
v1.0 2000/5/13 seems to work ok for OT (Open Transport)

Note constants about web sites, echo ip etc etc WILL need to change for your site
This test suite moves megabytes of data and will take a long time to run.
!

!NetworkResolverTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:13'!
badResolverErrorBadAddress
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-23045 is MacTCP value
	-3150 is Mac Open Transport value"

	^ 4

! !

!NetworkResolverTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:10'!
badResolverErrorNoData
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-3162 is Mac Open Transport value"

	^ 1

! !

!NetworkResolverTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:10'!
badResolverErrorNoSuchName
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-23045 is MacTCP value
	-3170 is Mac Open Transport value"

	^ 1

! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'rww 7/18/2000 15:48'!
testAbortLookup
	self lookupDisney.
	address _ self takesAShortAmountOfTime: [NetNameResolver addressForName: 'www.disney.jp' timeout: 0].
	self should: [address isNil].	
	self checkStatusAddressIsBad! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'rww 7/18/2000 15:48'!
testAddressForName
	self lookupDisney.
	address _ self badAddressForName: 'www.disney' timeout: self timeOutValue.
	self checkStatusAddressIsBad.
	self lookupDisney.
	address _ self badAddressForName: 'www.disney.' timeout: self timeOutValue.
	self checkStatusAddressIsBad.
	self lookupDisney.
	address _ self badAddressForName: 'www.' timeout: self timeOutValue.
	self checkStatusAddressIsBad.
	self lookupDisney.
	address _ self goodAddressForName: (NetNameResolver stringFromAddress: disneyAddress)  timeout: self timeOutValue.
	self should: [disneyAddress = address].	
	self checkStatusOk.
	self lookupDisney.
	address _ self badAddressForName: '' timeout: self timeOutValue.
	self should: [address isNil].	
	self should: [NetNameResolver resolverError = self badResolverErrorBadAddress].
	self should: [NetNameResolver resolverStatus = 3]. "Resolver Error"

! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:09'!
testAddressFromString
	super testAddressFromString! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:03'!
testErrorAndStatus
	super testErrorAndStatus
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:03'!
testHaveNetwork
	super testHaveNetwork
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:04'!
testLocalAddressString
	super testLocalAddressString
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:04'!
testLocalHostNameAndAddress
	super testLocalHostNameAndAddress
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:04'!
testNameForAddress
	super testNameForAddress
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:04'!
testResolverSemaphore
	super testResolverSemaphore
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:05'!
testStringFromAddress
	super testStringFromAddress
! !

!NetworkResolverTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 19:05'!
testpromptUserForHostAddress
	super testpromptUserForHostAddress
! !


!NetworkSocketOpenTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:04'!
badResolverErrorNoSuchName
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-23045 is MacTCP value
	-3170 is Mac Open Transport value"

	^ 1

! !

!NetworkSocketOpenTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:20'!
badSocketNoConnection
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-23008 is MacTCP value
	-3256 is Mac Open Transport value"

	^ 0
! !

!NetworkSocketOpenTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 15:39'!
badSocketNotInOrder
	"This is the macintosh specific OT error code, other platforms will have 
	different numbers
	-23008 is MacTCP value
	-3155 is Mac Open Transport value"

	^ 0
! !

!NetworkSocketOpenTestUnix methodsFor: 'constants' stamp: 'rww 7/18/2000 19:36'!
mailHostName
	^'katie.vnet.net'! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:32'!
testCheckHttpPortLogic
	super testCheckHttpPortLogic! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:43'!
testCheckNetworkConnected
	super testCheckNetworkConnected! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:43'!
testCheckNetworkInitialized
	super testCheckNetworkInitialized! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/19/2000 20:17'!
testCheckSocketUtilities
	super testCheckSocketUtilities! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 18:58'!
testLoopBack
	^super testLoopBack! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:44'!
testNilPeerName
	super testNilPeerName! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'rww 7/18/2000 15:50'!
testSocketGetData
	| serverAddr sock firstString firstStringSize secondString |
	Socket initializeNetwork.
	serverAddr _ NetNameResolver addressForName: self mailHostName timeout: self timeOutValue.
	self checkStatusOk.

	sock _ Socket new.
	self checkUnconnectedSocket: sock.
	sock connectTo: serverAddr port: 25.
	self checkConnectedSocket: sock toAddress: serverAddr toPort: 25 fromAddress: sock localAddress fromPort: sock localPort.
	firstString _ String new: 0.
	firstStringSize _ sock readInto: firstString startingAt: 1.
	self should: [firstString = '' and: [firstString size = 0]].
	self should: [firstStringSize = 0].
	firstString _ String new: 1.
	firstStringSize _ sock readInto: firstString startingAt: 1.
	self should: [firstString = '2' and: [firstString size = 1]].
	self should: [firstStringSize = 1].
	self should: [sock dataAvailable].
	secondString _ sock getData.
	self should: [firstString,secondString = self expectedSMTPString].
	sock closeAndDestroy.
	self shouldnt: [sock isValid].
	self should: [sock statusString = 'destroyed'].
! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'rww 7/18/2000 15:50'!
testSocketGetDataFailure
	| serverAddr sock |
	Socket initializeNetwork.
	serverAddr _ NetNameResolver addressForName: self httpHostName timeout: self timeOutValue.
	self checkStatusOk.

	sock _ Socket new.
	self checkUnconnectedSocket: sock.
	sock connectTo: serverAddr port: 80.
	self checkConnectedSocket: sock toAddress: serverAddr toPort: 80 fromAddress: sock localAddress fromPort: sock localPort.
	self takesALongAmountOfTime: [sock waitForDataUntil: (Socket deadlineSecs: self timeOutValue)].
	self shouldnt: [sock dataAvailable].
	sock closeAndDestroy.
	self shouldnt: [sock isValid].
	self should: [sock statusString = 'destroyed'].
! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'rww 7/18/2000 15:50'!
testSocketGetDataWaitCheck
	| serverAddr sock |
	Socket initializeNetwork.
	serverAddr _ NetNameResolver addressForName: self mailHostName timeout: self timeOutValue.
	self checkStatusOk.

	sock _ Socket new.
	self checkUnconnectedSocket: sock.
	sock connectTo: serverAddr port: 25.
	self checkConnectedSocket: sock toAddress: serverAddr toPort: 25 fromAddress: sock localAddress fromPort: sock localPort.
	self takesAShortAmountOfTime: [sock waitForDataUntil: (Socket deadlineSecs: self timeOutValue)].
	self should: [sock dataAvailable].
	sock closeAndDestroy.
	self shouldnt: [sock isValid].
	self should: [sock statusString = 'destroyed'].
! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 20:32'!
testSocketListenAccept
	super testSocketListenAccept! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:44'!
testSocketOpenClose
	super testSocketOpenClose! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/14/2000 17:47'!
testSocketOpenListen
	super testSocketOpenListen! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/14/2000 18:34'!
testSocketOpenListenXferData
	super testSocketOpenListenXferData! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/19/2000 18:25'!
testSocketOpenListenXferDataToEchoPort
	super testSocketOpenListenXferDataToEchoPort! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/21/2000 11:31'!
testSocketOpenListenXferDataToEchoPortUDP
	super testSocketOpenListenXferDataToEchoPortUDP! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/10/2000 23:44'!
testSocketOutOfOrderErrors
	super testSocketOutOfOrderErrors! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 20:33'!
testSocketSendSomeData
	super testSocketSendSomeData! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 6/3/2000 20:33'!
testSocketdiscardReceivedData
	super testSocketdiscardReceivedData! !

!NetworkSocketOpenTestUnix methodsFor: 'testing' stamp: 'JMM 5/19/2000 20:33'!
testUDPGetTime
	super testUDPGetTime! !



More information about the Squeak-dev mailing list