You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Andrew Zhang <zh...@gmail.com> on 2006/07/05 05:18:31 UTC

Re: [classlib][nio] Platform dependent tests in SocketChannelTest

Paulex,

I also noticed there are several platform-dependent behaviours of
FileChannel.

So I can't wait to see the revised test layout. :)

Will you plan to re-layout NIO test structure recently?

Thank you very much!

On 6/29/06, Paulex Yang <pa...@gmail.com> 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: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Re: [classlib][nio] Platform dependent tests in SocketChannelTest

Posted by Paulex Yang <pa...@gmail.com>.
Andrew,

I've raised HARMONY-782, and thanks Mark, the patch has been applied, 
but I must say sorry that it breaks your patch for HARMONY-767(many 
thanks to Mark again, he provided a updated patch for this). Please 
check it can meet your requirement so far.

And FYI, you may interest another thread discussing the TestNG adoption 
proposal, which is related to the test layout convention.

Andrew Zhang wrote:
> Paulex,
>
> I also noticed there are several platform-dependent behaviours of
> FileChannel.
>
> So I can't wait to see the revised test layout. :)
>
> Will you plan to re-layout NIO test structure recently?
>
> Thank you very much!
>
> On 6/29/06, Paulex Yang <pa...@gmail.com> 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: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
>
>


-- 
Paulex Yang
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