Commit Graph
22 Commits
Author SHA1 Message Date
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
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 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
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 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
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
Alex Ghiondea 5bc19a13ab Port CS1469287 from ProjectN to ProjectK via FXMain
[tfs-changeset: 1469367]


Commit migrated from https://github.com/dotnet/corefx/commit/9c3b459ae51da4665ccd420f92effac6255523fd
2015-05-12 14:29:10 -07:00
Daniel Paoliello 23457c0c44 Fix for Issue dotnet/corefx#587: Modified Win32FileStream.FileStreamAsyncResult to be using a TaskCompletionSource, modified the core Read\Write methods to return Tasks, and so removed the internal Begin\End methods since they are no longer required. Also added a pair of "mini-stress" tests for ReadAsync and WriteAsync as OuterLoop tests.
Commit migrated from https://github.com/dotnet/corefx/commit/aca535e12bf3642cff2f725cbe97cd31e01a5f9c
2015-04-26 12:50:13 -07:00
Stephen Toub d7103cea8c Fix UnixFileStream.Seek buffering with SeekOrigin.Current
UnixFileStream.Seek was dumping the read buffer as desired, but with a SeekOrigin.Current, it wasn't factoring in the read buffer information into the offset (the fact that we have a read buffer means that the caller's definition of "Current" doesn't match the actual underlying file descriptor's position).  This fix just updates the offset (as is correctly done in similar code in the Win32FileStream implementation) based on how much data we have in the read buffer.

I've also added a seek test that repeatedly seeks around and reads data.  It blows up without the fix and passes with it.


Commit migrated from https://github.com/dotnet/corefx/commit/563f4977543f483ce1a5df8b9ffd9f96ffe0921f
2015-04-24 13:43:09 -04:00
Matt Ellis 6cb12f9218 Merge pull request dotnet/corefx#1437 from ellismg/disable-failing-test
Disable failing test

Commit migrated from https://github.com/dotnet/corefx/commit/a1ab41cbd7d3435aed4e98132617fba03675cd31
2015-04-19 22:10:25 -07:00
Matt Ellis 47439e20a7 Disable failing test
ValidFileOptions test is failing.  Disable it.


Commit migrated from https://github.com/dotnet/corefx/commit/71d167bc7342360c6b0c9ed255df95efdbad816a
2015-04-19 21:50:02 -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 b7aafbcdf5 Fix FileStream tests on Linux
There are 338 System.IO.FileSystem tests currently passing on Windows.  On Linux, 65 of these are currently failing, mostly negative tests expecting a certain exception and getting a different actual one or none at all.

This commit fixes 40 of those, mostly via product fixes, plus a few test tweaks (where the test was based on something specific to Windows), such that now only 25 are failing.  Of those 25, 24 are tests for FileSharing that are expecting exceptions not being generated on Linux because that support isn't available in the library; we'll most likely just disable these tests for Linux.  The remaining 1 test fails because it's expecting ReadAsync to complete synchronously if the read can be satisfied from the read buffer, and the current ReadAsync/WriteAsync implementations just delegate to the base class for functionality; we already have a work item open to eventually address that.


Commit migrated from https://github.com/dotnet/corefx/commit/8062cc0dbed1ad31b9e6d438ddc71d91ee066031
2015-03-23 02:41:20 -04:00
Nick Guerrera f076e50a56 Merge pull request dotnet/corefx#565 from dotnet/v1.0
Merge v1.0 to master

Commit migrated from https://github.com/dotnet/corefx/commit/593d5b40e188ba23f656fd93efabdff390048b34
2015-01-29 19:13:11 -08:00
Eric StJohn 485f6da00e Testing the return value of Seek
Commit migrated from https://github.com/dotnet/corefx/commit/9288809a29883edbcd58c0a51ee7bd3b13be278e
2015-01-29 08:51:20 -08:00
Eric StJohn 2f422d1fba Refactoring CompletesSynchronously to better test the that an async method completes synchronously.
Commit migrated from https://github.com/dotnet/corefx/commit/a35bcce6f747981e830a3824aad62503c6da12e2
2015-01-29 08:50:51 -08:00
Eric StJohn 09489674ad Adding tests for FileStream.
Commit migrated from https://github.com/dotnet/corefx/commit/75dd80ef6fc260e8d5dca8458d8baf9e3faa35a7
2015-01-23 10:57:01 -08:00
joshfree e3fa23c56e Trivial cleanup to use Assert.True(x) and Assert.False(x)
Search and replace across all tests :
  Assert.Equal(true, x); => Assert.True(x);
  Assert.Equal(false, x); => Assert.False(x);

Changed files:
  System.Collections.NonGeneric.Tests.dll
  System.IO.FileSystem.Tests.dll
  System.Reflection.Metadata.Tests.dll


Commit migrated from https://github.com/dotnet/corefx/commit/1199340b63d39afc47d502a7474c777a07a89ad3
2015-01-15 16:43:31 -08:00
Eric StJohn 3bd6b8da9b Add test assertions for exception members of FileStreeam.ctor(string, fileMode) tests.
Commit migrated from https://github.com/dotnet/corefx/commit/be8527cc02ddf065ff0cab1ddecd93b92e245dc6
2014-12-30 15:52:36 -08:00
Eric StJohn 6923cfab70 Add projects for FileSystem and FileSystem.Primitives. Add tests for FS.Primitives and the begining of tests for FileSystem.
Commit migrated from https://github.com/dotnet/corefx/commit/5b0e138913de4854ed2a4c627fa75362413d2010
2014-12-29 12:45:05 -08:00