You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2021/05/09 09:45:17 UTC

[maven-surefire] branch master updated (c61d874 -> e9e5193)

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

tibordigana pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.


    from c61d874  Update JaCoCo Version to 0.8.7
     new dceea49  [SUREFIRE-1912] user.dir should not be set lazily within the surefire fork JVM
     new e9e5193  [SUREFIRE-1913] system properties should be restored after the in-process tests have been executed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../plugin/surefire/AbstractSurefireMojo.java      | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

[maven-surefire] 02/02: [SUREFIRE-1913] system properties should be restored after the in-process tests have been executed

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e9e5193feee08230e934f5f0fbdc8f69eda0fb0c
Author: tibordigana <ti...@gmail.com>
AuthorDate: Sat May 8 23:33:46 2021 +0200

    [SUREFIRE-1913] system properties should be restored after the in-process tests have been executed
---
 .../maven/plugin/surefire/AbstractSurefireMojo.java      | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index d95c6a5..5109fde 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1302,11 +1302,19 @@ public abstract class AbstractSurefireMojo
 
         if ( isNotForking() )
         {
-            createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();
+            Properties originalSystemProperties = (Properties) System.getProperties().clone();
+            try
+            {
+                createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();
 
-            InPluginVMSurefireStarter surefireStarter = createInprocessStarter( provider, classLoaderConfiguration,
-                    runOrderParameters, scanResult, platform, testClasspathWrapper );
-            return surefireStarter.runSuitesInProcess( scanResult );
+                InPluginVMSurefireStarter surefireStarter = createInprocessStarter( provider, classLoaderConfiguration,
+                        runOrderParameters, scanResult, platform, testClasspathWrapper );
+                return surefireStarter.runSuitesInProcess( scanResult );
+            }
+            finally
+            {
+                System.setProperties( originalSystemProperties );
+            }
         }
         else
         {

[maven-surefire] 01/02: [SUREFIRE-1912] user.dir should not be set lazily within the surefire fork JVM

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dceea49f62582a2a2820a5fe72e22d65c45f23ed
Author: tibordigana <ti...@gmail.com>
AuthorDate: Tue May 4 21:54:02 2021 +0200

    [SUREFIRE-1912] user.dir should not be set lazily within the surefire fork JVM
---
 .../org/apache/maven/plugin/surefire/AbstractSurefireMojo.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 18cfa72..d95c6a5 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1222,7 +1222,6 @@ public abstract class AbstractSurefireMojo
                                                              getUserProperties(), sysProps );
 
         result.setProperty( "basedir", getBasedir().getAbsolutePath() );
-        result.setProperty( "user.dir", getWorkingDirectory().getAbsolutePath() );
         result.setProperty( "localRepository", getLocalRepository().getBasedir() );
         if ( isForking() )
         {
@@ -1246,10 +1245,16 @@ public abstract class AbstractSurefireMojo
                         );
             }
         }
+        else
+        {
+            result.setProperty( "user.dir", getWorkingDirectory().getAbsolutePath() );
+        }
+
         if ( getConsoleLogger().isDebugEnabled() )
         {
             showToLog( result, getConsoleLogger() );
         }
+
         return result;
     }