Skip to content

Commit a0eef90

Browse files
committed
More options
1 parent 4855fb4 commit a0eef90

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/ElasticsearchTestBasePluginFuncTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
5454
then:
5555
result.task(':test').outcome == TaskOutcome.SUCCESS
5656

57+
when:
58+
result = gradleRunner("test", "-Dtests.jvm.argline=-disableassertions").build()
59+
then:
60+
result.task(':test').outcome == TaskOutcome.SUCCESS
61+
5762
when:
5863
result = gradleRunner("test", "-Dtests.asserts=false", "-Dtests.jvm.argline=-da").build()
5964
then:

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ public void execute(Task t) {
138138
}
139139

140140
// Check if "tests.asserts" is false or "tests.jvm.argline" contains the "-da" flag.
141-
boolean enableAssertions = Util.getBooleanProperty("tests.asserts", true) && (argline == null || !argline.contains("-da"));
141+
boolean enableAssertions = Util.getBooleanProperty("tests.asserts", true)
142+
&& (argline == null || argline.contains("-da") == false || argline.contains("-disableassertions") == false);
142143

143144
test.setEnableAssertions(enableAssertions);
144145
Map<String, String> sysprops = Map.of(

0 commit comments

Comments
 (0)