Commit Graph
111 Commits
Author SHA1 Message Date
Ian Hays 297806d2fb Updated performance tests
- PerfUtils is no longer static and is instantiated on a test-by-test basis
    - Greatly increased the size of the testable area for a number of the tests
    - Tweaked the collection and innerIteration sizes for a number of tests
    - Fixed some namespace bugs


Commit migrated from https://github.com/dotnet/corefx/commit/82a82c16418f094e82117825940368c8c5da2ef4
2015-09-29 13:32:35 -07:00
Stephen Toub 41164b62c0 Merge pull request dotnet/corefx#3304 from ianhays/perf2
Added performance microbenchmarks

Commit migrated from https://github.com/dotnet/corefx/commit/0a1b102698d50a6006f4f6a82737a16bde6d6b88
2015-09-26 11:56:29 -04:00
Stephen A. Imhoff a8ce720bd6 Update test namespace in System.IO.FileSystem
Update test namespace where applicable.
Cleanup `using`s in updated files.


Commit migrated from https://github.com/dotnet/corefx/commit/5b5717c2eb8fc88ed5bd59babe39890c581ad622
2015-09-25 21:30:57 +09:00
Ian Hays 01468ad85f Added performance microbenchmarks
- Added "Performance" folders containing perf xunit tests to a number of highly-used libraries (determined by Usage data)
- Two sets of usage data from store apps; I added a test for every function used in more than 5% of the covered assemblies in both data sets.
- This is a first-round pass of the most highly used libraries and does not include: abstract classes, interfaces, or Attributes
- Created a static utility class for commonly used functions across perf tests, stored in src\Common\tests\Performance.
- These tests will run using ```msbuild /t:BuildAndTest /p:performance=true``` from the projects test directory
- Added conditional properties that check if v5.0 is installed on the user's computer when running perf tests. If it isn't, a detailed error is thrown with a link to a performance-test github page that I've also added.


Commit migrated from https://github.com/dotnet/corefx/commit/11ea534258ced35948e53a4ece8fb1284698bf8a
2015-09-24 10:01:40 -07:00
Stephen A. Imhoff 7c088fcd28 Remove most instances ofcustom error checking from tests.
Patterns mostly were of the form:

```
if (someBooleanCondition)
{
    Assert.True(false, ....);
    // Or sometimes Assert.False(true, ....);
}
```
or
```
try
{
    SomeErrorThrowingOperation
    Assert.True(false, ....);
    // Or sometimes Assert.False(true, ....);
}
catch (ExpectedExceptionType e)
{
}
```
This replaces most instances with calls to the proper Xunit.Assert#### .
Some additional minor work was performed as noted with the affected package.

Add common ShouldNotBeInvokedException
System.Collections
 - Partially unwind edges of internal test framework.
System.Collections.Concurrent
 - Switch some tests to use InlineData instead of delegated method calls.
System.Collections.Immutable
 - Use ShouldNotBeInvokedException to state some lambdas should not be called.
System.Collections.NonGeneric
System.Composition
 - Partially unwind internal test famework.
 - Switch to using xunit asserts where possible.
System.Diagnostics.Contracts
 - Use ShouldNotBeInvokedException to state some lambdas should not be called.
 - Update project file to use upper case letter in hash.
System.Diagnostics.FileVersionInfo
 - Switch to direct equals comparison.
System.Diagnostics.Process
 - Use ShouldNotBeInvokedException to state a task should exit.
System.Diagnostics.Tracing.Telemetry
 - Use ShouldNotBeInvokedException to state an overridden method should not be called.
System.Globalization
 - Switch to direct equals comparisons in some cases.
System.Globalization.Extensions
 - Switch to direct equals comparison in some cases.
System.IO.Compression.ZipFile
System.IO.FileSystem
 - Partially unwind internal test framework.
System.IO.Packaging
 - Correct test T006 to check that adding absolute Uri part in internal mode is invalid.
System.ObjectModel
 - Use ShouldNotBeInvokedException to state some observables should execute.
System.Reflection
 - Update readonly-set test to verify that the field is set (previous test implied it was not).
System.Reflection.Extensions
System.Reflection.Metadata
 - Partially remove internal test framework.
 - Switch to xunit asserts where possible.
System.Reflection.TypeExtensions
System.Runtime
System.Runtime.Extensions
 - Switch to xunit bounded equals for doubles.
 - Switch to verifying non-varags Path.Combine override.
System.Runtime.Numerics
 - Switch to xunit Assert.Throws from internal version.
System.ServiceProcess.ServiceController
System.Text.Encoding
System.Text.Encodings.Web
System.Threading
System.Threading.Tasks.Dataflow
System.Threading.Tasks.Parallel
System.Xml.ReaderWriter
 - Switch to form verifying exception is thrown.
System.Xml.XmlDocument
 - Use ShouldNotBeInvokedException to state some handlers should not be called.


Commit migrated from https://github.com/dotnet/corefx/commit/ab1743b45213e88295a38e2bf9d80ded09058b18
2015-09-24 20:17:38 +09:00
stephentoub 8f85a391bf improve FileOptions tests for FileStream
We didn't have any tests for the DeleteOnClose behavior with FileStream.  We also weren't testing combinations of FileOptions, nor validating that we could read/write files created with non-default options.


Commit migrated from https://github.com/dotnet/corefx/commit/63efcbf5ae19883cd9bc9aa10703a681be1c73ea
2015-09-23 14:57:24 -04: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
Jeremy Kuhne 16099fc5a4 Move max path directory check up front.
No need to create a bunch of intermediate directories when we'll fail at the end.
This was having significant impact on test times with dotnet/corefx#3192.


Commit migrated from https://github.com/dotnet/corefx/commit/d5f7c91ac455244195135c48ab3b94bb24eeb78f
2015-09-21 22:52:39 -07:00
Ian Hays 0e2ae5be2d Fixed test bug with FileInfo_GetSetTimes
resolves dotnet/corefx#3272


Commit migrated from https://github.com/dotnet/corefx/commit/50aa6bbfd3921a9312392f534c5986a193486c35
2015-09-16 11:03:32 -07:00
Alexander Köplinger 3e20a867b2 Update build to use DNX beta7 instead of beta5
The corefx build used an older beta5 version of DNX which hardcoded the path to bash in dnu, breaking the build on FreeBSD.
Updating DNX to the latest "stable" beta7 release fixes this.

After updating I noticed a few test projects didn't build anymore as they were missing some dependencies in project.json, added those.

Fixes dotnet/corefx#3173


Commit migrated from https://github.com/dotnet/corefx/commit/6df77fdbb6cf8e0d35a3074bb325f7810085daa3
2015-09-16 02:12:26 +02:00
Ian Hays 71345b4a45 Fixed OSX file creation time format
FileInfo.CreationTime on OSX was returning a correctly timed but incorrectly formatted DateTime. This commit fixes this issue and adds coverage to a existing test to fill the test gap that let the issue through.


Commit migrated from https://github.com/dotnet/corefx/commit/e59a99c6628b817e95a43880fe14cbf602602b9e
2015-09-14 10:51:15 -07:00
stephentoub b07d619076 Reduce FileSystem inner loop test time from 90 to 5 seconds
Three tests were consuming the vast majority of the time:
- DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsPathTooLongException. It was taking 70 seconds on my machine.  I moved it to outer loop.
- ManyConcurrentWriteAsyncs.  It uses a MemberData that results in it executing ~40 times, for a combined time of around 7 seconds on my machine.  I made one combination run in inner loop and moved the rest to outer.
- CopyToAsyncBetweenFileStreams.  Same MemberData, same solution.


Commit migrated from https://github.com/dotnet/corefx/commit/03205295cc6834b1fdcd8b7ba364515f4ec7164a
2015-09-12 19:46:49 -04: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
stephentoub 26253f6265 Add more tests for FileStream
- Mainly, I added several tests (with lots of theory-based parameterized inputs) to stress WriteAsync: many concurrent writes, long chains of writes, etc., for various size inputs and buffers, async vs not, etc.
- There were multiple variations on Flush tests based on whether to use Flush(), Flush(false), or False(true).  I combined these all into single theories.
- I then added some more Flush tests for some missing cases highlighted by code coverage, e.g. flushing reads.
- I then duplicated these tests for FlushAsync, and added some additional tests specific to FlushAsync, e.g. cancellation.
- I added a few tests for pipes.


Commit migrated from https://github.com/dotnet/corefx/commit/bb34d5a458613faa39d3808a8a352e62e3bcf52f
2015-08-24 16:59:59 -04:00
tymlipari 4113737a6e Handle internal overflow of the write buffer in WriteAsync by introducing new cases:
1) Internal buffer overflows, but write can fit in next buffer - Fill the existing buffer, copy the remaining data into a new buffer, and flush the original to disk

2) Internal buffer is non-empty, overflows, and the remaining data won't fit in a second buffer - Chain the flush operation to a second write operation which writes the entire incoming block directly to disk.

Additionally, adds a new unit test to ensure the different buffering cases are being covered.


Commit migrated from https://github.com/dotnet/corefx/commit/b69caa929d3cb3b87574ee31a651d799f61e3a75
2015-08-24 16:50:56 -04:00
Eric St. John d7a0ae297b Update corefx packages to latest
Commit migrated from https://github.com/dotnet/corefx/commit/23f0b695bd162e0f665427c95180dc21931e5c70
2015-08-14 15:43:23 -07:00
Eric St. John 9142282fd7 Fix ref-def mismatch in FileSystem tests
Since FileSystem tests are using a project reference to
System.Runtime.Extensions, and S.R.E uses a project reference
to System.Diagnostics.Debug (due to
https://github.com/dotnet/corefx/issues/2817) these tests  must
also use a P2P reference to S.D.D.


Commit migrated from https://github.com/dotnet/corefx/commit/0cc8949ef5474c8da77cf873ed5e01ea1cd91d21
2015-08-14 14:50:56 -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
Ian Hays e8723ef1b5 Cleaned up tests for closed issues
Design review feedback brought about the closed issues dotnet/corefx#2537, dotnet/corefx#2403, dotnet/corefx#2402, dotnet/corefx#2369, dotnet/corefx#1728. This Commit cleaned up the tests around those decisions and removed OuterLoop from the GetSetTimes tests.


Commit migrated from https://github.com/dotnet/corefx/commit/3eb22a0ef2eb007b8fc8410d1a0fefc23311dc08
2015-08-11 14:53:51 -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
Ian Hays 6f2190dc4e Fixed AccessTime, WriteTime, and CreationTime getters
Previously, AccessTime, WriteTime, and CreationTime would return DateTime objects with an unspecified DateTimeKind. This commit modified that behavior to have them instead return Local DateTime objects. Extra tests were also added to catch more potential error cases.

- Resolves dotnet/corefx#2603
- Resolves dotnet/corefx#2610


Commit migrated from https://github.com/dotnet/corefx/commit/df06e562a49b739655efff4b6b9f0faa23d09b78
2015-08-07 10:16:52 -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
Stephen Toub 7b28c3d30e Merge pull request dotnet/corefx#2630 from stephentoub/consolidate_tempfiles
Change System.IO.FileSystem.Tests to use FileCleanupTestBase

Commit migrated from https://github.com/dotnet/corefx/commit/37b0abb008ef543e57cbe02e0b4435bc1908a303
2015-08-05 12:20:05 -04:00
stephentoub 2e9fbca627 Change System.IO.FileSystem.Tests to use FileCleanupTestBase
When I rewrote the MemoryMappedFiles tests, I cribbed from the
System.IO.FileSystem test's base class and created a Common base class
that could be used by test projects that had temporary files to be cleaned up.
At the time, however, FileSystem's tests were undergoing heavy changes and
so I didn't update FileSystem's tests to use the common base.  Now that
things have quieted down, I've made that change.

In doing so, I made a few tweaks to the FileSystem tests, where tests were
assuming that the test directory was always in the current directory, and
the consolidated base class puts temporary files in the user's temporary
directory instead.


Commit migrated from https://github.com/dotnet/corefx/commit/d7a19e92824e8a038553de20abf2497db0424ddb
2015-08-04 23:24:06 -04:00
stephentoub b6046f97e0 Fix UnixFileSystem.MaxDirectoryName to be MaxPath
UnixFileSystem's override of MaxDirectoryName was assuming the property meant the maximum size of the file name of a directory, i.e. the component length, not the full path length of everything from the beginning of the root.  As a result, checks against MaxDirectoryName, such as in CreateDirectory, were failing incorrectly with longer path lengths.

The fix is just to return MaxPath from MaxDirectoryName; there's no difference on Unix.  I also added a test to cover this case, included a previously excluded test, and deleted a faulty test.


Commit migrated from https://github.com/dotnet/corefx/commit/5de40bfa898dc2a03fd5efb3f21ea2f69d16a94a
2015-08-04 21:48:54 -04:00
Eric Mellino 66969e748b Re-lock dependencies with latest xunit
Commit migrated from https://github.com/dotnet/corefx/commit/795cbc75f8e167047a7c19cd7e21e99b9b9f4308
2015-08-03 16:40:33 -07:00
Eric Mellino c0015fc582 Move all tests to latest xunit beta
Commit migrated from https://github.com/dotnet/corefx/commit/7c12b0120834f92d5c591124f692ea1b64c6a877
2015-08-03 11:27:48 -07:00
Eric St. John 47aaf9fcf8 Use stable package dependencies and move our packages to post-stable versions
This change modifies the build to consume the stable version where available.

This disables building the dowlevel packages since we shipped them once as stable and we're done.
From here on out, we'll only build the latest version (except for a servicing event, which would
be handled by syncing to a hash).

I can't rev the package versions in the normal way yet (by modifying the assembly version of the contents)
because that turned out to be too big of a problem to tackle in this change. Instead I added a
parameter to the task that calculates package versions to do the rev for anything that was
stable, but only when building the package itself, not when calculating the dependencies.
This has the downside of not permitting a dependency on a incremented pre-release version if we've
shipped a stable version, but that is a small point in time problem until I can rev the assembly
versions.

[tfs-changeset: 1508664]


Commit migrated from https://github.com/dotnet/corefx/commit/ee1ec2891c7c65b46fa9dfb078636be503bb2a60
2015-07-31 15:47:51 -07:00
Ian Hays a9766775b0 - Added an overload to GetTestFilePath that takes an integer index parameter to add to the generated filename so that calls to the function within loops will be able to differentiate themselves
- Resolves dotnet/corefx#1434


Commit migrated from https://github.com/dotnet/corefx/commit/1dbfabb32d61a8c2db25c82bb22743bcc15c2ccb
2015-07-29 15:23:33 -07: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
Wes Haggard 1917a92051 Add P2P reference for new IO tests to System.Runtime.Extensions
Until we can publish a new packages with the new System.Runtime.Extensions
implementation reference the locally built version. We need to change to a
P2P reference to avoid the race condition that is inherit in using
TestWithLocalLibraries. That can only be used if we know all the
dependencies are built first.


Commit migrated from https://github.com/dotnet/corefx/commit/018763c4dad4c0c1c1cc63befdcba249b7c11b05
2015-07-24 17:17:53 -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 c25bace1a2 Merge pull request dotnet/corefx#2410 from JeremyKuhne/AllowExtended
Allow extended syntax for paths

Commit migrated from https://github.com/dotnet/corefx/commit/14e98f7acc0420c93218768f89dd69c9b4c12c86
2015-07-23 15:52:33 -07:00
Matt Mitchell b92c666b03 Enable globstar in run-test.sh
Globstar is not enabled by default, and a recent commit attempting to increase the number of directories being run for the Linux build actually skipped a bunch of stuff.  Enable globstar in the script (this is local) to fix.

Mark DriveLetter_Unix as a failing test, which appears to have snuck in in the meantime


Commit migrated from https://github.com/dotnet/corefx/commit/0b798760c7844e489bfb1432dd97b3ce184bb374
2015-07-23 10:28:52 -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
Stephen Toub dc2151aa7b Merge pull request dotnet/corefx#2442 from stephentoub/license_headers
Add missing license headers to .cs files

Commit migrated from https://github.com/dotnet/corefx/commit/1bcb7dc4530a58bac2d7ce7743dc1e58a5c19a77
2015-07-22 13:42:47 -04:00
stephentoub b931aee629 Add missing license headers to .cs files
There are 77 .cs files in the repo lacking the standard license header we have on the other ~5400 .cs files.  This commit adds the missing ones.


Commit migrated from https://github.com/dotnet/corefx/commit/98157438d8790337f14341528f20d2f788a3279d
2015-07-21 18:52:55 -04: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
stephentoub bab02c72eb Ensure all Common includes use a <Link/>
Modifies various .csproj files to ensure that all Includes for files under Common use a <Link/> so that Visual Studio shows the files under a Common folder rather than flattened in the root.

Fixes dotnet/corefx#144


Commit migrated from https://github.com/dotnet/corefx/commit/264d92084d6c6366c3c23edaaab54a32f61d501b
2015-07-15 10:21:33 -04:00
Ian Hays 98b6021d8d -System.IO.UnixFileSystem has an issue with the "overwrite" being interpreted backwards. I simply reversed the conditional statement to be correct. There were previously no tests to cover this possibility. Resolves dotnet/corefx#2276
-Updated over a dozen test files to use the modern Xunit syntax.
-Solved file-in-use concurrency issues in the altered tests. Resolves dotnet/corefx#1313, dotnet/corefx#2227
-Tests will no longer intermittently fail.
-Slightly improved code coverage for the FileSystem files whose tests I altered (Directory, DirectoryInfo, File, FileInfo)
-Most tests altered now inherit from similar tests to consolidate the testing robustness into as few locations as possible. For example, Directory_GetFiles_str now inherits from Directory_GetFileSystemEntries_str since the tests for Directory_GetFiles_str were the exact same ones as in Directory_GetFileSystemEntries_str anyways.
-All altered tests now use the System.IO.FileSystem.Tests namespace
-Renamed the File_WriteAll_all class name/file name to File_WriteAllText.
-I tested my changes on Windows overnight to verify that there is no more intermittent test failures. I didn't have to modify all of the files listed in dotnet/corefx#2227 to get them to pass; this concerns me but I found no way to replicate the errors I was receiving before. My guess would be that the tests in the files I didn't alter (e.g. File_WriteAll and File_ReadAll) used the same names as the tests I did alter but now that the tests I altered are changed they no longer share test file names and no longer fail as a result.


Commit migrated from https://github.com/dotnet/corefx/commit/d21ce06332afe7aba0a52491187983744c10b4a4
2015-07-13 13:00:43 -07:00
stephentoub 8ca4fb4dd8 Separate platform-specifics out of shared FileSystem code
In a few places, we still have platform-specific code in shared System.IO.FileSystem code.  In particular, DirectoryInfo is doing various manipulations related to Windows path roots that can result in doing the wrong thing on Unix, e.g. creating a DirectoryInfo for "C:" on Unix should be for the directory named "C:", but instead today it'll follow the Windows-specific logic of rerouting to target the current directory.  This commit fixes that.  It also moves some code used only in the Windows implementation into Windows-specific files (e.g. Directory.SearchData).


Commit migrated from https://github.com/dotnet/corefx/commit/2450018290375fd5a736d67cca8beec7db3a7c5c
2015-07-09 12:54:32 -04:00
stephentoub 6a4d9d4794 Fix System.IO.FileSystem's PathHelpers for Unix
The FileSystem's PathHelpers internal class contains some utility functions for processing paths.  Some of these functions are copies of non-exposed Path members, while others are unique.  A bunch of those members have Windows-specifics coded into them, which is causing problems when dealing with various special paths on Unix, for example paths that end with double dots, relative paths that begin with a space, etc.

This commit splits PathHelpers into a PathHelpers.cs, PathHelpers.Windows.cs, and PathHelpers.Unix.cs, and implements the Unix functions appropriately.

It also fixes up a variety of tests that are now failing because they were expecting the Windows behavior.


Commit migrated from https://github.com/dotnet/corefx/commit/5945d8ced21c36e091290fb92f15a5c1f4cb2274
2015-07-07 22:12:38 -04:00
stephentoub f574e42e5c Fix FileSystem tests for Unix
A bunch of the FileSystem tests assume that certain paths are always invalid, but many such paths are valid on Unix.  This commit fixes the tests that are failing after the revised Path implementation.


Commit migrated from https://github.com/dotnet/corefx/commit/f0882d6673308cded7726cd5f3fd8e2b448a3415
2015-07-06 20:53:20 -04:00
stephentoub 4f3ed512b0 Fix FileSystem enumeration with broken symlinks
Today when enumerating directories, we look only for entries with DT_DIR (directory) or DT_REG (regular file); if we encounter something unknown or a symlink, we stat to resolve it and determine whether it's actually an S_IFDIR (directory) or S_IFREG (regular file). There are (at least) two problems with this:

1) The stat to a symlink will fail if the symlink points to a non-existent entry.
2) We end up skipping lots of special files, e.g. FIFOs.

The commit changes our logic to simply special case directories: we treat everything as a file unless we're sure it's a directory. This directly fixes (2), and indirectly fixes (1): our logic for DirectoryExists already ignores any stat errors, returning false if the symlink couldn't be resolved, such that this naturally maps to our desired behavior of broken symlinks being categorized as a file.


Commit migrated from https://github.com/dotnet/corefx/commit/5428c98a421fe7e5907c050a7e820f5045b61e61
2015-07-06 17:28:08 -04: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
Ian Hays 1f363026a5 -Running the FileSystem tests no longer leaves test directories or files in the running directory. fixes dotnet/corefx#1412
-Modernized the tests for GetFIleSystemEntries and GetFiles, splitting each test case into a standalone method runnable through xunit. Similar versions of these tests now inherit from each other rather than just being copy-pasted like they were previously. Moved most test cases from using hardcoded file names to instead use GetTestFileName() in FileSystemTest.cs. Tested on Linux and Windows.
-Changed the names of some files and classes to better follow the naming conventions of the other FileSystem tests.


Commit migrated from https://github.com/dotnet/corefx/commit/9e20082a9498f2f9bf79bcebe80fd1f9efc1e39b
2015-06-30 11:31:01 -07:00