harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv" <firep...@gmail.com>
Subject Re: [classlib][nio] Platform dependent tests in SocketChannelTest
Date Fri, 30 Jun 2006 01:12:38 GMT
Paulex Yang wrote:
> If no one objects, I'm volunteer to re-layout the nio module's test 
> according to our test convention proposal to accommodate the platform 
> dependent tests.
> 
+1 :)

> Jimmy, Jing Lv wrote:
>> Andrew Zhang wrote:
>>> Hello everybody,
>>>
>>> I noticed there are 8 FIXMEs in SocketChannelTest, which are mainly 
>>> caused
>>> by platform differences.
>>>
>>> Take following FIXME as example:
>>>
>>>
>>>    public void testCFII_ServerStartLater_NonBlock() throws Exception {
>>>        // ensure
>>>        ensureServerClosed();
>>>        this.channel1.configureBlocking(false);
>>>        statusNotConnected_NotPending();
>>>        // connect
>>>        assertFalse(this.channel1.connect(localAddr1));
>>>        statusNotConnected_Pending();
>>>
>>>        ensureServerOpen();
>>>
>>>        try {
>>>            assertFalse(this.channel1.finishConnect());
>>>            statusNotConnected_Pending();
>>>            this.channel1.close();
>>>        } catch (ConnectException e) {
>>>            // FIXME: assertEquals(e.getMessage(), "Connection refused");
>>>        }
>>>    }
>>> The process of this test looks like:
>>> client socket connect (server is closed) -> open server -> 
>>> finishConnect .
>>>
>>> RI acts differently on windows and Linux:
>>> On windows, finishConnect returns false.
>>> On Linux, finishConnect throws ConnectException instead of returning 
>>> false.
>>>
>>> and Harmony acts the exactly SAME as RI.
>>>
>>
>> Deeply trace into Harmony code, I find it is the difference of 
>> windows/Linux system call. In both platform the test try to call a 
>> select to detect whether connected, however the return value differs, 
>> (Linux return a value means "connect refused" ,which cause a 
>> exception). I believe Harmony is correct in code as it behaves the 
>> same as RI.
>>
>> Maybe the testcase shall be refactored, I remember there's discussion 
>> on mailing but draw no good conclusion, though there are 3 idea about 
>> platform dependent testcase in my memory:
>> 1. add it to platform dependent list, like Harmony's exclude list, run 
>> only on certain platform. Is it Mark or George's idea?
>> 2. check platform in the testcase and run, e.g., check system property 
>> "OS.name". But it seems a bad practice;
>> 3. remove them all until we find a better way.
>> IMO, the first way suggests here is reasonable, but need a 
>> modification on build.xml. Otherwise let's remove them until we find a 
>> better way.
>>
>> However it is very interesting, Java says it "build once, run 
>> everywhere", but it does not always appear the same in the same 
>> operation :)
>>
>>> Could anyone give some suggestions on such platform dependent tests?
>>> Remove them? or other solutions?
>>>
>>> Personally,  I prefer to remove these tests.
>>> Any suggestions are highly appreciated!
>>>
>>> Thanks!
>>>
>>> Best regards,
>>>
>>>
>>
>>
> 
> 


-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message