diff options
author | Alex Perovich <alperovi@microsoft.com> | 2017-04-14 03:53:04 +0300 |
---|---|---|
committer | Alex Perovich <alperovi@microsoft.com> | 2017-04-14 03:53:04 +0300 |
commit | 518e739ee935bb00b375b757330f74368957ad90 (patch) | |
tree | 6002460c6f91013ba81560fa70c48ab9d079b0b1 /src/System.IO.FileSystem | |
parent | 7f601f5637bfbef8a9297b00a26139183df6fb41 (diff) |
Fix S.IO.FileSystem tests running on uapaot
Diffstat (limited to 'src/System.IO.FileSystem')
4 files changed, 47 insertions, 8 deletions
diff --git a/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs b/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs new file mode 100644 index 0000000000..840084766c --- /dev/null +++ b/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using Xunit; + +namespace System.IO.Tests +{ + public abstract partial class FileSystemTest + { + [DllImport("libc", SetLastError = true)] + protected static extern int geteuid(); + + [DllImport("libc", SetLastError = true)] + protected static extern int mkfifo(string path, int mode); + } +} diff --git a/src/System.IO.FileSystem/tests/FileSystemTest.Windows.cs b/src/System.IO.FileSystem/tests/FileSystemTest.Windows.cs new file mode 100644 index 0000000000..1af2351a0e --- /dev/null +++ b/src/System.IO.FileSystem/tests/FileSystemTest.Windows.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using Xunit; + +namespace System.IO.Tests +{ + public abstract partial class FileSystemTest + { + protected static int geteuid() + { + throw new PlatformNotSupportedException(); + } + + protected static int mkfifo(string path, int mode) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/System.IO.FileSystem/tests/FileSystemTest.cs b/src/System.IO.FileSystem/tests/FileSystemTest.cs index a896692832..1386fcbf23 100644 --- a/src/System.IO.FileSystem/tests/FileSystemTest.cs +++ b/src/System.IO.FileSystem/tests/FileSystemTest.cs @@ -2,12 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Runtime.InteropServices; using Xunit; namespace System.IO.Tests { - public abstract class FileSystemTest : FileCleanupTestBase + public abstract partial class FileSystemTest : FileCleanupTestBase { public static readonly byte[] TestBuffer = { 0xBA, 0x5E, 0xBA, 0x11, 0xF0, 0x07, 0xBA, 0x11 }; @@ -52,11 +51,5 @@ namespace System.IO.Tests return success; } } - - [DllImport("libc", SetLastError = true)] - protected static extern int geteuid(); - - [DllImport("libc", SetLastError = true)] - protected static extern int mkfifo(string path, int mode); } } diff --git a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj index f69a7df2bc..7749fa5fbe 100644 --- a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj +++ b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj @@ -30,6 +30,12 @@ <Link>Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs</Link> </Compile> </ItemGroup> + <ItemGroup Condition="'$(TargetsUnix)' == 'true'"> + <Compile Include="FileSystemTest.Unix.cs" /> + </ItemGroup> + <ItemGroup Condition="'$(TargetsWindows)' == 'true'"> + <Compile Include="FileSystemTest.Windows.cs" /> + </ItemGroup> <ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'"> <Compile Include="File\AppendAsync.cs" /> <Compile Include="File\ReadWriteAllLinesAsync.cs" /> |