[browser][file system] Tests System.IO.FileSystem (#39768)
authorKenneth Pouncey <kjpou@pt.lu>
Mon, 10 Aug 2020 20:35:25 +0000 (22:35 +0200)
committerGitHub <noreply@github.com>
Mon, 10 Aug 2020 20:35:25 +0000 (16:35 -0400)
commit4dbe414c31cdd479289c496a8687251f2f2aa52a
treea19ed89b891855f216bd906ca0dec97e1a70c355
parenta4eba0a0e1ecb31b7cb3482509bd461c8e9f5ccf
[browser][file system] Tests System.IO.FileSystem (#39768)

* [browser][file system] Tests System.IO.FileSystem

* Remove FileSystem from test project exclusions.

* [browser][filesystem] Comment on skipped tests due to IO.Pipes not supported

* [browser][filesystem] Comment on skipped tests due to monitor not supported

* Address review comments

* Address review comments on how to handle monitor PNSE

* Update src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Add ActiveIssue for browser platform

```
        [ActiveIssue("https://github.com/dotnet/runtime/issues/39955", TestPlatforms.Browser)]
        public void NotFoundErrorIsExpected()
```

* Simplify test case with `PlatformDetection.IsSuperUser` as per review comment

* Remove unused variable from tests

* Browser platform volume does not limit each component of the path to a total of 255 characters.

- Remove the test `DirectoryWithComponentLongerThanMaxComponentAsPath_ThrowsException` for Browser platform.
- Add new test `DirectoryWithComponentLongerThanMaxComponentAsPath_BrowserDoesNotThrowsException` for Browser platform in case this check is added in the future.

* Fix windows tests

* Add ActiveIssue to test System.IO.Tests.DirectoryInfo_Name.CurrentDirectory

- System.IO.Tests.DirectoryInfo_Name.CurrentDirectory does not pass because it is using Path.GetFileName on the current directory of "/".
- See issue https://github.com/dotnet/runtime/issues/39998 for more information

* Add active issue for tests that need to support file locking.

* Add active issue for tests that need to support file locking.

* Browser volume does not have a limit on segments

* Remove browser platform test

* Remove active issue for NotFoundErrorIsExpected

* Remove platform specific from SkippingHiddenFiles

* Fix enumeration test errors failing from `HiddenFilesAreReturned`.

- WebAssembly (BROWSER) has dirent d_type but is not identifying correctly but by returning UNKNOWN the managed code properly stats the file to detect if entry is directory or not.

* Fix enumeration test errors failing from `HiddenFilesAreReturned`.

- WebAssembly (BROWSER) has dirent d_type but is not identifying correctly but by returning UNKNOWN the managed code properly stats the file to detect if entry is directory or not.

* Fix build for TARGET_WASM not defined

* Address review comment by add check for IsWindows to IsSuperUser.

* Address review comment by add check for IsWindows to IsSuperUser.

* Platform Specific test for hidden files no longer needed.

* Platform Specific test fno longer needed.

* Use active issue for rename issue

* ActiveIssue no longer needed

- PR https://github.com/dotnet/runtime/pull/40310 works around the issue for now while waiting for fix https://github.com/emscripten-core/emscripten/issues/11804 / https://github.com/emscripten-core/emscripten/pull/11812

* Use ActiveIssue for SettingUpdatesProperties

* Use ActiveIssue for TimesIncludeMillisecondPart

* Use ActiveIssue for ErrorHandlingTests failures

* Use ActiveIssue for SetUptoNanoseconds

* Use ActiveIssue for GetSetTimes test failures

* Use ActiveIssue for tests failing with DirectoryNotFoundException

* Use ActiveIssue for tests failing with UnauthorizedAccessException

* Remove debugging statement from pal_io

* Address type in CreateDirectory method name

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
35 files changed:
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
src/libraries/Native/Unix/System.Native/pal_io.c
src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs
src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs
src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs
src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs
src/libraries/System.IO.FileSystem/tests/Directory/Move.cs
src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Exists.cs
src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs
src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Name.cs
src/libraries/System.IO.FileSystem/tests/Enumeration/ErrorHandlingTests.cs
src/libraries/System.IO.FileSystem/tests/File/Copy.cs
src/libraries/System.IO.FileSystem/tests/File/Create.cs
src/libraries/System.IO.FileSystem/tests/File/Exists.cs
src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllLines.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllLinesAsync.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllText.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllTextAsync.cs
src/libraries/System.IO.FileSystem/tests/FileInfo/Exists.cs
src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs
src/libraries/System.IO.FileSystem/tests/FileStream/CanSeek.cs
src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs
src/libraries/System.IO.FileSystem/tests/FileStream/Flush.cs
src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs
src/libraries/System.IO.FileSystem/tests/FileStream/ReadWriteSpan.cs
src/libraries/System.IO.FileSystem/tests/FileStream/WriteAsync.cs
src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs
src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.write.cs
src/libraries/System.IO.FileSystem/tests/FileSystemTest.Browser.cs [new file with mode: 0644]
src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateFromFile.Tests.cs
src/libraries/tests.proj