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/08/16 10:23:05 UTC

[classlib][luni] How to deal with host-dependent tests?

Hi folks,

When I take a look at excluded tests in luni module, I found there are some
tests which are dependent on system host files, i.e. SocketPermissionTest.
Consider following test:
public void test_equalsLjava_lang_Object_subtest0() {
  SocketPermission sp1 = new SocketPermission(
    Support_Configuration.InetAlias1, "resolve,connect");
  SocketPermission sp2 = new SocketPermission(
    Support_Configuration.InetAlias2, "resolve,connect");
  assertTrue("Same IP address should be equal", sp1.equals(sp2));
}
InetAlias1 and InetAlias2 should be configured correctly in system host file
before running test. And I don't have any idea how to automate these steps.
Any way to solve this problem? by specifying a host file when starting up
tests or writing java code in setup?

If we can find solution, I agree that it's reasonable to remain these tests.
Otherwise, I suggest remove them from unit test, either by deleting them,
or commenting them, or marking with certain annotation (TestNG works again.
:) )

Suggestions? Thanks!

Best regards,

-- 
Andrew Zhang
China Software Development Lab, IBM