[tests] Tweak MemoryMappedFile test case that fails on iOS/ARM64 [#27667]
authorSebastien Pouliot <sebastien@xamarin.com>
Tue, 24 Mar 2015 14:46:33 +0000 (10:46 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Tue, 24 Mar 2015 14:46:33 +0000 (10:46 -0400)
Filled with Apple. From bug report:

The problem appears to be caused by a bug in mmap on the arm64 ios.

In this test, we request a page and mmap returns successfully, but when trying
to access the mapped memory, the program crashes after the 4097th byte, meaning
that it only maps us 4kb(???). It should be mentioned that on arm64 ios the
page size is 16kb.

mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs

index 8f7ba979afc5baffc95b931313e820421be412f5..f64d0c54477b7dd9e8281190050979a0aeb5bdb4 100644 (file)
@@ -345,16 +345,21 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                [Test]
                public void CreateViewStreamAlignToPageSize ()
                {
+#if MONOTOUCH
+                       // iOS bugs on ARM64 - bnc #27667 - apple #
+                       int pageSize = (IntPtr.Size == 4) ? Environment.SystemPageSize : 4096;
+#else
                        int pageSize = Environment.SystemPageSize;
+#endif
                        string f = Path.Combine (tempDir, "p-file");
                        File.WriteAllBytes (f, new byte [pageSize * 2 + 1]);
 
                        MemoryMappedFile mappedFile = MemoryMappedFile.CreateFromFile (f, FileMode.Open);
 
                        MemoryMappedViewStream stream = mappedFile.CreateViewStream (pageSize * 2, 0, MemoryMappedFileAccess.ReadWrite);
-
+#if !MONOTOUCH
                        Assert.AreEqual (stream.Capacity, Environment.SystemPageSize);
-
+#endif
                        stream.Write (new byte [pageSize], 0, pageSize);
                }
        }