Merge pull request #1936 from esdrubal/DotNetRelativeOrAbsolute
[mono.git] / mcs / class / corlib / Test / System.IO / DirectoryTest.cs
index 915bb93dd72985b5f2d34357a93d24b8e6e16ecd..64ee5872b8396c1ca7942ceb31fb33174ce00b10 100644 (file)
 //\r
 \r
 using System;\r
+using System.Collections.Generic;\r
 using System.Diagnostics;\r
 using System.Globalization;\r
 using System.IO;\r
 using System.Text;\r
 using System.Threading;\r
 \r
+#if !MONOTOUCH\r
+using Mono.Unix;\r
+#endif\r
 using NUnit.Framework;\r
 \r
 namespace MonoTests.System.IO\r
@@ -24,7 +28,8 @@ namespace MonoTests.System.IO
 [TestFixture]\r
 public class DirectoryTest\r
 {\r
-       string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");\r
+       static readonly string TempSubFolder = "MonoTests.System.IO.Tests";\r
+       string TempFolder = Path.Combine (Path.GetTempPath (), TempSubFolder);\r
        static readonly char DSC = Path.DirectorySeparatorChar;\r
 \r
        [SetUp]\r
@@ -42,7 +47,49 @@ public class DirectoryTest
                if (Directory.Exists (TempFolder))\r
                        Directory.Delete (TempFolder, true);\r
        }\r
-\r
+#if !MONOTOUCH\r
+       [Test] //BXC #12461\r
+       public void EnumerateFilesListSymlinks ()\r
+       {\r
+               if (!RunningOnUnix)\r
+                       Assert.Ignore ("Not running on Unix.");\r
+\r
+               var afile = Path.Combine (TempFolder, "afile.src");\r
+               var bfile = Path.Combine (TempFolder, "bfile.src");\r
+               var cdir = Path.Combine (TempFolder, "cdir.src");\r
+\r
+               File.AppendAllText (afile, "hello");\r
+               var info = new UnixFileInfo (afile);\r
+               info.CreateSymbolicLink (bfile);\r
+               Directory.CreateDirectory (cdir);\r
+\r
+               var files0 = Directory.GetFiles (TempFolder, "*.src");\r
+               Array.Sort (files0);\r
+               Assert.AreEqual (2, files0.Length, "#1");\r
+               Assert.AreEqual (afile, files0 [0], "#2");\r
+               Assert.AreEqual (bfile, files0 [1], "#3");\r
+\r
+               var files1 = new List<string> (Directory.EnumerateFiles (TempFolder, "*.src")).ToArray ();\r
+               Array.Sort (files1);\r
+               Assert.AreEqual (2, files1.Length, "#1.b");\r
+               Assert.AreEqual (afile, files1 [0], "#2.b");\r
+               Assert.AreEqual (bfile, files1 [1], "#3.b");\r
+\r
+               var files2 = Directory.GetFileSystemEntries (TempFolder, "*.src");\r
+               Array.Sort (files2);\r
+               Assert.AreEqual (3, files2.Length, "#1.c");\r
+               Assert.AreEqual (afile, files2 [0], "#2.c");\r
+               Assert.AreEqual (bfile, files2 [1], "#3.c");\r
+               Assert.AreEqual (cdir, files2 [2], "#4.c");\r
+\r
+               var files3 = new List<string> (Directory.EnumerateFileSystemEntries (TempFolder, "*.src")).ToArray ();\r
+               Array.Sort (files3);\r
+               Assert.AreEqual (3, files3.Length, "#1.d");\r
+               Assert.AreEqual (afile, files3 [0], "#2.d");\r
+               Assert.AreEqual (bfile, files3 [1], "#3.d");\r
+               Assert.AreEqual (cdir, files3 [2], "#4.d");\r
+       }\r
+#endif\r
        [Test]\r
        public void CreateDirectory ()\r
        {\r
@@ -59,6 +106,7 @@ public class DirectoryTest
                }\r
        }\r
        \r
+       /* Commented out: a directory named ":" is legal in unix\r
        [Test]\r
        public void CreateDirectoryNotSupportedException ()\r
        {\r
@@ -75,6 +123,7 @@ public class DirectoryTest
                }\r
                DeleteDirectory (":");\r
        }\r
+       */\r
 \r
        [Test]\r
        public void CreateDirectory_Path_Null ()\r
@@ -169,18 +218,12 @@ public class DirectoryTest
                        fstream.Close();\r
 \r
                        DirectoryInfo dinfo = Directory.CreateDirectory (path);\r
-#if NET_2_0\r
                        Assert.Fail ("#1");\r
                } catch (IOException ex) {\r
                        Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");\r
                        // exception message contains the path\r
                        Assert.IsTrue (ex.Message.Contains (path), "#3");\r
                        Assert.IsNull (ex.InnerException, "#4");\r
-#else\r
-                       Assert.IsFalse (dinfo.Exists, "#2");\r
-                       Assert.IsTrue (dinfo.FullName.EndsWith ("DirectoryTest.Test.ExistsAsFile"), "#3");\r
-                       Assert.AreEqual ("DirectoryTest.Test.ExistsAsFile", dinfo.Name, "#4");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                        DeleteFile (path);\r
@@ -311,28 +354,27 @@ public class DirectoryTest
                Assert.IsFalse (Directory.Exists (null as string));\r
        }\r
 \r
-#if !TARGET_JVM // We don't support yet the Process class.\r
+#if !MOBILE // We don't support yet the Process class.\r
        [Test] // bug #78239\r
        public void ExistsAccessDenied ()\r
        {\r
                if (!RunningOnUnix)\r
-                       return; // this test does not work on Windows.\r
+                       Assert.Ignore ("Not running on Unix."); // this test does not work on Windows.\r
 \r
                string path = TempFolder + DSC + "ExistsAccessDenied";\r
 \r
                Directory.CreateDirectory (path);\r
-               Process.Start ("/bin/chmod", "000 " + path).WaitForExit ();\r
+               global::Mono.Posix.Syscall.chmod (path, 0);\r
                try {\r
                        Assert.IsFalse (Directory.Exists(path + DSC + "b"));\r
                } finally {\r
-                       Process.Start ("/bin/chmod", "755 " + path).WaitForExit ();\r
+                       global::Mono.Posix.Syscall.chmod (path, (global::Mono.Posix.FileMode) 755);\r
                        Directory.Delete (path);\r
                }\r
        }\r
 #endif\r
        \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        [ExpectedException(typeof(ArgumentNullException))]\r
        public void GetCreationTimeException1 ()\r
        {\r
@@ -341,17 +383,12 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException2 ()\r
        {\r
                Directory.GetCreationTime (string.Empty);\r
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException(typeof(IOException))]\r
-#endif\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetCreationTime.1";\r
@@ -359,7 +396,6 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetCreationTime (path);\r
 \r
-#if NET_2_0\r
                        DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();\r
                        Assert.AreEqual (expectedTime.Year, time.Year, "#1");\r
                        Assert.AreEqual (expectedTime.Month, time.Month, "#2");\r
@@ -367,7 +403,6 @@ public class DirectoryTest
                        Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");\r
                        Assert.AreEqual (expectedTime.Second, time.Second, "#5");\r
                        Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -375,7 +410,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException4 ()\r
        {\r
                Directory.GetCreationTime ("    ");\r
@@ -383,7 +417,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException5 ()\r
        {\r
                Directory.GetCreationTime (Path.InvalidPathChars [0].ToString ());\r
@@ -391,7 +424,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException1 ()\r
        {\r
                Directory.GetCreationTimeUtc (null as string);\r
@@ -399,17 +431,12 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException2 ()\r
        {\r
                Directory.GetCreationTimeUtc (string.Empty);\r
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException (typeof (IOException))]\r
-#endif\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtc_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetCreationTimeUtc.1";\r
@@ -418,14 +445,12 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetCreationTimeUtc (path);\r
 \r
-#if NET_2_0\r
                        Assert.AreEqual (1601, time.Year, "#1");\r
                        Assert.AreEqual (1, time.Month, "#2");\r
                        Assert.AreEqual (1, time.Day, "#3");\r
                        Assert.AreEqual (0, time.Hour, "#4");\r
                        Assert.AreEqual (0, time.Second, "#5");\r
                        Assert.AreEqual (0, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -433,7 +458,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException4 ()\r
        {\r
                Directory.GetCreationTimeUtc ("    ");\r
@@ -441,7 +465,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException5 ()\r
        {\r
                Directory.GetCreationTime (Path.InvalidPathChars [0].ToString ());\r
@@ -449,7 +472,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTime_Null ()\r
        {\r
                Directory.GetLastAccessTime (null as string);\r
@@ -457,17 +479,12 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException2 ()\r
        {\r
                Directory.GetLastAccessTime (string.Empty);\r
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException (typeof (IOException))]\r
-#endif\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTime_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTime.1";\r
@@ -476,7 +493,6 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetLastAccessTime (path);\r
 \r
-#if NET_2_0\r
                        DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();\r
                        Assert.AreEqual (expectedTime.Year, time.Year, "#1");\r
                        Assert.AreEqual (expectedTime.Month, time.Month, "#2");\r
@@ -484,7 +500,6 @@ public class DirectoryTest
                        Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");\r
                        Assert.AreEqual (expectedTime.Second, time.Second, "#5");\r
                        Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -492,7 +507,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException4 ()\r
        {\r
                Directory.GetLastAccessTime ("    ");\r
@@ -500,7 +514,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException5 ()\r
        {\r
                Directory.GetLastAccessTime (Path.InvalidPathChars [0].ToString ());\r
@@ -508,7 +521,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtc_Null ()\r
        {\r
                Directory.GetLastAccessTimeUtc (null as string);\r
@@ -516,17 +528,12 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException2 ()\r
        {\r
                Directory.GetLastAccessTimeUtc (string.Empty);\r
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException (typeof (IOException))]\r
-#endif\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtc_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTimeUtc.1";\r
@@ -534,14 +541,12 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetLastAccessTimeUtc (path);\r
 \r
-#if NET_2_0\r
                        Assert.AreEqual (1601, time.Year, "#1");\r
                        Assert.AreEqual (1, time.Month, "#2");\r
                        Assert.AreEqual (1, time.Day, "#3");\r
                        Assert.AreEqual (0, time.Hour, "#4");\r
                        Assert.AreEqual (0, time.Second, "#5");\r
                        Assert.AreEqual (0, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -549,7 +554,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException4 ()\r
        {\r
                Directory.GetLastAccessTimeUtc ("    ");\r
@@ -557,7 +561,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException5 ()\r
        {\r
                Directory.GetLastAccessTimeUtc (Path.InvalidPathChars [0].ToString ());\r
@@ -578,9 +581,6 @@ public class DirectoryTest
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException (typeof (IOException))]\r
-#endif\r
        public void GetLastWriteTime_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastWriteTime.1";\r
@@ -588,7 +588,6 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetLastWriteTime (path);\r
 \r
-#if NET_2_0\r
                        DateTime expectedTime = (new DateTime (1601, 1, 1)).ToLocalTime ();\r
                        Assert.AreEqual (expectedTime.Year, time.Year, "#1");\r
                        Assert.AreEqual (expectedTime.Month, time.Month, "#2");\r
@@ -596,7 +595,6 @@ public class DirectoryTest
                        Assert.AreEqual (expectedTime.Hour, time.Hour, "#4");\r
                        Assert.AreEqual (expectedTime.Second, time.Second, "#5");\r
                        Assert.AreEqual (expectedTime.Millisecond, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -631,9 +629,6 @@ public class DirectoryTest
        }\r
        \r
        [Test]\r
-#if !NET_2_0\r
-       [ExpectedException (typeof (IOException))]\r
-#endif\r
        public void GetLastWriteTimeUtc_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastWriteTimeUtc.1";\r
@@ -641,14 +636,12 @@ public class DirectoryTest
                try {\r
                        DateTime time = Directory.GetLastWriteTimeUtc (path);\r
 \r
-#if NET_2_0\r
                        Assert.AreEqual (1601, time.Year, "#1");\r
                        Assert.AreEqual (1, time.Month, "#2");\r
                        Assert.AreEqual (1, time.Day, "#3");\r
                        Assert.AreEqual (0, time.Hour, "#4");\r
                        Assert.AreEqual (0, time.Second, "#5");\r
                        Assert.AreEqual (0, time.Millisecond, "#6");\r
-#endif\r
                } finally {\r
                        DeleteDirectory (path);\r
                }\r
@@ -949,7 +942,6 @@ public class DirectoryTest
        }\r
        \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // CreationTime not supported for TARGET_JVM\r
        public void CreationTime ()\r
        {\r
                if (RunningOnUnix)\r
@@ -1000,7 +992,6 @@ public class DirectoryTest
        }\r
 \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // LastAccessTime not supported for TARGET_JVM\r
        public void LastAccessTime ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.AccessTime.1";\r
@@ -1222,7 +1213,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1231,7 +1221,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1240,7 +1229,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1255,7 +1243,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1264,7 +1251,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1290,7 +1276,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1299,7 +1284,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1308,7 +1292,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1323,7 +1306,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1332,7 +1314,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1357,7 +1338,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1366,7 +1346,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1375,7 +1354,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1391,7 +1369,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1400,7 +1377,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1427,7 +1403,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1436,7 +1411,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1445,7 +1419,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1462,7 +1435,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1471,7 +1443,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1524,7 +1495,7 @@ public class DirectoryTest
        {\r
                if (!RunningOnUnix)\r
                        // on Windows, backslash is used as directory separator\r
-                       return;\r
+                       Assert.Ignore ("Not running on Unix.");\r
 \r
                string dir = Path.Combine (TempFolder, @"sub\dir");\r
                Directory.CreateDirectory (dir);\r
@@ -1575,7 +1546,7 @@ public class DirectoryTest
        {\r
                if (!RunningOnUnix)\r
                        // on Windows, backslash is used as directory separator\r
-                       return;\r
+                       Assert.Ignore ("Not running on Unix.");\r
 \r
                string file = Path.Combine (TempFolder, @"doc\temp1.file");\r
                File.Create (file).Close ();\r
@@ -1672,6 +1643,26 @@ public class DirectoryTest
                        Assert.AreEqual (Path.Combine (TempFolder, "tempFile4"), files [0], "#N3");\r
        }\r
 \r
+       [Test]\r
+       public void GetFiles_580090 ()\r
+       {\r
+               string cwd = Directory.GetCurrentDirectory ();\r
+               Directory.SetCurrentDirectory (Path.GetTempPath ());\r
+\r
+               string tempFile = Path.Combine (TempFolder, "tempFile.txt");\r
+               File.Create (tempFile).Close ();\r
+\r
+               try {\r
+                       string [] files = Directory.GetFiles (".", TempSubFolder + DSC + "*.t*");\r
+                       Assert.IsNotNull (files, "#J1");\r
+                       Assert.AreEqual (1, files.Length, "#J2");\r
+               }\r
+               finally {\r
+                       Directory.SetCurrentDirectory (cwd);\r
+               }\r
+       }\r
+\r
+\r
        [Test]\r
        [ExpectedException (typeof (ArgumentNullException))]\r
        public void SetCurrentDirectoryNull ()\r
@@ -1712,7 +1703,7 @@ public class DirectoryTest
                        // check for Unix platforms - see FAQ for more details\r
                        // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F\r
                        int platform = (int) Environment.OSVersion.Platform;\r
-                       return ((platform == 4) || (platform == 128));\r
+                       return ((platform == 4) || (platform == 128) || (platform == 6));\r
                }\r
        }\r
 \r