Browse Source

this time, this test really behaves well !!!

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274968 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
3efe482d70
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java

+ 6
- 1
src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java View File

@@ -106,6 +106,7 @@ public class ExecTaskTest extends BuildFileTest {
myBuild.addBuildListener(new MonitoredBuildListener()); myBuild.addBuildListener(new MonitoredBuildListener());
myBuild.start(); myBuild.start();
GregorianCalendar startwait = new GregorianCalendar(); GregorianCalendar startwait = new GregorianCalendar();
// this loop runs parallel to the build
while (!buildFinished) { while (!buildFinished) {
try { try {
Thread.sleep(10); Thread.sleep(10);
@@ -115,9 +116,11 @@ public class ExecTaskTest extends BuildFileTest {
GregorianCalendar now = new GregorianCalendar(); GregorianCalendar now = new GregorianCalendar();
// security // security
if (now.getTimeInMillis() - startwait.getTimeInMillis() > MAX_BUILD_TIME) { if (now.getTimeInMillis() - startwait.getTimeInMillis() > MAX_BUILD_TIME) {
System.out.println("aborting wait, too long " + (now.getTimeInMillis() - startwait.getTimeInMillis()) + "milliseconds");
break; break;
} }
} }
// now wait until the spawned process is finished
try { try {
Thread.sleep((TIME_TO_WAIT) * 1000 + SECURITY_MARGIN); Thread.sleep((TIME_TO_WAIT) * 1000 + SECURITY_MARGIN);
} catch (InterruptedException e) { } catch (InterruptedException e) {
@@ -199,13 +202,15 @@ public class ExecTaskTest extends BuildFileTest {
} }


public void buildFinished(BuildEvent event) { public void buildFinished(BuildEvent event) {
buildFinished = true;
} }


public void targetStarted(BuildEvent event) { public void targetStarted(BuildEvent event) {
} }


public void targetFinished(BuildEvent event) { public void targetFinished(BuildEvent event) {
if (event.getTarget().getName().equals("spawn")) {
buildFinished = true;
}
} }


public void taskStarted(BuildEvent event) { public void taskStarted(BuildEvent event) {


Loading…
Cancel
Save