On 25/08/2012 21:16, Dmitry Samersoff wrote:
:
The test sends couple of jcmd commands to the single server process.
jcmd do attach, call, detach for each command. So I have to keep server
running for some time.

  Server process with just while(true) sleep(1); would run forever if
test  doesn't kill it for some reason - it's why I use busy code.

So I'm open for any advice here.

-Dmitry

Our tests need to be very reliable and fast to be useful. With this one then I'm concerned that this busy code is going to hog a core on busy machines and just run too quickly on fast machines (although looking at the code I assume Quicksort(data,1000,0); will cause it to immediately barf so I don't think it actual runs).

If I were writing this test then I would control the target process via a socket connection. That way you can instruct it to shutdown when required. You'll see an example in java/nio/channels/AsynchronousFileChannel/Lock.java. Closer to your home then com/sun/tools/attach/BasicTests.sh also uses the socket connection to shutdown the "application". The other thing I would do is re-write as much as the test in java as possible, just to keep it portable and easier to maintain. I realize there is a slight complication here in that you need the pid but otherwise I don't see any reason to use a shell test.

-Alan

Reply via email to