Skip to content

Commit 5553691

Browse files
authored
Consolidate approach for conditional tests that check for privileged processes (#78793)
* Consolidate approach for conditional tests that check for privileged processes * Simpler privileged process helpers * Revert SLN file changes * Remove platform-specific helpers for privileged process conditions * Fix System.IO tests for unix-specific privileged process scenarios * Browser does not support privileged processes * Fix System.IO tests for unix-specific privileged process scenarios * Enable the Environment.IsPrivilegedProcess test for browser * PR feedback Omit [PlatformSpecific] in modified tests that are in platform-specific test files. Remove [Outerloop] attributes from privileged process tests. Better multithreaded handling in PlatformDetection.IsPrivilegedProcess
1 parent c7460d0 commit 5553691

File tree

47 files changed

+139
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+139
-179
lines changed

src/libraries/Common/tests/System/IO/ReparsePointUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static partial class MountHelper
6060
// Reduce the risk we accidentally stop running these altogether
6161
// on Windows, due to a bug in CreateSymbolicLink
6262
if (!success && PlatformDetection.IsWindows)
63-
Assert.True(!PlatformDetection.IsWindowsAndElevated);
63+
Assert.False(PlatformDetection.IsPrivilegedProcess);
6464

6565
return success;
6666
});

src/libraries/Common/tests/TestUtilities/System/AdminHelpers.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public static int RunAsSudo(string commandLine)
3434

3535
public static unsafe bool IsProcessElevated()
3636
{
37+
// Browser does not have the concept of an elevated process
38+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")))
39+
{
40+
return false;
41+
}
42+
3743
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
3844
{
3945
uint userId = Interop.Sys.GetEUid();

src/libraries/Common/tests/TestUtilities/System/IO/FileCleanupTestBase.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ namespace System.IO
1414
/// <summary>Base class for test classes the use temporary files that need to be cleaned up.</summary>
1515
public abstract partial class FileCleanupTestBase : IDisposable
1616
{
17-
private static readonly Lazy<bool> s_isElevated = new Lazy<bool>(() => AdminHelpers.IsProcessElevated());
18-
1917
private string fallbackGuid = Guid.NewGuid().ToString("N").Substring(0, 10);
2018

21-
protected static bool IsProcessElevated => s_isElevated.Value;
22-
2319
/// <summary>Initialize the test class base. This creates the associated test directory.</summary>
2420
protected FileCleanupTestBase(string tempDirectory = null)
2521
{

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ public static partial class PlatformDetection
5555
public static bool IsNotFedoraOrRedHatFamily => !IsFedora && !IsRedHatFamily;
5656
public static bool IsNotDebian10 => !IsDebian10;
5757

58-
public static bool IsSuperUser => IsBrowser || IsWindows ? false : libc.geteuid() == 0;
59-
60-
public static bool IsUnixAndSuperUser => !IsWindows && IsSuperUser;
61-
6258
public static Version OpenSslVersion => !IsOSXLike && !IsWindows && !IsAndroid ?
6359
GetOpenSslVersion() :
6460
throw new PlatformNotSupportedException();

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -248,31 +248,8 @@ public static bool IsInAppContainer
248248
}
249249
}
250250

251-
public static bool CanRunImpersonatedTests => PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsWindowsAndElevated;
251+
public static bool CanRunImpersonatedTests => PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsWindows && PlatformDetection.IsPrivilegedProcess;
252252

253253
public static bool IsWindowsX86OrX64 => PlatformDetection.IsWindows && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process);
254-
255-
private static int s_isWindowsElevated = -1;
256-
public static bool IsWindowsAndElevated
257-
{
258-
get
259-
{
260-
if (s_isWindowsElevated != -1)
261-
return s_isWindowsElevated == 1;
262-
263-
if (!IsWindows || IsInAppContainer)
264-
{
265-
s_isWindowsElevated = 0;
266-
return false;
267-
}
268-
269-
s_isWindowsElevated = AdminHelpers.IsProcessElevated() ? 1 : 0;
270-
271-
return s_isWindowsElevated == 1;
272-
}
273-
}
274-
275-
public static bool IsWindowsAndNotElevated
276-
=> IsWindows && !IsWindowsAndElevated;
277254
}
278255
}

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,23 @@ public static partial class PlatformDetection
7373
public static bool Is64BitProcess => IntPtr.Size == 8;
7474
public static bool IsNotWindows => !IsWindows;
7575

76+
private static volatile int s_isPrivilegedProcess = -1;
77+
public static bool IsPrivilegedProcess
78+
{
79+
get
80+
{
81+
int p = s_isPrivilegedProcess;
82+
if (p == -1)
83+
{
84+
s_isPrivilegedProcess = p = AdminHelpers.IsProcessElevated() ? 1 : 0;
85+
}
86+
87+
return p == 1;
88+
}
89+
}
90+
91+
public static bool IsNotPrivilegedProcess => !IsPrivilegedProcess;
92+
7693
public static bool IsMarshalGetExceptionPointersSupported => !IsMonoRuntime && !IsNativeAot;
7794

7895
private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => AssemblyConfigurationEquals("Checked"));

src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public sealed partial class WindowsTestAccount : IDisposable
3939

4040
public WindowsTestAccount(string userName)
4141
{
42-
Assert.True(PlatformDetection.IsWindowsAndElevated);
42+
Assert.True(PlatformDetection.IsWindows);
43+
Assert.True(PlatformDetection.IsPrivilegedProcess);
4344

4445
_userName = userName;
4546
Password = GeneratePassword();

src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public class ProcessStartInfoTests : ProcessTestBase
2727
private const string ItemSeparator = "CAFF9451396B4EEF8A5155A15BDC2080"; // random string that shouldn't be in any env vars; used instead of newline to separate env var strings
2828

2929
private static bool IsAdmin_IsNotNano_RemoteExecutorIsSupported
30-
=> PlatformDetection.IsWindowsAndElevated && PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported;
30+
=> PlatformDetection.IsWindows && PlatformDetection.IsNotWindowsNanoServer
31+
&& PlatformDetection.IsPrivilegedProcess && RemoteExecutor.IsSupported;
3132

3233
[Fact]
3334
public void TestEnvironmentProperty()

src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace System.Diagnostics.Tests
2020
{
2121
public partial class ProcessTests : ProcessTestBase
2222
{
23-
private static bool IsRemoteExecutorSupportedAndOnUnixAndSuperUser => RemoteExecutor.IsSupported && PlatformDetection.IsUnixAndSuperUser;
23+
private static bool IsRemoteExecutorSupportedAndPrivilegedProcess => RemoteExecutor.IsSupported && PlatformDetection.IsPrivilegedProcess;
2424

2525
[Fact]
2626
private void TestWindowApisUnix()
@@ -456,7 +456,7 @@ public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgumentAr
456456
}
457457
}
458458

459-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsUnixAndSuperUser))]
459+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPrivilegedProcess))]
460460
public void TestPriorityClassUnix()
461461
{
462462
CreateDefaultProcess();
@@ -478,11 +478,11 @@ public void TestPriorityClassUnix()
478478
}
479479
catch (Win32Exception ex)
480480
{
481-
Assert.True(!PlatformDetection.IsSuperUser, $"Failed even though superuser {ex.ToString()}");
481+
Assert.False(PlatformDetection.IsPrivilegedProcess, $"Failed even though superuser {ex.ToString()}");
482482
}
483483
}
484484

485-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsUnixAndSuperUser))]
485+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPrivilegedProcess))]
486486
public void TestBasePriorityOnUnix()
487487
{
488488
CreateDefaultProcess();
@@ -499,7 +499,7 @@ public void TestBasePriorityOnUnix()
499499
}
500500
catch (Win32Exception ex)
501501
{
502-
Assert.True(!PlatformDetection.IsSuperUser, $"Failed even though superuser {ex.ToString()}");
502+
Assert.False(PlatformDetection.IsPrivilegedProcess, $"Failed even though superuser {ex.ToString()}");
503503
}
504504
}
505505

@@ -596,8 +596,7 @@ public void TestCheckChildProcessUserAndGroupIds()
596596
/// Tests when running as root and starting a new process as a normal user,
597597
/// the new process doesn't have elevated privileges.
598598
/// </summary>
599-
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndOnUnixAndSuperUser))]
600-
[OuterLoop("Needs sudo access")]
599+
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))]
601600
[InlineData(true)]
602601
[InlineData(false)]
603602
public unsafe void TestCheckChildProcessUserAndGroupIdsElevated(bool useRootGroups)
@@ -743,7 +742,6 @@ private static async Task<bool> TryWaitProcessReapedAsync(int pid, int timeoutMs
743742
/// Tests the ProcessWaitState reference count drops to zero.
744743
/// </summary>
745744
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
746-
[PlatformSpecific(TestPlatforms.AnyUnix)] // Test validates Unix implementation
747745
public async Task TestProcessWaitStateReferenceCount()
748746
{
749747
using (var exitedEventSemaphore = new SemaphoreSlim(0, 1))
@@ -833,7 +831,6 @@ public void TestProcessRecycledPid()
833831
Assert.True(foundRecycled);
834832
}
835833

836-
[PlatformSpecific(TestPlatforms.AnyUnix)]
837834
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
838835
[InlineData("/dev/stdin", O_RDONLY)]
839836
[InlineData("/dev/stdout", O_WRONLY)]

src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,8 @@ public void Start_PassesArgumentsList_WhichGetsEscaped()
25462546
}
25472547
}
25482548

2549-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsAndNotElevated))]
2549+
[PlatformSpecific(TestPlatforms.Windows)]
2550+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotPrivilegedProcess))]
25502551
public void NonElevatedUser_QueryProcessNameOfSystemProcess()
25512552
{
25522553
const string Services = "services";

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.Etw.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System;
45
using System.Collections.Generic;
56
#if USE_MDT_EVENTSOURCE
67
using Microsoft.Diagnostics.Tracing;
@@ -14,7 +15,7 @@ public partial class FuzzyTests
1415
{
1516
static partial void Test_Write_Fuzzy_TestEtw(List<SubTest> tests, EventSource logger)
1617
{
17-
if (TestUtilities.IsProcessElevated)
18+
if (PlatformDetection.IsPrivilegedProcess)
1819
{
1920
using (var listener = new EtwListener())
2021
{

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.Etw.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ namespace BasicEventSourceTests
88
{
99
public partial class TestEventCounter
1010
{
11-
// Specifies whether the process is elevated or not.
12-
private static bool IsProcessElevated => Environment.IsPrivilegedProcess;
13-
14-
[ConditionalFact(nameof(IsProcessElevated))]
11+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPrivilegedProcess))]
1512
[ActiveIssue("https://github.com/dotnet/runtime/issues/25035")]
1613
public void Test_Write_Metric_ETW()
1714
{

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ namespace BasicEventSourceTests
1515
{
1616
internal class TestUtilities
1717
{
18-
// Specifies whether the process is elevated or not.
19-
internal static bool IsProcessElevated => Environment.IsPrivilegedProcess;
20-
2118
/// <summary>
2219
/// Confirms that there are no EventSources running.
2320
/// </summary>

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ namespace BasicEventSourceTests
2525
public partial class TestsManifestGeneration
2626
{
2727
// Specifies whether the process is elevated or not.
28-
private static bool IsProcessElevated => Environment.IsPrivilegedProcess;
2928
private static bool IsProcessElevatedAndNotWindowsNanoServerAndRemoteExecutorSupported =>
30-
IsProcessElevated && PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported;
29+
PlatformDetection.IsPrivilegedProcess && PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported;
3130

3231
/// ETW only works with elevated process
3332
[ConditionalFact(nameof(IsProcessElevatedAndNotWindowsNanoServerAndRemoteExecutorSupported))]

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.Etw.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void Test_BadEventSource_MismatchedIds_WithEtwListener()
2121
{
2222
// We expect only one session to be on when running the test but if a ETW session was left
2323
// hanging, it will confuse the EventListener tests.
24-
if (TestUtilities.IsProcessElevated)
24+
if (PlatformDetection.IsPrivilegedProcess)
2525
{
2626
EtwListener.EnsureStopped();
2727
}
@@ -31,7 +31,7 @@ public void Test_BadEventSource_MismatchedIds_WithEtwListener()
3131

3232
var listenerGenerators = new List<Func<Listener>> { () => new EventListenerListener() };
3333

34-
if (TestUtilities.IsProcessElevated)
34+
if (PlatformDetection.IsPrivilegedProcess)
3535
{
3636
listenerGenerators.Add(() => new EtwListener());
3737
}

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.Etw.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ namespace BasicEventSourceTests
1111
public partial class TestsWrite
1212
{
1313
// Specifies whether the process is elevated or not.
14-
private static bool IsProcessElevated => Environment.IsPrivilegedProcess;
1514
private static bool IsProcessElevatedAndNotWindowsNanoServer =>
16-
IsProcessElevated && PlatformDetection.IsNotWindowsNanoServer; // ActiveIssue: https://github.com/dotnet/runtime/issues/26197
15+
PlatformDetection.IsPrivilegedProcess && PlatformDetection.IsNotWindowsNanoServer; // ActiveIssue: https://github.com/dotnet/runtime/issues/26197
1716

1817
/// <summary>
1918
/// Tests the EventSource.Write[T] method (can only use the self-describing mechanism).
@@ -30,7 +29,7 @@ public void Test_Write_T_ETW()
3029

3130
[ActiveIssue("https://github.com/dotnet/runtime/issues/21295", TargetFrameworkMonikers.NetFramework)]
3231
[ActiveIssue("https://github.com/dotnet/runtime/issues/25035")]
33-
[ConditionalFact(nameof(IsProcessElevated))]
32+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPrivilegedProcess))]
3433
public void Test_Write_T_In_Manifest_Serialization_WithEtwListener()
3534
{
3635
using (var eventListener = new EventListenerListener())

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.Etw.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ namespace BasicEventSourceTests
1111
partial class TestsWriteEvent
1212
{
1313
// Specifies whether the process is elevated or not.
14-
private static bool IsProcessElevated => Environment.IsPrivilegedProcess;
1514
private static bool IsProcessElevatedAndNotWindowsNanoServer =>
16-
IsProcessElevated && PlatformDetection.IsNotWindowsNanoServer; // ActiveIssue: https://github.com/dotnet/runtime/issues/26197
15+
PlatformDetection.IsPrivilegedProcess && PlatformDetection.IsNotWindowsNanoServer; // ActiveIssue: https://github.com/dotnet/runtime/issues/26197
1716

1817
/// <summary>
1918
/// Tests WriteEvent using the manifest based mechanism.
@@ -84,7 +83,7 @@ public void Test_WriteEvent_ByteArray_SelfDescribing_ETW()
8483

8584
static partial void Test_WriteEvent_AddEtwTests(List<SubTest> tests, EventSourceTest logger)
8685
{
87-
if (!IsProcessElevated)
86+
if (!PlatformDetection.IsPrivilegedProcess)
8887
{
8988
return;
9089
}

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ namespace BasicEventSourceTests
1414
{
1515
public partial class TestsWriteEventToListener
1616
{
17-
// Specifies whether the process is elevated or not.
18-
private static bool IsProcessElevated => Environment.IsPrivilegedProcess;
19-
20-
[ConditionalFact(nameof(IsProcessElevated))]
17+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPrivilegedProcess))]
2118
public void Test_WriteEvent_TransferEvents()
2219
{
2320
TestUtilities.CheckNoEventSourcesRunning("Start");

src/libraries/System.Formats.Tar/tests/TarEntry/TarEntry.ExtractToFile.Tests.Unix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static IEnumerable<object[]> GetFormatsAndSpecialFiles()
2323
}
2424
}
2525

26-
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndOnUnixAndSuperUser))]
26+
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))]
2727
[MemberData(nameof(GetFormatsAndSpecialFiles))]
2828
public void Extract_SpecialFiles(TarEntryFormat format, TarEntryType entryType)
2929
{
@@ -36,7 +36,7 @@ public void Extract_SpecialFiles(TarEntryFormat format, TarEntryType entryType)
3636
Verify_Extract_SpecialFiles(destination, entry, entryType);
3737
}
3838

39-
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndOnUnixAndSuperUser))]
39+
[ConditionalTheory(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))]
4040
[MemberData(nameof(GetFormatsAndSpecialFiles))]
4141
public async Task Extract_SpecialFiles_Async(TarEntryFormat format, TarEntryType entryType)
4242
{

src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace System.Formats.Tar.Tests
99
{
1010
public partial class TarFile_ExtractToDirectory_File_Tests : TarTestsBase
1111
{
12-
[ConditionalFact(nameof(IsUnixButNotSuperUser))]
12+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotPrivilegedProcess))]
1313
public void Extract_SpecialFiles_Unix_Unelevated_ThrowsUnauthorizedAccess()
1414
{
1515
string originalFileName = GetTarFilePath(CompressionMethod.Uncompressed, TestTarFormat.ustar, "specialfiles");

src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.File.Tests.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace System.Formats.Tar.Tests
1010
{
1111
public partial class TarFile_ExtractToDirectoryAsync_File_Tests : TarTestsBase
1212
{
13-
[ConditionalFact(nameof(IsUnixButNotSuperUser))]
13+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotPrivilegedProcess))]
1414
public async Task Extract_SpecialFiles_Unix_Unelevated_ThrowsUnauthorizedAccess_Async()
1515
{
1616
using (TempDirectory root = new TempDirectory())

src/libraries/System.Formats.Tar/tests/TarReader/TarReader.TarEntry.ExtractToFile.Tests.Unix.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace System.Formats.Tar.Tests
99
{
1010
public partial class TarReader_TarEntry_ExtractToFile_Tests : TarTestsBase
1111
{
12-
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.tvOS)] // https://github.com/dotnet/runtime/issues/68360
13-
[ConditionalFact(nameof(IsUnixButNotSuperUser), nameof(IsNotLinuxBionic))]
12+
[SkipOnPlatform(TestPlatforms.tvOS, "https://github.com/dotnet/runtime/issues/68360")]
13+
[SkipOnPlatform(TestPlatforms.LinuxBionic, "Not supported on Bionic")]
14+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotPrivilegedProcess))]
1415
public void SpecialFile_Unelevated_Throws()
1516
{
1617
using TempDirectory root = new TempDirectory();

src/libraries/System.Formats.Tar/tests/TarReader/TarReader.TarEntry.ExtractToFileAsync.Tests.Unix.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace System.Formats.Tar.Tests
99
{
1010
public partial class TarReader_TarEntry_ExtractToFileAsync_Tests : TarTestsBase
1111
{
12-
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.tvOS)] // https://github.com/dotnet/runtime/issues/68360
13-
[ConditionalFact(nameof(IsUnixButNotSuperUser), nameof(IsNotLinuxBionic))]
12+
[SkipOnPlatform(TestPlatforms.LinuxBionic, "Unsupported on Bionic")]
13+
[SkipOnPlatform(TestPlatforms.tvOS, "https://github.com/dotnet/runtime/issues/68360")]
14+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotPrivilegedProcess))]
1415
public async Task SpecialFile_Unelevated_Throws_Async()
1516
{
1617
using (TempDirectory root = new TempDirectory())

0 commit comments

Comments
 (0)