Skip to content

Commit 18d9496

Browse files
authored
fix few Filesystem tests on FreeBSD (#65059)
* fix few FileSystem tests on FreeBSD * fix MoveDirectory_FailToMoveLowerCaseDirectoryWhenUpperCaseDirectoryExists * feedback from review
1 parent 6e99b58 commit 18d9496

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static partial class PlatformDetection
4444
public static bool IsAppleMobile => IsMacCatalyst || IsiOS || IstvOS;
4545
public static bool IsNotAppleMobile => !IsAppleMobile;
4646
public static bool IsNotNetFramework => !IsNetFramework;
47+
public static bool IsBsdLike => IsOSXLike || IsFreeBSD || IsNetBSD;
4748

4849
public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm;
4950
public static bool IsNotArmProcess => !IsArmProcess;

src/libraries/System.IO.FileSystem/tests/Directory/Move.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public void MoveDirectory_NoOpWhenMovingDirectoryWithUpperCaseToOtherDirectoryWi
343343
}
344344

345345
[Fact]
346-
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX | TestPlatforms.FreeBSD | TestPlatforms.NetBSD)]
346+
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX)]
347347
public void MoveDirectory_FailToMoveLowerCaseDirectoryWhenUpperCaseDirectoryExists()
348348
{
349349
Directory.CreateDirectory($"{TestDirectory}/bar/FOO");

src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Unix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ private static long GetAllocatedSize(FileStream fileStream)
1515
using var px = Process.Start(new ProcessStartInfo
1616
{
1717
FileName = "stat",
18-
ArgumentList = { isOSX ? "-f" : "-c",
19-
isOSX ? "%b %k" : "%b %B",
18+
ArgumentList = { PlatformDetection.IsBsdLike ? "-f" : "-c",
19+
PlatformDetection.IsBsdLike ? "%b %k" : "%b %B",
2020
fileStream.Name },
2121
RedirectStandardOutput = true
2222
});

0 commit comments

Comments
 (0)