This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 8fb54871b bz-66411: Handling forked VM timeout in a similar way as 
failed test so that settings like haltonfailure have effect This closes #197 
pull request at github.com/apache/ant
8fb54871b is described below

commit 8fb54871b93fb62aa597a8094561bfa8977e5aba
Author: Tomasz Kowalczewski <[email protected]>
AuthorDate: Wed Jan 4 16:08:03 2023 +0100

    bz-66411: Handling forked VM timeout in a similar way as failed test so 
that settings like haltonfailure have effect
    This closes #197 pull request at github.com/apache/ant
---
 CONTRIBUTORS                                              |  1 +
 WHATSNEW                                                  |  4 ++++
 contributors.xml                                          |  4 ++++
 .../junitlauncher/confined/JUnitLauncherTask.java         | 15 ++++++++++++++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index f93d2e229..e6dd80888 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -450,6 +450,7 @@ Tom Dimock
 Tom Eugelink
 Tom May
 Tomasz Bech
+Tomasz Kowalczewski
 Tomáš Zezula
 Tony Gravagno
 Trejkaz Xaoza
diff --git a/WHATSNEW b/WHATSNEW
index 7c80e8926..eb9d38b6b 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -29,6 +29,10 @@ Fixed bugs:
    file permissions of the files they modify.
    Bugzilla Report 66522
 
+ * junitlauncher task would fail if a forked test timed out even
+   if haltOnFailure was set to false. This is now fixed.
+   Bugzilla Report 66411
+
 Other changes:
 --------------
 
diff --git a/contributors.xml b/contributors.xml
index ce78271ac..759b45dc7 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -1854,6 +1854,10 @@
     <first>Tomasz</first>
     <last>Bech</last>
   </name>
+  <name>
+    <first>Tomasz</first>
+    <last>Kowalczewski</last>
+  </name>
   <name>
     <first>Tomáš</first>
     <last>Zezula</last>
diff --git 
a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
 
b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
index dbe8a1f3a..c7440cf96 100644
--- 
a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
+++ 
b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
@@ -330,7 +330,20 @@ public class JUnitLauncherTask extends Task {
                 break;
             }
             case Constants.FORK_EXIT_CODE_TIMED_OUT: {
-                throw new BuildException(new TimeoutException("Forked test(s) 
timed out"));
+                // test has failure(s)
+                try {
+                    if (test.getFailureProperty() != null) {
+                        // if there are test failures and the test is 
configured to set a property in case
+                        // of failure, then set the property to true
+                        
this.getProject().setNewProperty(test.getFailureProperty(), "true");
+                    }
+                } finally {
+                    if (test.isHaltOnFailure()) {
+                        throw new BuildException(new TimeoutException("Forked 
test(s) timed out"));
+                    } else {
+                        log("Timeout occurred. Please note the time in the 
report does not reflect the time until the timeout.");
+                    }
+                }
             }
         }
     }

Reply via email to