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
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
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
- 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
Fixesdotnet/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
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
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
- 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
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
- 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
`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
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
- 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
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
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
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
We were using -Wall but now use -Weverything and opt out of only
a handful of issues such as C++-98 compat, which we don't need.
The most notable impact is that the compiler now catches
narrowing implicit conversions, which was also the primary
motivation for doing this now as there was known debt in our
unsupervised usage of 64-bit types for sizes.
We now assert on bad buffer sizes *and* retain full checks in
release builds to be completely defensive against overflow.
We now use int32_t for scratch buffer sizes. int64_t remains for
file offsets and uint64_t remains for memory mapped files, but
int32_t for scratch eliminates a bunch of managed casts and
therefore makes it easier to reason about overflow prevention.
INT32_MAX is also the most portable limit on these buffer sizes
because the behavior of functions like read is only implementation
defined when the input size is greater than SSIZE_MAX and ssize_t
is int32_t on the lowest common denominator of modern platforms.
Enums corresponding to platform values are now enum X : T instead
of enum class X : T. The PAL_* names are descriptive enough without
scoping and the implicit conversion to raw integer is actually helpful
to avoid a bunch of casts, which are otherwise needed to interop with
the corresponding native API.
Commit migrated from https://github.com/dotnet/corefx/commit/648c01d69fba8d23750122d9823f53257785c8ca
Stream.Read is not required to hand back as many bytes as the caller requested; a conforming implementation can hand back any number > 0 and <= count when there's still data left in the stream, and many streams do frequently return < count. UnixFileStream currently frequently does this, returning what's left in the internal buffer when there's any data left in the buffer.
Win32FileStream, however, in this case does a subsequent read from the underlying file handle to try to give back as much data as the user requested. This request still may not return the requested count, either because we reached the end of the file or because Windows decided not to return as much data as was requested, but it frequently will. As such, some code has been written to expect this behavior, and while that code is flawed and should be fixed even on Windows, it frequently works.
To maintain the consistency with Windows, this change updates UnixFileStream to do such a subsequent read if we tried to satisfy a Read request purely from the buffer but didn't have as much data as the user requested. I've not added a test for the behavior, because a) it's not guaranteed by Stream.Read, but more importantly b) the test could fail because the OS may not give us back what we requested.
Commit migrated from https://github.com/dotnet/corefx/commit/da456e315cf4c52334f9ed6315c0523af534bc37
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.
Fixesdotnet/corefx#3173
Commit migrated from https://github.com/dotnet/corefx/commit/6df77fdbb6cf8e0d35a3074bb325f7810085daa3
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