Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Vic <vikrantp@xxxxxxxxx>
- Date: Tue, 10 Mar 2009 08:41:25 -0700 (PDT)
On Mar 9, 4:49 pm, "Matt Humphrey" <ma...@xxxxxxxx> wrote:
"Vic" <vikra...@xxxxxxxxx> wrote in message
news:9dbde3a1-605a-4816-9d2a-77c48a2de197@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
To give you guys an idea about the way we run automation is
we do jloader -v <version> >&! out/<log file>
So jloader basically calls LoaderAutomationRun.java (starts the loop)
and calls LoaderTestcase.java in the loop for each test case and
inside LoaderTestcase.java it runs the commands using
NewCommandExecuter.
I just looked a thte out/<log file> and it just shows something like
this ->
TESTCASE Transaction836
Start generation all loader files
DEBUG: validating(transaction/*
DEBUG: NEW load order transaction/1,
DEBUG: FINAL NEW load order transaction/1,
Executing generateLoaderFile(transaction/1, 0)
dTrans: null
Executing generateLoaderFile, adding Transaction836.0.lrd
LOADER FILES CREATED 1
DEBUG: Created 1 loader files
New Command Executer: EXECUTING
COMMAND: /home/qauser/620currentLOADER/
bin/loader -u genevaman -w qa -f Transaction836.0.lrd
As you can see the last line, the New Command Executer never returned.
Sorry to bother you guys but I really want to get this solved soon so
any help on this would be appreciated. Thanks in advance
Ok, so what you're observing is that diagnostic line "ExitValue for Command"
does not appear in the output, but you still haven't shown the loop code or
said what you mean by "never returned" Now that we understand the previous
problem, we know that if the test returns null the loop will exit and your
main program will still stop without any messages. This new case, however,
looks like the test process itself never finishes and the test driver does
not stop. Is that the case? You need to say more about what that loop is
and does.
If your test driver is hanging, I'd guess that the test process itself is
faulty. Perhaps it's requesting input or just plain stuck. If your test
driver is halting, the answer will be in how it halts. It may fail if New
Command Executer throws an exception prior to waitFor. It's not clear that
stderr exceptions are appearing in your output and we know that the null
will cause your main to halt with no messages.
Lew also mentioned one possible case by which the StreamGobbler's assignment
of the result field in its own thread is not visible to the driver thread
because of the lack of synchronization. Put the keyword "volatile" on the
String result declaration in StreamGobbler to fix this.
Matt Humphreyhttp://www.iviz.com/
Thanks for the reply as I mentioned earlier jloader.java calls ->
LoaderAutomationRun.java
constructor -> public jloader(Vector vTestcasesList, int count) {
LoaderAutomationRun myLoaderAutomationRun = new
LoaderAutomationRun("Loader",count);
myLoaderAutomationRun.run (vTestcasesList,count);
System.exit(0);
}
public static void main (String args[]) {
Automation setupAutomation = new Automation();
jloader myAutomation;
parseCommandLineArguments (args, "loader");
else {
//0 is specified for the Standard Loader
myAutomation = new jloader(vTestcasesList, 0);
}
}
and the loop inside LoaderAutomationRun.java which calls
LoaderTestcase.java and looks like this ->
for (int i = 0; i < vTestcasesList.size(); i++) {
sTestcaseName = vTestcasesList.elementAt(i).toString();
iExpected++;
iRan++;
System.out.println("\nTESTCASE "+sTestcaseName);
//VicP- copying the testcase name
LoaderTestcase.sTestcaseNameTemp = sTestcaseName;
//
//VicP - Transaction324 is working now to commenting out :(
if(sTestcaseName.equals("Transaction324"))
continue;
try {
myTC = new LoaderTestcase(sTestcaseName);
myTC.run();
bPassed = true;
} catch (Exception e) {
iDiffs++;
String exceptionFileName = results_log_dir + sTestcaseName +
".exception";
// save exception to log file
try {
Automation.writeStringToFile (exceptionFileName,
Automation.getStackTrace(e));
System.err.println ("\n\nTESTCASE "+sTestcaseName+" FAILED
\n"+Automation.getStackTrace(e)+"Exception saved to file
'"+exceptionFileName+"'\n*** TESTCASE END\n");
} catch (Exception ex) {
System.err.println("Exception occured while trying to write
to file '"+exceptionFileName+"'\n"+Automation.getStackTrace(ex));
}
bPassed = false;
}
System.err.println("EXP:" +iExpected+" RAN:"+iRan+"
DIFF:"+iDiffs);
System.out.println("TESTCASE "+sTestcaseName
+"\n----------------------");
if (bPassed)
System.err.println("->PASSED");
else
System.err.println("->FAILED");
System.err.println("\n\n\n\n\n\n\n");
}
myTC.run() funcation in LoaderTestcase.java above calls
NewCommandExecuter.java to execute the command
what I meant by never returns is that the automation stops/gets killed
either in jloader.java, LoaderAutomationRun.java or while executing
NewcommandExecuter (not sure which one is causing the automation to
quit in the middle of the run). As you mentioned there could be
something wrong with jloader.java which gets killed somehow
thanks in advance
.
- Follow-Ups:
- References:
- Issue implementing Runtime.exec() with StreamGobbler
- From: Vic
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Robert Klemme
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Vic
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Matt Humphrey
- Issue implementing Runtime.exec() with StreamGobbler
- Prev by Date: Re: ONE ARRAYLIST IN MANY CLASSES QUESTION
- Next by Date: Re: Why doesn't ArrayDeque implement the List interface?
- Previous by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Next by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Index(es):
Relevant Pages
|