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

michaelo pushed a commit to branch SUREFIRE-2225
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 4eb0fd5aec588c6fc83705561cceadc64afec7f7
Author: Michael Osipov <micha...@apache.org>
AuthorDate: Sat Dec 30 23:07:53 2023 +0100

    [SUREFIRE-2225] Surefire ITs fail when project directory contains space
    
    This closes #705
---
 .../java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java  | 4 ++++
 surefire-its/src/test/resources/junit47-parallel/pom.xml              | 2 +-
 .../test/resources/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, 8 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 148a689fa..2df39a478 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
@@ -80,6 +80,10 @@ public final class SurefireLauncher {
         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 a syntax error raised by cmd.exe 
because of quote 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 e9d6a6caa..ac04eedd3 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 @@
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <argLine>${argLine} ${jacoco.agent}</argLine>
+          <argLine>${argLine} "${jacoco.agent}"</argLine>
         </configuration>
       </plugin>
     </plugins>
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 216efb5a3..8d4fd2203 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 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>${surefire.version}</version>
                 <configuration>
-                    <argLine>${argLine} ${jacoco.agent}</argLine>
+                    <argLine>${argLine} "${jacoco.agent}"</argLine>
                     <parallel>methods</parallel>
                     <properties>
                         <property>
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 bc39aae81..867d6adb2 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 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>${surefire.version}</version>
                 <configuration>
-                    <argLine>${argLine} ${jacoco.agent}</argLine>
+                    <argLine>${argLine} "${jacoco.agent}"</argLine>
                     <parallel>methods</parallel>
                     <threadCount>10</threadCount>
                     <properties>
diff --git a/surefire-its/src/test/resources/testng-simple/pom.xml 
b/surefire-its/src/test/resources/testng-simple/pom.xml
index 427c713e0..cace78a2e 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 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <version>${surefire.version}</version>
         <configuration>
-          <argLine>${argLine} ${jacoco.agent}</argLine>
+          <argLine>${argLine} "${jacoco.agent}"</argLine>
           <runOrder>reversealphabetical</runOrder>
           <properties>
             <property>

Reply via email to