maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [1/3] maven-surefire git commit: SUREFIRE-1136 Current working directory propagation in forked mode - ignore testExceptionWhenCurrentDirectoryCannotBeCreated under certain conditions.
Date Sun, 01 Feb 2015 00:00:19 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 60111e78f -> 2b4629c71


SUREFIRE-1136 Current working directory propagation in forked mode - ignore testExceptionWhenCurrentDirectoryCannotBeCreated
under certain conditions.


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/d6a8af59
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/d6a8af59
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/d6a8af59

Branch: refs/heads/master
Commit: d6a8af593fc03e12ecf2dc8047669472f7ca263b
Parents: 60111e7
Author: norbertwnuk <norbert.wnuk@gmail.com>
Authored: Wed Jan 28 02:51:39 2015 +0100
Committer: norbertwnuk <norbert.wnuk@gmail.com>
Committed: Wed Jan 28 03:25:14 2015 +0100

----------------------------------------------------------------------
 .../booterclient/ForkConfigurationTest.java     | 25 +++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/d6a8af59/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
index b3d2151..4f62670 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
@@ -26,6 +26,7 @@ import java.util.Properties;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.cli.Commandline;
 import org.apache.maven.surefire.booter.Classpath;
@@ -122,7 +123,9 @@ public class ForkConfigurationTest
         baseDir.mkdirs();
         baseDir.deleteOnExit();
 
-        File cwd = new File( baseDir, "?\0InvalidDirectoryName" );
+        // NULL is invalid for JDK starting from 1.7.60 - https://github.com/openjdk-mirror/jdk/commit/e5389115f3634d25d101e2dcc71f120d4fd9f72f
+        // ? character is invalid on Windows, seems to be imposable to create invalid directory
using Java on Linux
+        File cwd = new File( baseDir, "?\u0000InvalidDirectoryName" );
         ForkConfiguration config = getForkConfiguration( null, "java", cwd.getAbsoluteFile()
);
 
         try
@@ -135,7 +138,10 @@ public class ForkConfigurationTest
             return;
         }
 
-        fail();
+        if ( SystemUtils.IS_OS_WINDOWS || isJavaVersionAtLeast( 7, 60 ) )
+        {
+            fail();
+        }
     }
 
     private File getTempClasspathFile()
@@ -147,10 +153,10 @@ public class ForkConfigurationTest
     }
 
     public static ForkConfiguration getForkConfiguration( String argLine, String jvm )
-    throws IOException
-{
-    return getForkConfiguration( argLine, jvm, new File( "." ).getCanonicalFile() );
-}
+        throws IOException
+    {
+        return getForkConfiguration( argLine, jvm, new File( "." ).getCanonicalFile() );
+    }
 
     public static ForkConfiguration getForkConfiguration( String argLine, String jvm, File
cwd )
         throws IOException
@@ -159,4 +165,11 @@ public class ForkConfigurationTest
                                       false, 1, false );
     }
 
+    // based on http://stackoverflow.com/questions/2591083/getting-version-of-java-in-runtime
+    private boolean isJavaVersionAtLeast( int major, int update )
+    {
+        String[] javaVersionElements = System.getProperty( "java.runtime.version" ).split(
"\\.|_|-b" );
+        return Integer.valueOf( javaVersionElements[1] ) >= major
+            && Integer.valueOf( javaVersionElements[4] ) >= update;
+    }
 }


Mime
View raw message