Commit Graph
1561 Commits
Author SHA1 Message Date
Nate Amundson c1571f42f9 Make unit tests async to work with 1 thread
Currently, the tests System.IO.Tests.FileStream_SafeFileHandle.
ThrowWhenHandlePositionIsChanged and System.Net.NetworkInformation.
Tests.UnixPingUtilityTests.PacketSizeIsRespected hang when running on a
Unix machine with 1 thread.  Declaring the tests async fixes this issue.


Commit migrated from https://github.com/dotnet/corefx/commit/6d15aa69e332866e6282994edfd2de5ca0192899
2015-12-14 18:21:49 -06:00
Eric Mellino b59e56fb4e Consolidate facade project files
Commit migrated from https://github.com/dotnet/corefx/commit/f39d73a00d80c5552c3c88a6b82521c71fecf568
2015-12-14 11:06:32 -08:00
stephentoub 77c4183d17 Update package validation to rc2-23610
Commit migrated from https://github.com/dotnet/corefx/commit/6f6303f0356be4d2dd4ac117373f1e37f8752248
2015-12-11 10:53:47 -05:00
Eric Mellino b8670dea2f Add facade projects for all supported platforms
These facade project files were generated using a porting tool I wrote,
which examined some information from our internal build and created
appropriate project files. I have also re-generated all of the .builds
files so that they import the facade projects in the correct manner.


Commit migrated from https://github.com/dotnet/corefx/commit/58e2f6e862060039e1ebad727d75c87703fdb2f2
2015-12-10 10:29:09 -08:00
dagood fbfb82cc8c Change all project.json files to validate. Remove lockfiles from source control and add to gitignore.
A few new references to pick up changes that happened over time.


Commit migrated from https://github.com/dotnet/corefx/commit/0d881222d8c3269157639e2e67056e5a83aad834
2015-12-09 16:25:26 -06:00
Eric Erhardt e1abc6cf8b Move the IO check for EINTR down into the native shims.
This allows for the managed code to be cleaner, and it can easily return SafeHandle objects from P/Invoke methods.
Also, it fixes the problem where some code wasn't looping on Interop.CheckIo, which is a problem when EINTR is returned.

Fix dotnet/corefx#3168


Commit migrated from https://github.com/dotnet/corefx/commit/c0ded7d939c7c8ae702586f57011265686879537
2015-12-08 21:24:30 -06:00
Eric Erhardt 5979598973 Merge pull request dotnet/corefx#4791 from eerhardt/ShimIntPtr
Shims should use intptr_t for file descriptors.

Commit migrated from https://github.com/dotnet/corefx/commit/37fb0e5887d3f9ed1356790b71b78610c0dd3ecb
2015-12-04 18:00:40 -06:00
Christopher Costa 0ce492e3f9 System.IO.FileSystem, System.Net.Sockets, and System.Security.Cryptography.Algorithms used to have different builds for OS X and Linux, but now after all the shimming work that was done recently, those were consolidated into a single Unix build, with no differences between Linux and OS X. However, they still have Linux-specific and OSX-specific packages. This change consolidates these.
[tfs-changeset: 1554643]


Commit migrated from https://github.com/dotnet/corefx/commit/bd93f79901e2e9480fe0165d452949a4a1908c04
2015-12-04 10:29:38 -08:00
Wes Haggard 2b08629506 Add other library builds for System.IO.FileSystem project.
Commit migrated from https://github.com/dotnet/corefx/commit/19ab445faa47a76bb4f32aae8980ebdd412333d4
2015-12-03 17:53:16 -08:00
Eric Erhardt 2c3e768b15 Shims should use intptr_t for file descriptors.
Changing all file descriptors used in System.Native to use intptr_t instead of int32_t.  This way we can marshal SafeHandles without having to add DangerousAddRef/Release code.

Fix dotnet/corefx#2904.


Commit migrated from https://github.com/dotnet/corefx/commit/8a5cbc165a696b39b8d9bb48554c09473d4ca6bc
2015-12-02 22:30:06 -06:00
Deepak Shankargouda f5284f6fcc Created initial set of .builds files
Commit migrated from https://github.com/dotnet/corefx/commit/a20fd22b1e44d13e437c235a957a47a2af52838d
2015-12-02 14:38:03 -08:00
Jeremy Kuhne b0432d8e69 Merge pull request dotnet/corefx#4573 from JeremyKuhne/4274
Clean up path handling and align with legacy behavior

Commit migrated from https://github.com/dotnet/corefx/commit/64b3796bc9f68e30285abc6b2329a4a4aaff262f
2015-12-01 12:12:44 -08:00
stephentoub 29a8dba1c4 Disable several failing tests on OS X
One new sockets test is still failing.

And a handful of IO tests related to read-only files just recently started failing, presumably due to some kind of OS-related upgrade.


Commit migrated from https://github.com/dotnet/corefx/commit/f2199be65eb6b8020deb0a348923875020b8435a
2015-11-26 08:34:53 -05:00
Ian Hays 7d215ded5f Manually specify perf runner version to avoid lock failures.
Temporary solution to dotnet/corefx#333


Commit migrated from https://github.com/dotnet/corefx/commit/fc4748e21a2df4d5694f2483ffe0466d43bcecfd
2015-11-25 11:03:24 -08:00
Jeremy Kuhne b4e250a059 Clean up path handling and align with legacy behavior
Fixes issues with Path.GetDirectoryName() and relative paths.

- Added directory separator normalizer method.
- Added comments clarifying behavior and usage.
- Clarified and simplified internal methods.


Commit migrated from https://github.com/dotnet/corefx/commit/beb7d50f962c1ece1d11e9bb21e2ff248baea85e
2015-11-23 15:38:24 -08:00
Jan Kotas fe7a2a2dc6 Fix build break in WinRTFileStream
[tfs-changeset: 1548428]


Commit migrated from https://github.com/dotnet/corefx/commit/3e1587e687d5fb55e14e1c878bde7e7c693886b6
2015-11-14 11:51:02 -08:00
Page-Not-Found 835ffb1436 Commonfolder rename and __Error, __HResult
Commonfolder rename and __Error, __HResult


Commit migrated from https://github.com/dotnet/corefx/commit/0a1a2a024797091a645ea42561441fcd8586525c
2015-11-11 15:45:12 -05:00
Eric St. John 65210efd31 Update project.lock.json to latest and lock
Commit migrated from https://github.com/dotnet/corefx/commit/6aeea5eabf2aff3baf15f501cabd156dfc5b3f8f
2015-11-09 22:38:10 -08:00
Eric St. John cddddd29f5 Remove unused dependencies
Commit migrated from https://github.com/dotnet/corefx/commit/78fd45ec74afc507a40df519b4df650ac9bd4c42
2015-11-09 22:37:37 -08:00
Ian Hays 851c786922 Perf test targets were buggy and required specific setup to not fail. I've hardened them so that the tests can be more easily built without also running them. I also removed the v5.0 libraries requirement. This commit also allows the perf tests to be run as regular unit tests.
Commit migrated from https://github.com/dotnet/corefx/commit/fa1635c07dc664cfde16f471c296697d4fdb4c42
2015-11-04 07:58:23 -08:00
Eric St. John 8cc3c24b51 Update lock files that were missed in previous restore.
A change was made to DNX to no longer restore project.jsons
that are in nested folders.  This caused my batch update to miss
a number of tests and reference assembly projects.

This fixes the stale lock files, but restore is still broken.

[tfs-changeset: 1540448]


Commit migrated from https://github.com/dotnet/corefx/commit/3622cccc1b22fa1947a72d5126b59864e9d2fd0d
2015-10-21 18:59:09 -07:00
Eric St. John 543808303a Update dnx to v1.0.0-rc1-15838, update dotnet projects to generations
We need a new DNX to understand the latest packages.

We also need to move all "dotnet" projects to use dotnetX.X (generations)
now that the packages no longer have "dotnet" assets.

The new version of DNX dropped support for the aspnetcore
so I needed to update a few projects/packages that depended
on old package versions that had this moniker.

[tfs-changeset: 1540388]


Commit migrated from https://github.com/dotnet/corefx/commit/38f8d7a3ca1ee819c2b8eabb1c07ee4e99683c97
2015-10-21 17:03:48 -07:00
bartonjs a768025131 Update all project.lock.json files
Built Windows_NT, Linux, OSX with /p:LockDependencies=true.

CoreFX beta-* => 23419
xunit.netcore.extensions => 00107


Commit migrated from https://github.com/dotnet/corefx/commit/a14b22705df253508bd5f2dab0407bd2c7e4d639
2015-10-19 16:00:44 -07:00
Eric St. John 8cd3109d56 Switch from using "dotnet" to using "dotnet<generation>"
All projects that previously used dotnet have been updated to specify the appropriate generation of the surface area they depend on or in the case of desktop inbox contracts, the generation that includes the set of platforms they can support.

Now all packages contain all generations of API that they have ever shipped.

In doing this I needed to change how we determine package version.  Before we ensured all assemblies would have the same version and used that.  Now we choose the max.

Additionally I needed to change how we chose which asset to use for netcore50 when the dotnet asset was obscured by a placeholder for a previous netcore release (eg System.Runtime will have placeholders for Win8 since it was inbox there).  To do this I wrote a task that uses nuget to evaluate the package assets with and without the placeholders.  In this way it chooses the "best" dotnet implementation and reference assembly to use for netcore50.

This new model made my old MSBuild-based validation impossible to carry forward, so I wrote better validation in a task that actually uses Nuget's asset resolution algorithm.  This uncovered many existing issues in packages that I have cleaned up.  The validation algorithm could use some polish but its working now.  Perf is not great, package build went from 15s to ~2 minutes.  I'll work on this some more by making it incremental (input: nuspec, output: marker created on success).  Profiling shows that most of the time is spent in calling the nuget APIs.  I'll see if I can reduce some of this with caching for things that don't change (eg: RID graph).  Ultimately I think its a reasonable tradeoff for the types of bugs I can find this way.

[tfs-changeset: 1539216]


Commit migrated from https://github.com/dotnet/corefx/commit/0931c347eb836c9da94d0d5ff9ad7a14403b9738
2015-10-18 21:12:23 -07:00
Ian Hays 1a12a1d25d Update and addition to Performance tests
- Made the existing perf tests for Linq follow the new syntax and use the new runner
- Removed all references to v5.0 libraries being required as they no longer are
- Added new tests using usage data from aspnet/benchmarks
- Modified some existing tests to be more easily comparable using analysis tools that look at inlinedata/memberdata (e.g. System.IO.Compression)
- Updated the lock files to use the latest xunit-performance package
- Modified test structure and innerIteration loops to produce more consistently repeatable results
- Updated docs with change to csproj requirements


Commit migrated from https://github.com/dotnet/corefx/commit/2ad9a6ffa7f6bcd31382372609849af5caa6a1bd
2015-10-13 14:28:01 -07:00
Jeremy Kuhne 9868dd72bf Merge pull request dotnet/corefx#3549 from JeremyKuhne/GetFullPath
Address perf for GetFullPath and defer to OS.

Commit migrated from https://github.com/dotnet/corefx/commit/acf5f71fbf8a6d6bf1081c6a9d326623b9337d78
2015-10-12 15:25:27 -07:00
Stephen Toub 4ad5069681 Merge pull request dotnet/corefx#3774 from stephentoub/cleanup_test_folder
Reorganize src\Common\tests\ a bit

Commit migrated from https://github.com/dotnet/corefx/commit/1f09da3af8bd261ae48e6405b98daf6f7fe516b3
2015-10-12 15:09:10 -04:00
Rainer Sigwald e2dd621454 Allow recursive Directory.Delete of paths with trailing slash
Fixes dotnet/corefx#3780.

FindFirstFile with a normal path will happily collapse multiple
backslashes into a single logical path separator, but when presented
with a `\\?\` path, that doesn't happen.  As a result, unconditionally
concatenating a path-separator was fine until RemoveDirectoryHelper was
always called with EnsureExtendedPrefix (which is needed for extended
path support, introduced in 0721434).  With that, Win32 FindFirstFile
returns an error if there's a double backslash in the path beyond the
prefix.


Commit migrated from https://github.com/dotnet/corefx/commit/cb3724deb88743495f8b73f56509267db9796300
2015-10-12 11:30:50 -05:00
stephentoub ba9fea449f Reorganize src\Common\tests
Our common tests folder has gotten a bit unwieldy in its organization.  This change simply moves files around to better map to how src\Common\src is organized.  Files are now stored in a path based on functionality/namespace.

I mostly kept groups of functionality together and did not attempt to reorganize at that level, e.g. I moved the src\Common\tests\System.Xml.XPath\ folder to be src\Common\tests\System\Xml\XPath\ and did not further reorganize all of the folders/files it contains.  Such cleanup can be done separately on each individual area.

Some of the files also need to be cleaned up internally, e.g. the namespace (or lack thereof), so I put such things in a path that I thought made sense even if it differs from the current namespace in the file; I wanted this change to be relatively simple and just be about moving files around to clean up the main hierarchy.


Commit migrated from https://github.com/dotnet/corefx/commit/9a5546c439f7700d3462564678aa4206c7fbf4f1
2015-10-11 15:44:39 -04:00
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
Peter Jas a29604278c code: Fixes occurred spelling.
Fixes dotnet/corefx#3661.


Commit migrated from https://github.com/dotnet/corefx/commit/544a3885ff51e04db89b70e3f155be1a5c64f166
2015-10-06 15:27:09 +00:00
Ian Hays de822c50f0 Updated perf tests and documentation
- Updated getting started perf docs
- Removed caching of collections for tests; my results found the caching of negligible benefit
- Changed from MemberData to InlineData where possible to simplify matching method signatures for the perf analysis tools.
- Fixed the namespace for FileSystem tests to be the same as the other FS tests


Commit migrated from https://github.com/dotnet/corefx/commit/f551cdfe7bd815b8d99ac5577fbbc7d88b5ae472
2015-10-02 11:37:12 -07:00
Stephen Toub 73092b7818 Merge pull request dotnet/corefx#3511 from stephentoub/filestream_perf
Improve UnixFileStream.Read/WriteAsync consistency and perf

Commit migrated from https://github.com/dotnet/corefx/commit/35668ab9aa781c5a172372ea59218332181c6bbd
2015-10-02 09:38:11 -04:00
Matt Ellis c6e0d9dcf2 Update lock files
Commit migrated from https://github.com/dotnet/corefx/commit/b9f29bfa2b29055e3f93b23fadc86323f728637d
2015-10-02 00:21:35 -07:00
Ian Hays 0f8197a86c Update CoreFX to xunit 2.1.0
Commit migrated from https://github.com/dotnet/corefx/commit/87b48c58936d66fcb201b3a8ad0961fa055f23b9
2015-10-01 19:56:49 -07:00
stephentoub e41eb4e117 Improve UnixFileStream.Read/WriteAsync consistency and perf
This commit addresses two related issues.

1) When a FileStream is created on Windows with FileOptions.Asynchronous (the default in corefx), synchronous Read and Write operations are actually implemented as blocking wrappers for ReadAsync and WriteAsync.  Since in FileOptions.Asynchronous mode ReadAsync and WriteAsync can be used to issue requests that run concurrently, this also means that a call to Read/Write could safely be made on the stream while a ReadAsync/WriteAsync operation was in progress.  In contrast in the current Unix implementation, Read/Write are not implemented as wrappers for ReadAsync/WriteAsync, so although ReadAsync/WriteAsync can have operations overlapped, using Read/Write while such an operation was outstanding could result in corruption of the FileStream, and in particular of its internal buffer.  In general, such usage patterns are not encouraged, but we should aim to be consistent across platforms in how we handle them and whether corruption is possible.

2) On Windows, when in FileOptions.Asynchronous mode, ReadAsync/WriteAsync use the stream's internal buffer directly, potentially avoiding making any asynchronous calls and just returning synchronously if the request can be satisfied using the buffer.  On Unix we were never doing that.

This commit addresses these as follows:
- One extra field is added to UnixFileStream that stores additional state used when FileOptions.Asynchronous is set.  This state includes a semaphore used to synchronize operations, as well as storage for the buffer/offset/count from the currently active async call, and a cached task that can be handed back for some ReadAsync operations.
- When FileOptions.Asynchronous is not set, little changes: Read/Write/ReadAsync/WriteAsync/ReadByte/WriteByte all check _useAsyncIO, and do exactly what they do today if it's false.
- When FileOptions.Asynchronous is set, Read/Write/ReadByte/WriteByte wrap their current behavior with calls to the semaphore's Wait/Release, such that they will be appropriately serialized with other outstanding asynchronous operations happening on the stream.  This addresses issue (1).
- For (2), when FileOptions.Asynchronous is set, ReadAsync/WriteAsync check whether there is enough data/space in the internal buffer to satisfy the request synchronously, and if there is they do the buffer copy synchronously and return an already completed task.  Since it's very common to ask for the same amount of data on each call, and thus if it's satisified by the buffer get exactly the same amount of data on each call, in ReadAsync we cache a task with a Result of the last number of bytes returned, and we reuse that task the next time if it contains the appropriate count.  This same optimization is already employed in the Windows implementation. When we do need to schedule work asynchronously, we also do so explicitly using a continuation off of the semaphore's WaitAsync rather than using the base implementation.  Due to the base Stream's implementation and its need to account for legacy async models, this ends up reducing the amount of memory used to schedule the async operation by ~50%.


Commit migrated from https://github.com/dotnet/corefx/commit/153e42839c3090de8ea705f94fd6f83b119ba4f4
2015-10-01 14:01:47 -04:00
Stephen Toub 53d51d4237 Merge pull request dotnet/corefx#3523 from ianhays/perf
Updated performance tests

Commit migrated from https://github.com/dotnet/corefx/commit/252333c428055b628495f72214936c0a05de9477
2015-10-01 08:33:10 -04:00
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
bartonjs a52f41057c Update all CoreFx package references to 23328 build.
`build.cmd /p:LockDependencies=true` was the start of this change, but some errors with xunit build numbers led to all xunit upgrades being reset back to what they had in master.

project.json changes:
* System.Net.Security\src Switch off of explicit beta versioning, use the same baseline as everyone else.  The S.S.C.Algorithms explicit upgrade is no longer required.
* System.Net.Requests\tests didn't build.  Looking at the project.lock.json change, it appeared that a System.Net.Http reference was lost, restored it.
* System.Net.Http\tests didn't build. Looking at the project.lock.json change, it appeared that a System.IO.FileSystem reference was lost, restored it.
* System.Net.WebSockets.Client\src didn't build. Looking at the project.lock.json change, it appeared that a System.Collections (4.0.10) reference was lost, restored it.
* System.Diagnostics.TextWriterTraceListener\tests needed the runtime reference to load the correct System.Diagnostics.TraceSource binary.


Commit migrated from https://github.com/dotnet/corefx/commit/cec3a0f2db542bfa9d9c56bf988d966eacc35ad9
2015-09-29 11:40:37 -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
stephentoub 306c48fe6e Remove overaggressive assert in UnixFileStream
I'd added an assert that fires if a DeleteOnClose file's unlink during disposal fails.  But it's valid for it to fail, e.g. if something elsewhere in this process or otherwise deletes or moves the file while it's open.  This happens, for example, in a bunch of our FileSystemWatcher tests.

Removing the assert.


Commit migrated from https://github.com/dotnet/corefx/commit/da78c4987dc463a4de2fd7d0e12515fb7bce424a
2015-09-24 23:34:20 -04: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
stephentoub f62d508da6 Add Interop.ErrorInfo.ToString for debugging
Commit migrated from https://github.com/dotnet/corefx/commit/2a16e29d6f5a0ecd235bb6867f35d82e8eeed00b
2015-09-23 12:34:12 -04:00
stephentoub 675beeeee6 Fix several issues in UnixFileStream
I'm trying to track down the cause of a sporadic failure in CI of the MemoryMappedFilesTests.DataShared test.  In doing so, I've run across a few issues to be fixed (though I'm not sure any of these are the cause):

- Fix the checking/setting of several FileOptions... we weren't correctly treating the options as a [Flags], which meant we'd incorrectly ignore some options if multiple options were specified.

- When opening a FileStream, if the PosixFAdvise or SeekCore failed, we weren't deterministically disposing of the file handle, instead leaving it up to finalization to close.

- If Close on the file descriptor fails (e.g. it's interrupted), we don't attempt a retry, by design.  However, closing of the handle is what releases the advisory lock we placed on the file descriptor when the UnixFileStream was constructed.  Added an explicit call to remove the lock, separate from closing the descriptor. (I thought this one would have been the cause of the sporadic test failure, but if it were the problem, the assert in SafeFileHandle.ReleaseHandle should have fired, and it didn't in the one occurence I saw since that assert got added.)

- Removed several stale TODOs and replaced them with explanatory comments.

- Added several more Debug.Asserts

Separately, I also tweaked TempFile to simplify its ctor to use File.WriteAllBytes.


Commit migrated from https://github.com/dotnet/corefx/commit/1e0cd691eee8bd65a3fed666ac4ea6a208a78b8c
2015-09-23 12:33:52 -04:00
Stephen Toub b4e2952db8 Merge pull request dotnet/corefx#3372 from stephentoub/case_sensitivity
Add internal platform-agnostic case sensitivity detection

Commit migrated from https://github.com/dotnet/corefx/commit/ed45618b1ef82f1efb661ea0e80c4bd824433079
2015-09-22 22:14:32 -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
stephentoub 02007d2533 Add platform-agnostic case sensitivity detection
After the recent refactoring based on introducing native shims, the only reason there are special builds of System.IO.FileSystem and System.IO.FileSystem.DriveInfo for each of Linux and OS X is because of PathInternal.CaseSensitive/CaseInsensitive.cs, which just provides a hard-coded value as to whether the target platform is case-sensitive or case-insensitive-but-preserving.  Similarly, these files are the only things forcing System.IO.Compression.ZipFile to not be completely platform-agnostic and to have separate Windows/Unix builds.

This commit recombines those assemblies by adding a platform-agnostic helper that simply creates a temporary file with upper-case letters and then checks whether that file can be found via the lower-cased version.  This isn't perfect, in that it's possible to mount multiple file systems each with different case sensitivities, but a) it's better than the hardcoded version we currently have, and b) I don't know of any better portable solution.

(Issue dotnet/corefx#3156 tracks adding an API to provide information on case sensitivity.  This change can be replaced by using such an API if/when it's available.)


Commit migrated from https://github.com/dotnet/corefx/commit/62ba788d4730be24cff0ff0432f43bcc7b9e4561
2015-09-22 12:35:47 -04:00