* File.Unix: Replace: increase Windows compatibility
- When source and destination are not a file throw UnauthorizedAccessException.
- When source and destination are the same file throw IOException.
* Include paths in exception message
Co-authored-by: Jeff Handley <[email protected]>
* 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]>
* Handle FileOptions.DeleteOnClose on Unix in SafeFileHandle.Dispose
* Move file path into SafeFileHandle on Windows as well
Doing so enables cleaning up a bunch of passing around of the file path, while also enabling the path to be fed to more error paths.
* Update Net5Compat impl as well
* add more tests
* StreamWriter and StreamReader require FileStreamOptions with necessary access
* allow for bufferSize == 0
* extend the test
* refactor the tests
* Revert "allow for bufferSize == 0"
This reverts commit f1259be18a3446c1b8939883f484cc28347c74cf.
* add a test for unseekable device by using a path to named pipe
* add a test for seekable device by using DeviceID instead of drive letter
* add a test for a UNC file path (local file share)
* Return constants in PathInternal.GetIsCaseSensitive() on mobile platforms
In particular on Android probing using I/O is slow and contributes to slow app startup.
Fixes https://github.com/dotnet/runtime/issues/54339
* Implement Path.IsCaseSensitive as PathInternal.IsCaseSensitive
Also Path.StringComparison => PathInternal.StringComparison
* Add test for PathInternal.IsCaseSensitive
Move GetIsCaseSensitiveByProbing to FileSystemTest
* Drop PathInternal.s_isCaseSensitive cache field
* Delete Path.IsCaseSensitive and Path.StringComparison
update callers to use PathInternal.IsCaseSensitive and PathInternal.StringComparison
* Remove catch clause from GetIsCaseSensitiveByProbing
* Mark new test [OuterLoop]
* Apply suggestions from code review
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
* Bump emscripten version
* Rename __padding to _padding to avoid warnings
And errors as we use `-Werror`:
error G94F6014A: identifier '__padding' is reserved because it starts with '__'
C99 and C++ standard defines indentifiers with `__` prefix as reserved.
* Fix cast warning/error
With latest emscripten we get this warning (and error as we use
`-Werror`):
src/libraries/Native/Unix/System.Native/pal_process.c(374,92): error G3DC5E52A: cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type [-Werror,-Wcast-function-type]
void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;
* Add `-s DISABLE_EXCEPTION_CATCHING=0`
when building dotnet.js
* Use EMSDK_PYTHON
* Use delayed expansion
Before the `EMSDK_PYTHON` was evaluated before running
the `emsdk_env.bat` script.
* Replace deprecated EXTRA_EXPORTED_RUNTIME_METHODS
with EXPORTED_RUNTIME_METHODS
Build warning/error:
emcc : warning : EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]
* Don't need to cast anymore
* 2.0.21 was just released, so try our luck ;-)
* Use new docker images with 2.0.21
* Use the sys includes fix on all platforms
* Remove deprecated --llvm-opts usage
Context: https://github.com/emscripten-core/emscripten/commit/0691cc68eef89fe59f66eacdba245470bea2a113
* Update emscripten version in the workload manifest
* Update emscripten versions in the docs
* Update eng/ versions
* Add ActiveIssue attr in the MemoryCacheTest
* Add ActiveIssue attr to the FileSystem tests
* Update after merge
* Resolve one more conflict
* Add ActiveIssue to the MemoryMappedFiles tests
* Revert "Fix cast warning/error"
This reverts commit 0a1aa4a88c07bc48d3d35c68369d1dca4897d849.
* Unset HAVE_FORK for Browser
* Remove active issue
Fixed by https://github.com/dotnet/runtime/commit/93cf5df65fc13bfbc29256acc8c9c0e102a1170b
* Set HAVE_FORK to 0
* Set HAVE_FORK to 0 instead if unsetting
* Remove -s DISABLE_EXCEPTION_CATCHING=0
It might not be needed anymore
* Fix: Avoid throwing on FileSystemEntry.Initialize
* Add unit tests that verify cyclic symbolic links
* Fix Windows-specific unit test failures
* Use OperatingSystem.IsWindows()
* CHange 'Assert.Equal(1, ' to 'Assert.Single('
* Rename helper method that creates self referencing symlink
* Spacing
* ConditionalClass for CanCreateSymbolicLinks
* ConditionalClass does not work in browser/ios/android, use ConditionalFact/ConditionalTheory
Co-authored-by: carlossanlop <Carlos Sanchez [email protected]>
Co-authored-by: carlossanlop <[email protected]>
* extend FileStreamOptions with BufferSize
* allow to disable the buffering by setting bufferSize to 0
* Apply suggestions from code review
Co-authored-by: David Cantú <[email protected]>
In effort to assess the state of the iOS library tests, a number of tests will be skipped
Test suites that crash, hang, or have a significant number of failures (mostly 20+ failing unique test methods) are skipped on at the `tests.proj` level. Otherwise, `[ActiveIssue]` attributes have been attached to either the individual test methods that fail or the entire class if the whole test class fails. Any pre-existing `ActiveIssue` attribute associated with iOS had been reassessed to either remain or be closed.
A few test suites have been skipped because they fail with some form of `PlatformNotSupportedException`. `[SkipOnPlatform]` attributes are attached to the failing test methods.
All of the Issues can be tracked at https://github.com/dotnet/runtime/projects/48#column-9236436
The ActiveIssues and `tests.proj` exclusions have been tested on https://github.com/dotnet/runtime/pull/49917 as well.
-----------
This PR makes the following changes in the following files:
`src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj` - Removed `$(NetCoreAppCurrent)-iOS` from target frameworks as it is stated to currently only supported on Windows.
`src/libraries/tests.proj` - Update the test suites that need to be skipped at the project level, reducing the number and categorizing as a skip due to PNSE, a skip due to numerous failures, and a skip due to the suite crashing.
The remaining files changed are either:
`[ActiveIssue("<issue-url>", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]`
`[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")]`
Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Tammy Qiu <[email protected]>
* replacing GetLastWin32Error with GetLastPInvokeError in remaining assemblies
* replace GetLastWin32Error with GetLastPInvokeError in assemblies outside system.private.corelib
* Apply suggestions from code review
Co-authored-by: Jan Kotas <[email protected]>
* Hidden and ReadOnly unit tests.
* Unix: Correctly collect ReadOnly and Hidden flags from files and directories.
* Remove the _initialAttributes field from FileStatus. Directly call _status.GetAttributes from FileSYstemEntry.Attributes since the disk hit is necessary anyway.
* Address simplication and nullcheck suggestions
* Defering some more file checking actions to FileStatus. Addressing accessibility of methods/properties. Addressing suggestions.
* Address feedback: Remove unnecessary asserts but document why. Remove struct initialization. Simplify the order in which Initialize checks for unknown and symlink and add a comment.
* Cache egid and euid, and refresh should reset them
* Check IsNameHidden before ensuring cache initialized and checking HasHiddenFlag.
* The ifs inside FileSystemEntry.Initialize has two mutually exclusive conditions: symlink and unknown, so use else if.
* Use entry.IsSymbolicLink directly inside Initialize.
* Remove extra symlink check in FileSystemEnumerator.MoveNext, not needed and could cause unnecessary disk hit.
* Remove unused cache checks.
* Use HasHiddenFlag as expression body
* No need to soft retrieve hidden and read-only in FileSystemEntry.Initialize if in AttributesToSkip we are going to retrieve it anyway with a disk hit. Only in the case of DT_UNKNOWN, we will pre-retrieve the file cache, but we only need it when ShouldSkip is checked, and in that case, we won't have a disk hit.
* Make FileStatus.Initialize inlined in the only place where its called.
* EnsureCacheInitialized bring back order of conditions
* Syntax sugar for nullable egid and euid lazy retrieval
Co-authored-by: carlossanlop <Carlos Sanchez [email protected]>
We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.
The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.
* don't verify OS handle position
* track the file offset in memory, don't use expensive syscalls to synchronize it
* there is no need to set the Length since we are now tracking the offset in memory
* Cache GetFileInformationByHandleEx (Length) when FileShare does not allow other processes to modify it
Co-authored-by: Adam Sitnik <[email protected]>
* move all strategy-related types to Strategies subfolder and namespace
* make FileStreamHelpers a partial class, move some cross-platform helper methods there
* rename config switch
* address code review feedback
* add StreamConformanceTests to the solution file so we can read source code from VS
* add FileOffsetIsPreservedWhenFileStreamIsCreatedFromSafeFileHandle tests
* add WriteAsyncStartsWherePreviousReadAsyncHasFinished test
* introduce WindowsFileStreamStrategy
* introduce SyncWindowsFileStreamStrategy
* introduce AsyncWindowsFileStreamStrategy
* only DerivedFileStreamStrategy needs to have a reference to FileStream
remove finalizer from FileStream, keep it only in DerivedFileStreamStrategy and LegacyFileStreamStrategy
* use the new strategies when buffering is not enabled
* introduce BufferedFileStreamStrategy
* use the Legacy strategy by default for now, add tests for the other implementation
* Apply suggestions from code review
Co-authored-by: David Cantú <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
* add ZeroByteRead_PerformsZeroByteReadOnUnderlyingStreamWhenDataNeeded to stream conformance tests
* remove dead code
* change SslStream zero byte read implementation to issue zero-byte read on underlying stream when appropriate
* ensure buffer is always freed when not needed, and assert this
* create StreamConformanceTests assembly and reference from appropriate test projects
Co-authored-by: Geoffrey Kizer <[email protected]>