Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#51371 fixed failing test in iossimulator #63877

Merged
merged 18 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ public abstract class StandaloneStreamConformanceTests : StreamConformanceTests
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ArgumentValidation_ThrowsExpectedException()
{
await foreach (Stream? stream in GetStreamsForValidation())
Expand All @@ -725,7 +724,6 @@ public virtual async Task ArgumentValidation_ThrowsExpectedException()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Disposed_ThrowsObjectDisposedException()
{
await foreach (Stream? stream in GetStreamsForValidation())
Expand Down Expand Up @@ -815,7 +813,6 @@ public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
[InlineData(ReadWriteMode.SyncArray)]
[InlineData(ReadWriteMode.AsyncArray)]
[InlineData(ReadWriteMode.AsyncAPM)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Write_DataReadFromDesiredOffset(ReadWriteMode mode)
{
using Stream? stream = await CreateReadWriteStream();
Expand Down Expand Up @@ -1599,7 +1596,6 @@ protected static bool Bidirectional(StreamPair streams) =>
streams.Stream2.CanRead && streams.Stream2.CanWrite;

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ArgumentValidation_ThrowsExpectedException()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -1611,7 +1607,6 @@ public virtual async Task ArgumentValidation_ThrowsExpectedException()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Disposed_ThrowsObjectDisposedException()
{
StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -1624,7 +1619,6 @@ public virtual async Task Disposed_ThrowsObjectDisposedException()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadWriteAsync_PrecanceledOperations_ThrowsCancellationException()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -1636,7 +1630,6 @@ public virtual async Task ReadWriteAsync_PrecanceledOperations_ThrowsCancellatio
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadAsync_CancelPendingTask_ThrowsCancellationException()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -1646,7 +1639,6 @@ public virtual async Task ReadAsync_CancelPendingTask_ThrowsCancellationExceptio
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadAsync_CancelPendingValueTask_ThrowsCancellationException()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -1656,7 +1648,6 @@ public virtual async Task ReadAsync_CancelPendingValueTask_ThrowsCancellationExc
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadWriteByte_Success()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -1729,7 +1720,6 @@ public virtual async Task ReadWrite_Success_Large(ReadWriteMode mode, int writeS

[Theory]
[MemberData(nameof(ReadWrite_Success_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadWrite_Success(ReadWriteMode mode, int writeSize, bool startWithFlush)
{
foreach (CancellationToken nonCanceledToken in new[] { CancellationToken.None, new CancellationTokenSource().Token })
Expand Down Expand Up @@ -1786,7 +1776,6 @@ public virtual async Task ReadWrite_Success(ReadWriteMode mode, int writeSize, b

[Theory]
[MemberData(nameof(ReadWrite_Modes))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadWrite_MessagesSmallerThanReadBuffer_Success(ReadWriteMode mode)
{
if (!FlushGuaranteesAllDataWritten)
Expand Down Expand Up @@ -1835,7 +1824,6 @@ public virtual async Task ReadWrite_MessagesSmallerThanReadBuffer_Success(ReadWr
[Theory]
[MemberData(nameof(AllReadWriteModesAndValue), false)]
[MemberData(nameof(AllReadWriteModesAndValue), true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Read_Eof_Returns0(ReadWriteMode mode, bool dataAvailableFirst)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -1874,7 +1862,6 @@ public virtual async Task Read_Eof_Returns0(ReadWriteMode mode, bool dataAvailab
[InlineData(ReadWriteMode.SyncArray)]
[InlineData(ReadWriteMode.AsyncArray)]
[InlineData(ReadWriteMode.AsyncAPM)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -1904,7 +1891,6 @@ public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
[InlineData(ReadWriteMode.SyncArray)]
[InlineData(ReadWriteMode.AsyncArray)]
[InlineData(ReadWriteMode.AsyncAPM)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Write_DataReadFromDesiredOffset(ReadWriteMode mode)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2003,7 +1989,6 @@ public static IEnumerable<object[]> ReadAsync_ContinuesOnCurrentContextIfDesired

[Theory]
[MemberData(nameof(ReadAsync_ContinuesOnCurrentContextIfDesired_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadAsync_ContinuesOnCurrentSynchronizationContextIfDesired(bool flowExecutionContext, bool? continueOnCapturedContext)
{
await default(JumpToThreadPoolAwaiter); // escape xunit sync ctx
Expand Down Expand Up @@ -2086,7 +2071,6 @@ public virtual async Task ReadAsync_ContinuesOnCurrentSynchronizationContextIfDe

[Theory]
[MemberData(nameof(ReadAsync_ContinuesOnCurrentContextIfDesired_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadAsync_ContinuesOnCurrentTaskSchedulerIfDesired(bool flowExecutionContext, bool? continueOnCapturedContext)
{
await default(JumpToThreadPoolAwaiter); // escape xunit sync ctx
Expand Down Expand Up @@ -2176,7 +2160,6 @@ await Task.Factory.StartNew(() =>
[InlineData(ReadWriteMode.AsyncMemory)]
[InlineData(ReadWriteMode.SyncAPM)]
[InlineData(ReadWriteMode.AsyncAPM)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ZeroByteRead_BlocksUntilDataAvailableOrNops(ReadWriteMode mode)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2243,7 +2226,6 @@ public virtual async Task ZeroByteRead_BlocksUntilDataAvailableOrNops(ReadWriteM
[InlineData(ReadWriteMode.AsyncMemory)]
[InlineData(ReadWriteMode.SyncAPM)]
[InlineData(ReadWriteMode.AsyncAPM)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ZeroByteWrite_OtherDataReceivedSuccessfully(ReadWriteMode mode)
{
byte[][] buffers = new[] { Array.Empty<byte>(), Encoding.UTF8.GetBytes("hello"), Array.Empty<byte>(), Encoding.UTF8.GetBytes("world") };
Expand Down Expand Up @@ -2297,7 +2279,6 @@ public virtual async Task ZeroByteWrite_OtherDataReceivedSuccessfully(ReadWriteM
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadWrite_CustomMemoryManager_Success(bool useAsync)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2418,7 +2399,6 @@ public virtual async Task CopyToAsync_AllDataCopied_Large(bool useAsync) =>

[Theory]
[MemberData(nameof(CopyToAsync_AllDataCopied_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task CopyToAsync_AllDataCopied(int byteCount, bool useAsync)
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2456,7 +2436,6 @@ await Task.WhenAll(Enumerable.Range(0, 20).Select(_ => Task.Run(async () =>
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Timeout_Roundtrips()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2491,7 +2470,6 @@ public virtual async Task Timeout_Roundtrips()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task ReadTimeout_Expires_Throws()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand Down Expand Up @@ -2626,7 +2604,6 @@ public virtual async Task ReadAsync_DuringReadAsync_ThrowsIfUnsupported()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Flush_ValidOnWriteableStreamWithNoData_Success()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -2641,7 +2618,6 @@ public virtual async Task Flush_ValidOnWriteableStreamWithNoData_Success()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Flush_ValidOnReadableStream_Success()
{
using StreamPair streams = await CreateConnectedStreamsAsync();
Expand All @@ -2659,7 +2635,6 @@ public virtual async Task Flush_ValidOnReadableStream_Success()
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public virtual async Task Dispose_ClosesStream(int disposeMode)
{
if (!CansReturnFalseAfterDispose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ protected static string GetNamedPipeServerStreamName()
return Guid.NewGuid().ToString("N");
}

if (!PlatformDetection.IsCaseSensitiveOS)
{
return $"/tmp/{Guid.NewGuid().ToString("N")}";
}

const int MinUdsPathLength = 104; // required min is 92, but every platform we currently target is at least 104
const int MinAvailableForSufficientRandomness = 5; // we want enough randomness in the name to avoid conflicts between concurrent tests
string prefix = Path.Combine(Path.GetTempPath(), "CoreFxPipe_");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ public static partial class PlatformDetection
public static bool IsNotWindows => !IsWindows;

public static bool IsCaseInsensitiveOS => IsWindows || IsOSX || IsMacCatalyst;
public static bool IsCaseSensitiveOS => !IsCaseInsensitiveOS;

#if NETCOREAPP
public static bool IsCaseSensitiveOS => !IsCaseInsensitiveOS && !RuntimeInformation.RuntimeIdentifier.StartsWith("iossimulator")
&& !RuntimeInformation.RuntimeIdentifier.StartsWith("tvossimulator");
#else
public static bool IsCaseSensitiveOS => !IsCaseInsensitiveOS;
#endif

public static bool IsThreadingSupported => !IsBrowser;
public static bool IsBinaryFormatterSupported => IsNotMobile && !IsNativeAot;
public static bool IsSymLinkSupported => !IsiOS && !IstvOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public void SettingInvalidAttributes_Unix(FileAttributes attributes)
AssertSettingInvalidAttributes(path, attributes);
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsCaseSensitiveOS))]
[InlineData(FileAttributes.Hidden)]
[PlatformSpecific(TestPlatforms.AnyUnix & ~(TestPlatforms.OSX | TestPlatforms.FreeBSD))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is ConditionalTheory needed if this test is PlatformSpecific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing on iossimulator/tvossimulator and MacCatalyst. They are considered a separate TestPlatform.

[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void SettingInvalidAttributes_UnixExceptOSXAndFreeBSD(FileAttributes attributes)
{
string path = CreateItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ public void AllowedSymbols()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void DirectoryEqualToMaxDirectory_CanBeCreatedAllAtOnce()
{
DirectoryInfo testDir = Create(GetTestFilePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component)
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/901", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[Theory,
MemberData(nameof(UncPathsWithoutShareName))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void UncPathWithoutShareNameAsPath_ReturnsFalse(string component)
{
Assert.False(Exists(component));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,7 @@ public void WindowsSearchPatternWhitespace()
Assert.Empty(GetEntries(TestDirectory, "\t"));
}

[Fact]
[PlatformSpecific(CaseSensitivePlatforms)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsCaseSensitiveOS))]
public void SearchPatternCaseSensitive()
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ public void EnumerateWithSymLinkToFile()
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void EnumerateFilesOverLegacyMaxPath()
{
// We want to test that directories under the legacy MAX_PATH (260 characters, including the null) can iterate files
// even if the full path is over 260.

string directory = IOServices.GetPath(GetTestFilePath(), 250);
Assert.Equal(250, directory.Length);
var length = OperatingSystem.IsWindows() ? 250 : 258;
string directory = IOServices.GetPath(GetTestFilePath(), length);
Assert.Equal(length, directory.Length);
Assert.True(Directory.CreateDirectory(directory).Exists);

for (int i = 0; i < 6; i++)
Expand Down
4 changes: 1 addition & 3 deletions src/libraries/System.IO.FileSystem/tests/File/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ public void LongFileName()
Assert.False(File.Exists(path));
}

[Fact]
[PlatformSpecific(CaseSensitivePlatforms)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
mkhamoyan marked this conversation as resolved.
Show resolved Hide resolved
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsCaseSensitiveOS))]
public void CaseSensitive()
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
Expand Down
2 changes: 0 additions & 2 deletions src/libraries/System.IO.FileSystem/tests/File/Exists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public void PathAlreadyExistsAsDirectory()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void DirectoryLongerThanMaxDirectoryAsPath_DoesntThrow()
{
Assert.All((IOInputs.GetPathsLongerThanMaxDirectory(GetTestFilePath())), (path) =>
Expand Down Expand Up @@ -234,7 +233,6 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component)
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/901", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[Theory,
MemberData(nameof(UncPathsWithoutShareName))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void UncPathWithoutShareNameAsPath_ReturnsFalse(string component)
{
Assert.False(Exists(component));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal static class IOInputs
// Windows specific, this is the maximum length that can be passed to APIs taking directory names, such as Directory.CreateDirectory & Directory.Move.
// Does not include the trailing \0.
// We now do the appropriate wrapping to allow creating longer directories. Like MaxPath, this is a legacy restriction.
public static readonly int MaxDirectory = 247;
public static readonly int MaxDirectory = OperatingSystem.IsWindows() ? 247 : 258;

public const int MaxComponent = 255;

Expand Down