Commit Graph
20 Commits
Author SHA1 Message Date
Jeremy Kuhne 93dce22a24 Address perf for GetFullPath and defer to OS.
This change attempts to limit the number of allocations made when evaluating
full paths. This is particularly important when Windows paths can be way over
the historical max of 260 characters. (The new max is over 32K)

We no longer kick paths in Windows that are valid, outside of paths with colons
that are not directory separators. (This has the effect of blocking alternate
data stream access- which is a legacy behavior.)

When creating directories, we still drop the trailing separator, which causes
trailing whitespace to be trimmed. This makes it particularly difficult to create
paths with trailing spaces in .NET, which is still desirable as most code has
a tough time dealing with this scenario. We'll open them fine now, which hits
the above point of not kicking valid legacy paths (paths that don't require
extended syntax).

Several simplifications to the logic were made, including moving relative segment
evaluation to shared code and calling it directly when getting directory names
rather than relying on the not-so-obvious prior behavior of GetFullPath without
"full checks".


Commit migrated from https://github.com/dotnet/corefx/commit/11b457d1186c364bdf3e7d978006eb2417e8d060
2015-10-07 11:22:27 -07:00
Jeremy Kuhne 2a13ee707b Switch to use localhost for test server name.
On the MS corpnet, there is a server called "Server" which is killing the perf of the tests.
(Via VPN tests still won't finish after 30+ minutes.) Using LocalHost avoids this.


Commit migrated from https://github.com/dotnet/corefx/commit/d1e7521f028e9564308a05b3b7ef4abf47f41509
2015-09-22 15:05:25 -07:00
stephentoub 8b936e6509 Fix failing FileSystem tests on OS X
Several FileSystem tests are failing on OS X because the tests are expecting that file/directory creation time can be changed on Unix.  Fixing the tests.


Commit migrated from https://github.com/dotnet/corefx/commit/12c0d738a0c234b707b0c99e40b3cb760df8096e
2015-09-11 14:51:53 -07:00
Dmitry Turin 946da9d4e3 Fix System.IO.FileSystem.Tests
System.IO.FileSystem.Tests leaves behind temp directories in %TMP%.
This commit fixes this issue.


Commit migrated from https://github.com/dotnet/corefx/commit/889d024aca35e0c98500f5b34e6db1dc9071edf7
2015-09-11 18:06:35 +03:00
stephentoub 1344081a9d Delete EnumerableUtils from System.IO.FileSystem.Tests
Dead code.

It also contained the only types in the test assembly that were in a namespace other than System.IO.FileSystem.Tests (there are still types that have no namespace).


Commit migrated from https://github.com/dotnet/corefx/commit/1616cc5e5328eec964874f0afe683e9292789cf7
2015-09-07 18:47:52 -04:00
Jeremy Kuhne b2782d7f70 Unblock paths > MAX_PATH without extended syntax.
Also allow directories up to max component length (255) as opening does not
require extended syntax.


Commit migrated from https://github.com/dotnet/corefx/commit/496c66e0b498077d5d349d324713a51be6b91c68
2015-08-28 15:32:31 -07:00
Ian Hays 1bc633088f Fixed test that was leaving temp directories in root folder
One of the Extended Path FileSystem tests was leaving temporary test directories in the root folder of the running directory. This small change modified the tests to instead treat the user's temp directory as the root.


Commit migrated from https://github.com/dotnet/corefx/commit/bd2d87d7abcf092840e0929c6df1116665f90460
2015-08-13 14:28:37 -07:00
Jeremy Kuhne 3b5bfc51a3 Allow extended long path directories
Add methods for checking max length as it varies on path format.

Most code paths hit PathTooLong with GetFullPath- directories are a special
case as Win32 apis have a special limit (248) for directory creation.


Commit migrated from https://github.com/dotnet/corefx/commit/6f363e65bfd09bebdf09ba236f63da952948ba8e
2015-08-09 19:19:27 -07:00
stephentoub d6467ac0af Use RuntimeInformation across corefx for platform detection
This commit deletes our temporary Interop.PlatformDetection.cs mechanism and replaces usage of it with usage of System.Runtime.InteropServices.RuntimeInformation.dll.


Commit migrated from https://github.com/dotnet/corefx/commit/6861b625b391566544be9a60356c8c03b15e5fb5
2015-08-06 10:25:17 -04:00
Ian Hays 8d7c94172a - Resolves dotnet/corefx#2458. FileInfo.Open(FileMode.Append) didn't allow appending per so I modified FileInfo to allow it
- References dotnet/corefx#2460. File.Move and FileInfo.MoveTo no longer always overwrite the destination file; added a non-concurrent validity check to MoveFile in the Unix implementation to serve as a temporary solution.
- Resolves dotnet/corefx#2459. Reenabled Directory_CreateDirectory.DriveLetter_Unix as it's previous failures were not the fault of the method but of the system.
- Added test checks to work around the issue in dotnet/corefx#2537 until a final decision is reached for the desktop.
- Added Interop.Link to the Interop files for the (possible) implementation of File.Move
- Consolidated all of the related files that did nothing but inherit from other classes (e.g. File_GetFiles_str and File_GetFiles_str_str were consolidated into File_GetFiles)
- Removed the "partial" keyword from some test classes
- Finished overhauling all test cases that don't directly require solutions to Build System issues before being re-added (e.g. those that require networked drives or altering the current directory)
- Added some tests to increase code coverage slightly in some cases.
- All classes and files have been renamed to match the standard set by FileStream: only include parameters in the test/class name if there are overloads
- Modified the Unix behavior for distinguishing between a FileNotFoundException and a DirectoryNotFoundException to match that of Windows.
- Removed some redundant error checks that never catch
- DirectoryInfo.MoveTo(destPath) did not have checks for destinations with paths that are over MAXPATH. I added them to better match the behavior and error timing of Directory.Move(source, dest).


Commit migrated from https://github.com/dotnet/corefx/commit/481d5c645763da79145af50d123db3f4041aa05e
2015-07-29 08:04:18 -07:00
Jeremy Kuhne 7f446020aa Allow extended syntax for paths
Additional work unblocking extended syntax. Fixes a few issues,
adds a number of tests, normalizes naming a bit more and moves/adds
helpers to shared code.

One nice side effect of this change is that you can now delete directories
that were undeletable before (if you had subdirectories that had trailing
spaces as one example).


Commit migrated from https://github.com/dotnet/corefx/commit/0721434e19e7f9ecf8bf6dba7485f6c86827388c
2015-07-23 19:17:34 -07:00
Jeremy Kuhne 911f36ebd9 Allow extended syntax for paths
Start on unblocking extended syntax. Moves some shared code to PathInternal.
Start adding tests for key scenarios. Temporarily use local libraries when
testing FileSystem (until we get an updated Runtime.Extensions package).


Commit migrated from https://github.com/dotnet/corefx/commit/72429b2ba76ebecb4c422a1d5eec05daf279b05e
2015-07-22 11:26:21 -07:00
Ian Hays 55cc5920f4 Updated with PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/3098724684d3a9e2916fbf2100643301d9161127
2015-07-21 13:41:48 -07:00
Ian Hays 67541b0365 Update to FileSystem Tests
- Consolidated AccessTime, WriteTime, and CreationTime tests for FileInfo, File, DirectoryInfo, and Directory into one file per folder - GetSetTimes.cs
- Added some Unix tests
-Overhauled the Write/Read/Append tests for the File class and removed many duplicate tests
-Continuation of dotnet/corefx#2390


Commit migrated from https://github.com/dotnet/corefx/commit/5aebb5487de9fd481e3dd294c9d49aa25361dde2
2015-07-20 14:43:18 -07:00
Ian Hays f0f11fb21b -Updated with responses to PR feedback
-Added OSX checks for Case Sensitivity tests
-Fixed a bug within several Enumerable tests that was causing a test directory to be left over.
-Increased code coverage slightly for Directory.
-Added tests to ensure whitespace file names are acceptable on Unix machines and marked those tests with an ActiveIssue referencing the newly created dotnet/corefx#2205


Commit migrated from https://github.com/dotnet/corefx/commit/b86274bbc18186768156cf3534c25c4d48656a67
2015-07-06 09:07:05 -07:00
Stephen Toub cdf97700fa Fix System.IO.FileSystem product source and tests for Linux
Prior to this set of changes, 110 of the FileSystem tests were failing on Linux.  After this change, all allowed tests pass.

Primary product fixes:
- Using rmdir/unlink for directory/file deletion rather than using remove
- Disallowing FileStreams to be opened for directories
- Supporting copying files when only target directory (not target name) is specified
- Overhauling directory enumeration to ensure to match Win32 behaviors related to search pattern normalization, input validation, supporting re-iteration through an enumerable, outputting partial paths based on user-supplied path, using a SafeHandle to ensure resources are cleaned up
- Fixing FileSystemObject.LastWriteTime to correctly return the LastWriteTime rather than LastAccessTime
- Fixing FileAttributes.ReadOnly handling due to inappropriate caching
- Validating inputs to FileSystemObject.Attributes, and make sure that changes to attributes are visible afterwards
- Adding support for getting CreationTime if it's supported by the OS
- Marking links with FileAttributes.ReparsePoint
- Working around current runtime bug related to exception handling and finally blocks getting executed twice

Primary test fixes:
- Suppressing tests as platform-specific that dependend on Win32-isms like drive letters, alternate data streams, etc.
- Changing a bunch of '\' usage to instead use Path.DirectorySeparatorChar or Path.Combine
- Adapting to behavioral differences between Windows and Unix, e.g. whether a directory can be deleted if it's readonly, invalid path characters, max path lengths, file sharing differences, etc.

These changes should all accrue to OSX as well, but we'll need to separately do an exercise to clean this library and tests up there for anything OSX-specific.


Commit migrated from https://github.com/dotnet/corefx/commit/dd48c9dc1f0a7142a005ff1d4c162e10facda306
2015-04-10 13:13:34 -04:00
Stephen Toub 525d3c65b0 Merge pull request dotnet/corefx#1302 from stephentoub/fix_filesystem_tests
Lots of FileSystem test fixes for Unix

Commit migrated from https://github.com/dotnet/corefx/commit/2cc25c72acf7b4aef038e8534c69251694a5eced
2015-04-02 09:23:44 -04:00
Stephen Toub 54fb8cec30 Lots of FileSystem test fixes for Unix
The FileSystem tests are a mess... including on Windows, but especially on Unix.  Before the File/Directory/etc. tests got checked in, the FileSystem tests (which then were really only for FileStream and were fairly clean) could run on Unix, with 25 of the 360 tests failing due primarily to lack of support for FileShare options.  Now, with ~575 tests, when run on Unix more than 300 fail, runtime assertions occur in multiple places, and worst, all of the files in your working directory end up getting deleted!

This commit has a first set of fixes, primarily involving ensuring that paths are specified appropriately, with hundreds of changes to ensure that the right path separator is used, that particular roots aren't assumed, etc.  After this commit, on Unix we're down from > 300 failures to 114 failures, and the suite is able to finish running without deleting the working directory.


Commit migrated from https://github.com/dotnet/corefx/commit/d9465170db0be15a6e8d8ca6ba591a358f709ec5
2015-03-31 16:32:43 -04:00
Stephen Toub abbd32deba Remove Console.WriteLines from FileSystem tests
A few Console.WriteLine calls in the FileSystem tests are resulting in tons of unnecessary output while running tests.  Removing them.


Commit migrated from https://github.com/dotnet/corefx/commit/e71d652811b95950a71a0bd0fdd6b6206f50ae01
2015-03-31 10:57:15 -07:00
dotnet-bot 58d9a445c5 Add ported System.IO.FileSystem tests
Add ported System.IO.FileSystem tests for Directory, DirectoryInfo,
File, FileInfo.


Commit migrated from https://github.com/dotnet/corefx/commit/25841a3761cab292153bd0a917a4ce192be8ffab
2015-03-27 14:31:02 -07:00