Paulex, Great!
Thank you very much ! Best regards, Andrew On 6/29/06, Paulex Yang <[EMAIL PROTECTED]> 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. 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, >> >> > > -- Paulex Yang China Software Development Lab IBM --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Andrew Zhang China Software Development Lab, IBM