From d827cab2cf66ec5cfabe586ef4402cc400800f76 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 30 Dec 2023 23:07:53 +0100 Subject: [PATCH] [SUREFIRE-2225] Surefire ITs fail when project directory contains space This closes #705 --- .../apache/maven/surefire/its/fixture/SurefireLauncher.java | 5 +++++ surefire-its/src/test/resources/junit47-parallel/pom.xml | 2 +- .../testng-740-parallel-without-threadcount/pom.xml | 2 +- surefire-its/src/test/resources/testng-740-parallel/pom.xml | 2 +- surefire-its/src/test/resources/testng-simple/pom.xml | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java index 148a689fa8..37cf93a964 100755 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java @@ -79,7 +79,12 @@ private List getInitialGoals() { goals.add("-Dsurefire.version=" + surefireVersion); + String jacocoAgent = System.getProperty("jacoco.agent", ""); + // Remove unnecessary backslash escaping for Windows, see https://github.com/jacoco/jacoco/issues/1559 + jacocoAgent = jacocoAgent.replace("\\\\", "\\"); + // Remove quotes which will cause us syntax error with cmd.exe because of quoe escaping + jacocoAgent = jacocoAgent.replace("\"", ""); goals.add("-Djacoco.agent=" + jacocoAgent); goals.add("-nsu"); diff --git a/surefire-its/src/test/resources/junit47-parallel/pom.xml b/surefire-its/src/test/resources/junit47-parallel/pom.xml index e9d6a6caac..ac04eedd37 100644 --- a/surefire-its/src/test/resources/junit47-parallel/pom.xml +++ b/surefire-its/src/test/resources/junit47-parallel/pom.xml @@ -62,7 +62,7 @@ maven-surefire-plugin - ${argLine} ${jacoco.agent} + ${argLine} "${jacoco.agent}" diff --git a/surefire-its/src/test/resources/testng-740-parallel-without-threadcount/pom.xml b/surefire-its/src/test/resources/testng-740-parallel-without-threadcount/pom.xml index 216efb5a3c..8d4fd22033 100644 --- a/surefire-its/src/test/resources/testng-740-parallel-without-threadcount/pom.xml +++ b/surefire-its/src/test/resources/testng-740-parallel-without-threadcount/pom.xml @@ -43,7 +43,7 @@ maven-surefire-plugin ${surefire.version} - ${argLine} ${jacoco.agent} + ${argLine} "${jacoco.agent}" methods diff --git a/surefire-its/src/test/resources/testng-740-parallel/pom.xml b/surefire-its/src/test/resources/testng-740-parallel/pom.xml index bc39aae81d..867d6adb21 100644 --- a/surefire-its/src/test/resources/testng-740-parallel/pom.xml +++ b/surefire-its/src/test/resources/testng-740-parallel/pom.xml @@ -43,7 +43,7 @@ maven-surefire-plugin ${surefire.version} - ${argLine} ${jacoco.agent} + ${argLine} "${jacoco.agent}" methods 10 diff --git a/surefire-its/src/test/resources/testng-simple/pom.xml b/surefire-its/src/test/resources/testng-simple/pom.xml index 427c713e0e..cace78a2eb 100644 --- a/surefire-its/src/test/resources/testng-simple/pom.xml +++ b/surefire-its/src/test/resources/testng-simple/pom.xml @@ -87,7 +87,7 @@ maven-surefire-plugin ${surefire.version} - ${argLine} ${jacoco.agent} + ${argLine} "${jacoco.agent}" reversealphabetical