From 997173972b9938fce26aa2cd1c31ada341ddf6f9 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Sat, 14 Oct 2023 22:44:27 +0700 Subject: [PATCH] SWEEP: conditionally ignore tests that are failing due to the Xamarin.Android platform issues https://github.com/xamarin/xamarin-android/issues/5423 and https://github.com/xamarin/xamarin-android/issues/5425 --- azure-pipelines.yml | 8 ++++---- .../TestMemoryMappedViewByteBuffer.cs | 20 ++++++++++++++----- tests/J2N.Tests/Text/TestStringExtensions.cs | 16 +++++++++++---- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d7878a68..2fe47ad2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -320,7 +320,7 @@ stages: testTargetFrameworks: 'MonoAndroid90' androidAbi: 'x86_64' testResultsArtifactName: '$(TestResultsArtifactName)' - maximumAllowedFailures: 9 # Maximum allowed failures for a successful build + maximumAllowedFailures: 0 # Maximum allowed failures for a successful build dotNetSdkVersion: '$(DotNetSDKVersion)' - job: Test_MonoAndroid90_x86 # Only run if explicitly enabled with RunX86Tests @@ -335,7 +335,7 @@ stages: testTargetFrameworks: 'MonoAndroid90' androidAbi: 'x86' testResultsArtifactName: '$(TestResultsArtifactName)' - maximumAllowedFailures: 9 # Maximum allowed failures for a successful build + maximumAllowedFailures: 0 # Maximum allowed failures for a successful build dotNetSdkVersion: '$(DotNetSDKVersion)' - job: Test_MonoAndroid100_x86_64 @@ -350,7 +350,7 @@ stages: testTargetFrameworks: 'MonoAndroid100' androidAbi: 'x86_64' testResultsArtifactName: '$(TestResultsArtifactName)' - maximumAllowedFailures: 9 # Maximum allowed failures for a successful build + maximumAllowedFailures: 0 # Maximum allowed failures for a successful build dotNetSdkVersion: '$(DotNetSDKVersion)' - job: Test_MonoAndroid100_x86 # Only run if explicitly enabled with RunX86Tests @@ -365,7 +365,7 @@ stages: testTargetFrameworks: 'MonoAndroid100' androidAbi: 'x86' testResultsArtifactName: '$(TestResultsArtifactName)' - maximumAllowedFailures: 9 # Maximum allowed failures for a successful build + maximumAllowedFailures: 0 # Maximum allowed failures for a successful build dotNetSdkVersion: '$(DotNetSDKVersion)' diff --git a/tests/J2N.Tests/IO/MemoryMappedFiles/TestMemoryMappedViewByteBuffer.cs b/tests/J2N.Tests/IO/MemoryMappedFiles/TestMemoryMappedViewByteBuffer.cs index 29312548..b116d846 100644 --- a/tests/J2N.Tests/IO/MemoryMappedFiles/TestMemoryMappedViewByteBuffer.cs +++ b/tests/J2N.Tests/IO/MemoryMappedFiles/TestMemoryMappedViewByteBuffer.cs @@ -54,8 +54,10 @@ public void TestasIntBuffer() } [Test] - public void TestReadOnly() //"Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423" + public void TestReadOnly() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423"); + using (var fis = new FileStream(tmpFile.FullName, FileMode.Open, FileAccess.Read)) using (var fc = MemoryMappedFile.CreateFromFile(fis, null, 0, MemoryMappedFileAccess.Read, #if FEATURE_MEMORYMAPPEDFILESECURITY @@ -120,8 +122,10 @@ public void TestReadOnly() //"Awaits fix: https://github.com/xamarin/xamarin-and * @throws IOException */ [Test] - public void TestEmptyBuffer() //"Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423" + public void TestEmptyBuffer() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423"); + // Map empty file // FileInputStream fis = new FileInputStream(emptyFile); //FileChannel fc = fis.getChannel(); @@ -321,8 +325,10 @@ public override void TearDown() [Test] - public void Test_Position() //"Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423" + public void Test_Position() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423"); + var tmp = new FileInfo(Path.GetTempFileName()); //File tmp = File.createTempFile("hmy", "tmp"); @@ -437,8 +443,10 @@ public void TestBasic() } [Test] - public void TestFlush() // Force.java //"Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423" + public void TestFlush() // Force.java { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423"); + long fileSize = Random.Next(3 * 1024 * 1024); int cut = Random.Next((int)fileSize); var file = new FileInfo(Path.GetTempFileName()); @@ -470,8 +478,10 @@ public void TestFlush() // Force.java //"Awaits fix: https://github.com/xamarin/ //} [Test] - public void TestZeroMap() //"Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423" + public void TestZeroMap() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5423"); + long fileSize = Random.Next(1024 * 1024); int cut = Random.Next((int)fileSize); var file = new FileInfo(Path.GetTempFileName()); diff --git a/tests/J2N.Tests/Text/TestStringExtensions.cs b/tests/J2N.Tests/Text/TestStringExtensions.cs index 82b17c07..203c4a51 100644 --- a/tests/J2N.Tests/Text/TestStringExtensions.cs +++ b/tests/J2N.Tests/Text/TestStringExtensions.cs @@ -454,8 +454,10 @@ public void Test_LastIndexOf_Int32_Int32() * @tests java.lang.String#regionMatches(int, java.lang.String, int, int) */ [Test] - public void Test_RegionMatches_String_Int32_ICharSequence_Int32_Int32_StringComparison() // Awaits Fix: https://github.com/xamarin/xamarin-android/issues/5425 + public void Test_RegionMatches_String_Int32_ICharSequence_Int32_Int32_StringComparison() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5425"); + // Test for method boolean java.lang.String.regionMatches(int, // java.lang.String, int, int) String bogusString = "xxcedkedkleiorem lvvwr e''' 3r3r 23r"; @@ -513,8 +515,10 @@ public void Test_RegionMatches_String_Int32_ICharSequence_Int32_Int32_StringComp * @tests java.lang.String#regionMatches(int, java.lang.String, int, int) */ [Test] - public void Test_RegionMatches_String_Int32_CharArray_Int32_Int32_StringComparison() // Awaits Fix: https://github.com/xamarin/xamarin-android/issues/5425 + public void Test_RegionMatches_String_Int32_CharArray_Int32_Int32_StringComparison() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5425"); + // Test for method boolean java.lang.String.regionMatches(int, // java.lang.String, int, int) String bogusString = "xxcedkedkleiorem lvvwr e''' 3r3r 23r"; @@ -572,8 +576,10 @@ public void Test_RegionMatches_String_Int32_CharArray_Int32_Int32_StringComparis * @tests java.lang.String#regionMatches(int, java.lang.String, int, int) */ [Test] - public void Test_RegionMatches_String_Int32_StringBuilder_Int32_Int32_StringComparison() // Awaits Fix: https://github.com/xamarin/xamarin-android/issues/5425 + public void Test_RegionMatches_String_Int32_StringBuilder_Int32_Int32_StringComparison() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5425"); + // Test for method boolean java.lang.String.regionMatches(int, // java.lang.String, int, int) String bogusString = "xxcedkedkleiorem lvvwr e''' 3r3r 23r"; @@ -631,8 +637,10 @@ public void Test_RegionMatches_String_Int32_StringBuilder_Int32_Int32_StringComp * @tests java.lang.String#regionMatches(int, java.lang.String, int, int) */ [Test] - public void Test_RegionMatches_String_Int32_String_Int32_Int32_StringComparison() // Awaits Fix: https://github.com/xamarin/xamarin-android/issues/5425 + public void Test_RegionMatches_String_Int32_String_Int32_Int32_StringComparison() { + Assume.That(!PlatformDetection.IsXamarinAndroid, "J2N TODO: Awaits fix: https://github.com/xamarin/xamarin-android/issues/5425"); + // Test for method boolean java.lang.String.regionMatches(int, // java.lang.String, int, int) String bogusString = "xxcedkedkleiorem lvvwr e''' 3r3r 23r";