forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use O_TRUNC when file locking is disabled, avoid ftruncate syscall (d…
…otnet#55456) * add test project with file locking disabled via config file * use O_TRUNC when file locking is disabled, avoid ftruncate syscall * Apply suggestions from code review Co-authored-by: Stephen Toub <[email protected]>
- Loading branch information
1 parent
004feb8
commit 2eb0071
Showing
17 changed files
with
95 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ies/System.IO.FileSystem/tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Xunit; | ||
|
||
namespace System.IO.Tests | ||
{ | ||
public class DisabledFileLockingSwitchTests | ||
{ | ||
[Fact] | ||
public static void ConfigSwitchIsHonored() | ||
{ | ||
Assert.Equal(OperatingSystem.IsWindows(), PlatformDetection.IsFileLockingEnabled); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...stem/tests/DisabledFileLockingTests/System.IO.FileSystem.DisabledFileLocking.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<IncludeRemoteExecutor>true</IncludeRemoteExecutor> | ||
<!-- file locking can't be disabled on Windows --> | ||
<TargetFrameworks>$(NetCoreAppCurrent)-Unix</TargetFrameworks> | ||
|
||
<WasmXHarnessMonoArgs>--working-dir=/test-dir</WasmXHarnessMonoArgs> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="DisabledFileLockingSwitchTests.cs" /> | ||
<Compile Include="..\FSAssert.cs" /> | ||
<Compile Include="..\TestData.cs" /> | ||
<Compile Include="..\FileSystemTest.cs" /> | ||
<Compile Include="..\FileSystemTest.Unix.cs" /> | ||
<Compile Include="..\UnseekableFileStream.cs" /> | ||
<Compile Include="..\FileStream\**\*.cs" /> | ||
<Compile Include="..\PortedCommon\DllImports.cs" /> | ||
<Compile Include="..\PortedCommon\IOInputs.cs" /> | ||
<Compile Include="..\PortedCommon\IOServices.cs" /> | ||
<Compile Include="$(CommonTestPath)System\IO\PathFeatures.cs" Link="Common\System\IO\PathFeatures.cs" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(TargetsUnix)' == 'true'"> | ||
<Compile Remove="..\**\*.Windows.cs" /> | ||
<Compile Remove="..\**\*.Browser.cs" /> | ||
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs" Link="Interop\Unix\Interop.Libraries.cs" /> | ||
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Stat.cs" Link="Interop\Unix\System.Native\Interop.Stat.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="$(CommonTestPath)StreamConformanceTests\StreamConformanceTests.csproj" /> | ||
</ItemGroup> | ||
</Project> |
5 changes: 5 additions & 0 deletions
5
...libraries/System.IO.FileSystem/tests/DisabledFileLockingTests/runtimeconfig.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"configProperties": { | ||
"System.IO.DisableFileLocking": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters