summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Kowalczewski <tkowalczewski@voltdb.com>2023-01-04 16:08:03 +0100
committerJaikiran Pai <jaikiran@apache.org>2023-04-18 12:50:53 +0530
commit8fb54871b93fb62aa597a8094561bfa8977e5aba (patch)
treed6bff96007941fd35da1216b06d8e7c7bb60d05e
parentd29f62fcc2d263878c1b53fc10d9bd4b9dbc8377 (diff)
downloadant-8fb54871b93fb62aa597a8094561bfa8977e5aba.tar.gz
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
-rw-r--r--CONTRIBUTORS1
-rw-r--r--WHATSNEW4
-rw-r--r--contributors.xml4
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java15
4 files changed, 23 insertions, 1 deletions
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
@@ -1855,6 +1855,10 @@
<last>Bech</last>
</name>
<name>
+ <first>Tomasz</first>
+ <last>Kowalczewski</last>
+ </name>
+ <name>
<first>Tomáš</first>
<last>Zezula</last>
</name>
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.");
+ }
+ }
}
}
}