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

PlatformNotSupportedException for UNIX domain sockets on iOS/tvOS #73374

Merged
merged 29 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
87f7db3
PNSE for domain sockets on iOS/tvOS
directhex Aug 4, 2022
d17c748
Re-enable some tests which SHOULD now throw PNSE
directhex Aug 4, 2022
401a14d
Try handling Catalyst==iOS case better
directhex Aug 4, 2022
394cbfb
Move "sockets supported" check _before_ "socket path name too long" c…
directhex Aug 4, 2022
2f7ff83
Newer API, from Jan
directhex Aug 4, 2022
995cf18
Skip various tests on iOS/tvOS explicitly.
directhex Aug 4, 2022
f383463
Update src/libraries/Common/src/System/Net/SocketProtocolSupportPal.cs
directhex Aug 5, 2022
489e1d9
Try to mark up unrunnable #67853 tests, and reenable the rest to see
directhex Aug 5, 2022
437fd79
Maybe mkfifo works after all? Try it out
directhex Aug 5, 2022
99771fa
YOLO
directhex Aug 5, 2022
17e9b62
YOLO2
directhex Aug 5, 2022
41baae1
Actually run UDS tests on iOS derivs
directhex Aug 5, 2022
818b934
Shrink socket path, just for sanity testing
directhex Aug 5, 2022
855fe09
Make test not increase UDS path by 1-32 characters
directhex Aug 5, 2022
227bbe9
Better approach
directhex Aug 5, 2022
d814cc0
Limit last change to 32 chars of randomness
directhex Aug 5, 2022
0d38fb8
Annotate Assert, since just 'True != False' is unhelpful
directhex Aug 6, 2022
d79e293
Okay, CONFIRMED: PNSE on iOS/tvOS
directhex Aug 8, 2022
e7ab373
Try to fix up UDS-specific test failures on iOS/tvOS
directhex Aug 8, 2022
4e763c4
Revert change which only benefited tvOS/iOS UDS
directhex Aug 8, 2022
80c4b47
Mark more tests as unpassable due to PNSE
directhex Aug 8, 2022
24023e4
Re-ActiveIssue tests failing due to #67853 bugs, not UDS bugs
directhex Aug 8, 2022
b4c1c5b
Latest test results
directhex Aug 8, 2022
7514e6f
Merge branch 'main' into PNSE-domain-sockets-on-ios-tvos
directhex Aug 8, 2022
b3db23c
Move tvOS/iOS hardcode to SocketProtocolSupportPal.Unix.cs
directhex Aug 8, 2022
61ca917
Use Socket.OSSupportsUnixDomainSockets
directhex Aug 8, 2022
d21e3cc
Clearer explanation on Bionic skips
directhex Aug 8, 2022
6ba57a2
Replace accidental Theory->Fact swaps back to Theory
directhex Aug 8, 2022
e46997e
I strongly disagree with this, but we have tests explicitly looking f…
directhex Aug 9, 2022
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 @@ -12,7 +12,7 @@ internal static partial class SocketProtocolSupportPal

public static bool OSSupportsIPv6 { get; } = IsSupported(AddressFamily.InterNetworkV6) && !IsIPv6Disabled();
public static bool OSSupportsIPv4 { get; } = IsSupported(AddressFamily.InterNetwork);
public static bool OSSupportsUnixDomainSockets { get; } = IsSupported(AddressFamily.Unix);
public static bool OSSupportsUnixDomainSockets { get; } = IsSupported(AddressFamily.Unix) && !OperatingSystem.IsTvOS() && (!OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst());
directhex marked this conversation as resolved.
Show resolved Hide resolved
directhex marked this conversation as resolved.
Show resolved Hide resolved

private static bool IsIPv6Disabled()
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void SettingAttributes_Unix_ReadOnly()

[Theory]
[InlineData(FileAttributes.Hidden)]
[PlatformSpecific(TestPlatforms.OSX | TestPlatforms.FreeBSD)]
[PlatformSpecific(TestPlatforms.OSX | TestPlatforms.FreeBSD | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
public void SettingAttributes_OSXAndFreeBSD(FileAttributes attributes)
{
string path = CreateItem();
Expand Down Expand Up @@ -80,8 +80,7 @@ public void SettingInvalidAttributes_Unix(FileAttributes attributes)

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.FileCreateCaseSensitive))]
[InlineData(FileAttributes.Hidden)]
[PlatformSpecific(TestPlatforms.AnyUnix & ~(TestPlatforms.OSX | TestPlatforms.FreeBSD))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[PlatformSpecific(TestPlatforms.AnyUnix & ~(TestPlatforms.OSX | TestPlatforms.FreeBSD | 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 @@ -468,7 +468,7 @@ public void DriveLetter_Windows()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)] // drive letters casing
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void DriveLetter_Unix()
{
// On Unix, there's no special casing for drive letters. These may or may not be valid names, depending
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void DeletingSymLinkDoesntDeleteTarget()
}

[ConditionalFact(nameof(UsingNewNormalization))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void ExtendedDirectoryWithSubdirectories()
{
DirectoryInfo testDir = Directory.CreateDirectory(IOInputs.ExtendedPrefix + GetTestFilePath());
Expand All @@ -132,7 +132,7 @@ public void ExtendedDirectoryWithSubdirectories()
}

[ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void LongPathExtendedDirectory()
{
DirectoryInfo testDir = Directory.CreateDirectory(IOServices.GetPath(IOInputs.ExtendedPrefix + TestDirectory, characterCount: 500));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public void ExtendedPathAlreadyExistsAsFile()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Makes call to native code (libc)
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void FalseForNonRegularFile()
{
string fileName = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ public void WindowsSearchPatternWhitespace()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.FileCreateCaseSensitive))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
public void SearchPatternCaseSensitive()
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class Directory_GetLogicalDrives
{
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Valid drive strings on Unix
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
public void GetsValidDriveStrings_Unix()
{
string[] drives = Directory.GetLogicalDrives();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void FalseForFile()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void FalseForNonRegularFile()
{
string fileName = GetTestFilePath();
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.IO.FileSystem/tests/File/Exists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void PathAlreadyExistsAsDirectory()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void FalseForNonRegularFile()
{
string fileName = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static async Task WaitConnectionAndWritePipeStreamAsync(NamedPipeServerStream na

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public async Task ReadAllBytes_NonSeekableFileStream_InUnix()
{
string fifoPath = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static async Task WaitConnectionAndWritePipeStreamAsync(NamedPipeServerStream na

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public async Task ReadAllBytesAsync_NonSeekableFileStream_InUnix()
{
string fifoPath = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void FalseForDirectory()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void TrueForNonRegularFile()
{
string fileName = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public async Task CharacterDevice_WriteAllTextAsync(string devicePath)

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task NamedPipe_ReadWrite()
{
string fifoPath = GetTestFilePath();
Expand All @@ -85,8 +85,8 @@ await Task.WhenAll(

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task NamedPipe_ReadWrite_Async()
{
string fifoPath = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void PathAlreadyExistsAsDirectory()

[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void TrueForNonRegularFile()
{
string fileName = GetTestFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ public static void ReservedPipeName_Throws_ArgumentOutOfRangeException(PipeDirec

[Fact]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public static void Create_PipeName()
{
new NamedPipeServerStream(PipeStreamConformanceTests.GetUniquePipeName()).Dispose();
}

[Fact]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public static void Create_PipeName_Direction_MaxInstances()
{
new NamedPipeServerStream(PipeStreamConformanceTests.GetUniquePipeName(), PipeDirection.Out, 1).Dispose();
Expand Down Expand Up @@ -208,6 +210,7 @@ public static void Windows_CreateFromDisposedServerHandle_Throws_ObjectDisposedE
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)] // accessing SafePipeHandle on Unix fails for a non-connected stream
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public static void Unix_GetHandleOfNewServerStream_Throws_InvalidOperationException()
{
using (var pipe = new NamedPipeServerStream(PipeStreamConformanceTests.GetUniquePipeName(), PipeDirection.Out, 1, PipeTransmissionMode.Byte))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void ConnectWithConflictingDirections_Throws_UnauthorizedAccessException(
[InlineData(1)]
[InlineData(3)]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task MultipleWaitingClients_ServerServesOneAtATime(int numClients)
{
string name = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -122,6 +123,7 @@ async Task ConnectClientAndReadAsync()

[Fact]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public void MaxNumberOfServerInstances_TooManyServers_Throws()
{
string name = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -160,6 +162,7 @@ public void MaxNumberOfServerInstances_TooManyServers_Throws()
[InlineData(1)]
[InlineData(4)]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task MultipleServers_ServeMultipleClientsConcurrently(int numServers)
{
string name = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -357,6 +360,7 @@ public async Task Windows_GetImpersonationUserName_Succeed(TokenImpersonationLev
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invoke to verify the user name
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task Unix_GetImpersonationUserName_Succeed()
{
string pipeName = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -388,6 +392,7 @@ public void Unix_MessagePipeTransmissionMode()
[InlineData(PipeDirection.InOut)]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Unix implementation uses bidirectional sockets
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public static void Unix_BufferSizeRoundtripping(PipeDirection direction)
{
int desiredBufferSize = 0;
Expand Down Expand Up @@ -452,6 +457,7 @@ public static void Windows_BufferSizeRoundtripping()

[Fact]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public async Task PipeTransmissionMode_Returns_Byte()
{
string pipeName = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -508,6 +514,7 @@ public void Windows_SetReadModeTo__PipeTransmissionModeByte()
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Unix doesn't currently support message mode
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public void Unix_SetReadModeTo__PipeTransmissionModeByte()
{
string pipeName = PipeStreamConformanceTests.GetUniquePipeName();
Expand Down Expand Up @@ -549,6 +556,7 @@ public void Unix_SetReadModeTo__PipeTransmissionModeByte()
[InlineData(PipeDirection.Out, PipeDirection.In)]
[InlineData(PipeDirection.In, PipeDirection.Out)]
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public void InvalidReadMode_Throws_ArgumentOutOfRangeException(PipeDirection serverDirection, PipeDirection clientDirection)
{
string pipeName = PipeStreamConformanceTests.GetUniquePipeName();
Expand All @@ -567,6 +575,7 @@ public void InvalidReadMode_Throws_ArgumentOutOfRangeException(PipeDirection ser
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Checks MaxLength for PipeName on Unix
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
public void NameTooLong_MaxLengthPerPlatform()
{
// Increase a name's length until it fails
Expand Down
Loading