Mark tests as not working under TARGET_JVM
[mono.git] / mcs / class / corlib / Test / System.IO / FileStreamTest.cs
index 507d4e97f3f1f3cd81030c83b6a0b34722d53860..0d7b6d258f85d7fe2423b935008625e0eddcb398 100644 (file)
@@ -698,6 +698,7 @@ namespace MonoTests.System.IO
                        }
                }
 
+#if !TARGET_JVM // No support IntPtr file handles under TARGET_JVM
                [Test, ExpectedException (typeof (IOException))]
                public void CtorIOException2 ()
                {
@@ -709,7 +710,9 @@ namespace MonoTests.System.IO
                                        stream.Close ();
                        }
                }
+#endif // TARGET_JVM
 
+               [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
                [Test, ExpectedException (typeof (IOException))]
                public void CtorIOException ()
                {
@@ -757,41 +760,49 @@ namespace MonoTests.System.IO
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
                [ExpectedException (typeof (IOException))]
                public void CtorAccess1Read2Write ()
                {
                        string fn = Path.Combine (TempFolder, "temp");
-                       FileStream fs = null;
+                       FileStream fs1 = null;
+                       FileStream fs2 = null;
                        try {
                                if (!File.Exists (fn)) {
                                        using (TextWriter tw = File.CreateText (fn)) {
                                                tw.Write ("FOO");
                                        }
                                }
-                               fs = new FileStream (fn, FileMode.Open, FileAccess.Read);
-                               fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
+                               fs1 = new FileStream (fn, FileMode.Open, FileAccess.Read);
+                               fs2 = new FileStream (fn, FileMode.Create, FileAccess.Write);
                        } finally {
-                               if (fs != null)
-                                       fs.Close ();
+                               if (fs1 != null)
+                                       fs1.Close ();
+                               if (fs2 != null)
+                                       fs2.Close ();
                                if (File.Exists (fn))
                                        File.Delete (fn);
                        }
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
                [ExpectedException (typeof (IOException))]
                public void CtorAccess1Write2Write ()
                {
                        string fn = Path.Combine (TempFolder, "temp");
-                       FileStream fs = null;
+                       FileStream fs1 = null;
+                       FileStream fs2 = null;
                        try {
                                if (File.Exists (fn))
                                        File.Delete (fn);
-                               fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
-                               fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
+                               fs1 = new FileStream (fn, FileMode.Create, FileAccess.Write);
+                               fs2 = new FileStream (fn, FileMode.Create, FileAccess.Write);
                        } finally {
-                               if (fs != null)
-                                       fs.Close ();
+                               if (fs1 != null)
+                                       fs1.Close ();
+                               if (fs2 != null)
+                                       fs2.Close ();
                                if (File.Exists (fn))
                                        File.Delete (fn);
                        }
@@ -972,6 +983,7 @@ namespace MonoTests.System.IO
                        DeleteFile (path);
                }
 
+               [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
                public void TestLock ()
                {
                        string path = TempFolder + Path.DirectorySeparatorChar + "TestLock";
@@ -1260,6 +1272,7 @@ namespace MonoTests.System.IO
                        }
                }
 
+#if !TARGET_JVM // No support IntPtr file handles under TARGET_JVM
                // Check that the stream is flushed even when it doesn't own the
                // handle
                [Test]
@@ -1279,6 +1292,7 @@ namespace MonoTests.System.IO
                        Assert.AreEqual ((int) '1', s.ReadByte ());
                        s.Close ();
                }
+#endif // TARGET_JVM
 
                private void DeleteFile (string path)
                {
@@ -1394,12 +1408,14 @@ namespace MonoTests.System.IO
                        }
                }
 
+#if !TARGET_JVM // No support IntPtr file handles under TARGET_JVM
                [Test]
                [ExpectedException (typeof (ArgumentException))]
                public void Constructor_InvalidFileHandle ()
                {
                        new FileStream ((IntPtr) (-1L), FileAccess.Read);
                }
+#endif // TARGET_JVM
 
                [Test]
                public void PositionAfterSetLength ()
@@ -1438,6 +1454,7 @@ namespace MonoTests.System.IO
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // Async IO not supported for TARGET_JVM
                [ExpectedException (typeof (ObjectDisposedException))]
                public void BeginRead_Disposed ()
                {
@@ -1449,6 +1466,7 @@ namespace MonoTests.System.IO
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // Async IO not supported for TARGET_JVM
                [ExpectedException (typeof (ObjectDisposedException))]
                public void BeginWrite_Disposed ()
                {
@@ -1460,6 +1478,7 @@ namespace MonoTests.System.IO
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
                [ExpectedException (typeof (ObjectDisposedException))]
                public void Lock_Disposed ()
                {
@@ -1471,6 +1490,7 @@ namespace MonoTests.System.IO
                }
 
                [Test]
+               [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
                [ExpectedException (typeof (ObjectDisposedException))]
                public void Unlock_Disposed ()
                {
@@ -1534,6 +1554,7 @@ namespace MonoTests.System.IO
                }
 
 #if NET_2_0
+               [Category("TargetJvmNotSupported")] // FileOptions.DeleteOnClose not supported for TARGET_JVM
                [Test] public void DeleteOnClose ()
                {
                        string path = TempFolder + DSC + "created.txt";