diff --git a/build/scripts/common_tests.gant b/build/scripts/common_tests.gant index 34aa1914a9e6..1512bf21f679 100644 --- a/build/scripts/common_tests.gant +++ b/build/scripts/common_tests.gant @@ -35,9 +35,9 @@ target(compile: "Compile project") { } } -private pass(String prop) { +private pass(List args, String prop) { if (isDefined(prop)) { - ant.jvmarg(value: "-D$prop=${p(prop)}") + args << "-D$prop=${p(prop)}" } } @@ -49,29 +49,36 @@ target('run_tests': 'Run java tests') { new File(classpathFile).text = testRuntimeClasspath.findAll({ new File((String)it).exists() }).join('\n') testcases.each { testCase -> + List jvmArgs = [ + "-Dclasspath.file=${classpathFile}", + "-Didea.platform.prefix=Idea", + "-Dbootstrap.testcases=$testCase" + ] + + [ + "idea.test.group", + "idea.test.patterns", + "idea.fast.only", + "idea.coverage.enabled.build", + "teamcity.build.tempDir", + "teamcity.tests.recentlyFailedTests.file" + ].each { pass(jvmArgs, it) } + + System.getProperties().entrySet().each { + if (it.key.startsWith("pass.")) { + def trimmed = it.key.substring("pass.".length()); + jvmArgs << "-D${trimmed}=${it.value}" + }; + } + jvmArgs.addAll(commonJvmArgsForTests()) + if (isDefined("jvm_args")) { + jvmArgs.addAll(jvm_args) + } + + projectBuilder.info("Starting JUnit $testCase, JVM options: $jvmArgs") ant.junit(fork: "yes", showoutput: "true", logfailedtests: false) { - jvmarg(value: "-Dclasspath.file=${classpathFile}") - pass("idea.test.group") - pass("idea.test.patterns") - pass("idea.fast.only") - pass("idea.coverage.enabled.build") - pass("teamcity.build.tempDir") - pass("teamcity.tests.recentlyFailedTests.file") - jvmarg(value: "-Didea.platform.prefix=Idea") - - System.getProperties().entrySet().each { - if (it.key.startsWith("pass.")) { - def trimmed = it.key.substring("pass.".length()); - jvmarg(value: "-D${trimmed}=${it.value}"); - }; - } - - commonJvmArgsForTests().each { jvmarg(value: it) } - - jvmarg(value: "-Dbootstrap.testcases=$testCase") - - if (isDefined("jvm_args")) { - jvm_args.each { jvmarg(value: it) } + jvmArgs.each { + jvmarg(value: it) } classpath {