public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* Purpose of .net.SocketTest test_BasicServer #12
@ 2003-01-29 21:10 Steve Murry
  2003-01-30  4:38 ` Brian Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Murry @ 2003-01-29 21:10 UTC (permalink / raw)
  To: mauve-discuss

Can someone examine the following testcase in the .net.Socket package and let me know what it is designed to test.  I'm unsure about the garbage collector comment, but it would appear that the purpose of the test is to connect to the local Echo server at port #7, and then test the getInputStream() and getOutputStream() methods.  However, it then expects an IOException, and why I'm not sure.  On some of our unix hosts that I'm using, we *do* get an exception within the test, but the exception is on the 'new Socket("127.0.0.1", 7)' statement because the Echo server wasn't running at the time.  However, in this case the Mauve harness check still reported this test as 'PASS' because of the catch code.  My gut feeling is that the test is not designed to test the Echo server but rather to test the Input and Output methods; however, I'll leave it up to bigger minds to make the final determination.

Thanks for the help

Steve Murry
SAS Institute, Inc. 


    // This test is incorrect.  You cannot rely on System.gc() causing
    // the garbage collector to run.
    try {
      sock = new Socket("127.0.0.1", 7);
      InputStream sin = null;
      OutputStream sout = null;

      // create 10 refs and make sure finalize() is invoked.
      for (int i = 0; i < 10; i++) {
        sin = sock.getInputStream();
        sout = sock.getOutputStream();
      }
      harness.fail("Error : test_BasicServer failed - 12 " +
                   "exception was not thrown");
    }
    catch (IOException e) {
      harness.check(true);
    }
    finally {
      try {
        if (sock != null)
          sock.close();
      } catch(IOException ignored) {}
    }

    // invoke finalize()
    System.gc();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Purpose of .net.SocketTest test_BasicServer #12
  2003-01-29 21:10 Purpose of .net.SocketTest test_BasicServer #12 Steve Murry
@ 2003-01-30  4:38 ` Brian Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Jones @ 2003-01-30  4:38 UTC (permalink / raw)
  To: Steve Murry; +Cc: mauve-discuss

"Steve Murry" <Steve.Murry@sas.com> writes:

> Can someone examine the following testcase in the .net.Socket
> package and let me know what it is designed to test.  

It was a broken test and noted as much though not removed before now.
I've removed it since Sun's JDK thought it was bogus as well.

> Thanks for the help
> 
> Steve Murry
> SAS Institute, Inc. 

No problem.

Brian "lives in Cary not so far from SAS" Jones ;)
-- 
Brian Jones <cbj@gnu.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-30  4:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 21:10 Purpose of .net.SocketTest test_BasicServer #12 Steve Murry
2003-01-30  4:38 ` Brian Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).