From: Viktor Hofer Date: Thu, 21 Feb 2019 14:18:47 +0000 (+0100) Subject: Add test targets to build script (dotnet/corefx#34385) X-Git-Tag: submit/tizen/20210909.063632~11031^2~2383 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfe2b0e98c2481013bd910f259ebdcaa40b8873e;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add test targets to build script (dotnet/corefx#34385) * Add test targets to build script * Remove few manual copy targets in projects * Remove PlatformAbstractions dependency * Update ArchiveTests type to enum * Set warnaserror false on arm/arm64 * Update docs * Darc update from build '20190221.4' Commit migrated from https://github.com/dotnet/corefx/commit/a619534cac9b7d000f0899248656d232cb44f61f --- diff --git a/docs/libraries/architecture/net-core-applications.md b/docs/libraries/architecture/net-core-applications.md index 3a5ea4e..a2c0a27 100644 --- a/docs/libraries/architecture/net-core-applications.md +++ b/docs/libraries/architecture/net-core-applications.md @@ -5,11 +5,11 @@ NETCoreApp is the [target framework](https://docs.nuget.org/Create/TargetFramewo Property | Value ---------|--------- Target framework identifier | `.NETCoreApp` -Target framework version | `1.0` -Target framework moniker | `.NETCoreApp,Version=v1.0` +Target framework version | `3.0` +Target framework moniker | `.NETCoreApp,Version=v3.0` Friendly name | .NET Core Application -NuGet folder name | `netcoreapp1.0` -NETStandard version supported | `netstandard1.6` +NuGet folder name | `netcoreapp3.0` +NETStandard version supported | `netstandard2.0` ## FAQ **Q: What is a .NET Core application?** @@ -18,24 +18,15 @@ NETStandard version supported | `netstandard1.6` **Q: Can I share source between a .NET Core application, and other target frameworks?** **A:** Yes. Most of the API supported by .NET Core application is also part of .NET Standard. That source could be compiled as a .NET Standard library and shared with a .NET Core application and a .NET Framework application as a binary. Alternatively, the source could be shared and cross-compiled between a .NET Core application and a .NET Framework application. -**Q: Can a .NET Core application depend on more packages than just those in the `NETStandard.Library` package?** -**A:** Yes. The contents of `NETStandard.Library` represent the standard library and are guaranteed to be supported by all platforms, including .NET Core applications, that support standard library. Packages outside of this set will be supported so long as their dependencies are provided and none are platform specific. - **Q: Can a .NET Core application depend on more packages than just those in the `Microsoft.NETCore.App` package?** **A:** Yes. The contents of `Microsoft.NETCore.App` at a particular version are guaranteed to run on every platform where that version .NET Core is released. Packages outside this set can be used but don't come with that guarantee. For instance, if a package is not part of `Microsoft.NETCore.App` and needs to be cross-compiled specifically for a new OS, there is no guarantee that it will be re-released when .NET Core supports that new OS. -**Q: Why is there only one version of `.NETCoreApp` (1.0), but there are many of `.NETStandard`?** -**A:** `.NETStandard` is an abstract representation of API that covers all historical platforms that have ever supported that API. `.NETCoreApp` represents a concrete application type with a runnable implementation. We are shipping one version of this implementation at this point and it supports `netstandard1.6`. As we version `.NETStandard` in the future we will update the implementation of `.NETCoreApp` to support the new API and ship a new version of `.NETCoreApp`. - **Q: Can a .NET Core application depend on platform specific packages like `Microsoft.Win32.Registry`?** **A:** Yes, but it will only run on the platforms that support those packages. **Q: How is this different than `.NETCore`?** **A:** The `.NETCore` target framework represents Windows 8, Windows 8.1, and Universal Windows Platform applications. For compatibility purposes this moniker cannot be reused for “.NET Core applications”. The branding overlap is unfortunate. -**Q: How is this different than `DNXCore`?** -**A:** The `DNXCore` target framework represents ASP.NET V5 applications that run in DNX and use XProj. As such the TFM already had more characteristics associated with it than those we associate with .NET Core application. .NET Core applications need not be ASP.NET applications and can run on any host and runtime supported by .NET Core. - **Q: How is this different than `.NETStandard`?** **A:** The `NETStandard` target framework is an abstract target framework that represents API surface of many frameworks and platforms. As such `NETStandard` assemblies can run on any platform that supports the `NETStandard` targeted by that assembly, for example: .NET Desktop, Windows Phone, Universal Windows Platform applications, .NET Core applications, etc. `NETCoreApplication` is a concrete target framework that represents a single platform with both API surface and implementation. .NET Core applications are runnable on their own. .NETStandard libraries must be published-for or consumed-by a specific concrete target framework to be used in that type of application. diff --git a/docs/libraries/building/advanced-inner-loop-testing.md b/docs/libraries/building/advanced-inner-loop-testing.md index e5e08ed..fd428d6 100644 --- a/docs/libraries/building/advanced-inner-loop-testing.md +++ b/docs/libraries/building/advanced-inner-loop-testing.md @@ -10,13 +10,13 @@ For the sake of completeness, we have placed our repositories under `d:\git\`. If you've made changes to coreclr make sure to also build it and pass its binaries to corefx. ``` coreclr\build -release -corefx\build -release -- /p:CoreCLROverridePath=d:\git\coreclr\bin\Product\Windows_NT.x64.Release\ +corefx\build -c Release /p:CoreCLROverridePath=d:\git\coreclr\bin\Product\Windows_NT.x64.Release\ ``` ## Compile corefx with pre-compiled coreclr binaries If you haven't made any changes to coreclr you're fine with just building corefx. This automatically picks pre-compiled coreclr binaries from MyGet. ``` -corefx\build -release +corefx\build -c Release ``` ## Create and prepare your application @@ -42,7 +42,7 @@ public class Program 3. Copy the just built corefx assemblies into your application directory. When using Visual Studio or the .NET Core SDK Host (`dotnet.exe`) you usually compile against *reference assemblies*. For simplicity we compile against the same assembly set that we use during run time. ``` -xcopy ..\corefx\bin\testhost\netcoreapp-Windows_NT-Release-x64\shared\Microsoft.NETCore.App\9.9.9 runtime /e /i /y /s +xcopy ..\corefx\artifacts\bin\testhost\netcoreapp-Windows_NT-Release-x64\shared\Microsoft.NETCore.App\9.9.9 runtime /e /i /y /s ``` You don't need all the assemblies that are built by corefx but copying the entire directory makes it easier if you want to reference additional ones. At a minimum, this app will need the following assemblies to run: diff --git a/docs/libraries/building/code-coverage.md b/docs/libraries/building/code-coverage.md index a90dded..65618e1 100644 --- a/docs/libraries/building/code-coverage.md +++ b/docs/libraries/building/code-coverage.md @@ -40,11 +40,11 @@ You can navigate to this from your PR by clicking the "Details" link to the righ ## Local Code Coverage Runs -You can perform code coverage runs for the entire repository locally by adding the `coverage` argument to the `build -includetests` command. +You can perform code coverage runs for the entire repository locally by adding the `coverage` switch (assuming that source and test assemblies are already built): - build -includetests -coverage + build -test -coverage -This builds and tests the test assemblies and generates the full code coverage report. The resulting index.htm file providing the results of the run should be available at: +This runs the tests and generates the full code coverage report. The resulting index.htm file providing the results of the run should be available at: artifacts\coverage\index.htm diff --git a/docs/libraries/building/cross-building.md b/docs/libraries/building/cross-building.md index 33d9e28..8cbe9e7 100644 --- a/docs/libraries/building/cross-building.md +++ b/docs/libraries/building/cross-building.md @@ -57,7 +57,7 @@ And with: As usual the generated binaries will be found in `bin/BuildOS.BuildArch.BuildType/native` as following: - lgs@ubuntu ~/git/corefx/ ls -al ./bin/Linux.arm.Debug/native + lgs@ubuntu ~/git/corefx/ ls -al ./artifacts/bin/Linux.arm.Debug/native total 988 drwxrwxr-x 2 lgs lgs 4096 3 6 18:33 . drwxrwxr-x 3 lgs lgs 4096 3 6 18:33 .. @@ -78,7 +78,7 @@ The managed components of CoreFX are architecture-independent and thus do not re Many of the managed binaries are also OS-independent, e.g. System.Linq.dll, while some are OS-specific, e.g. System.IO.FileSystem.dll, with different builds for Windows and Linux. - lgs@ubuntu ~/git/corefx/ $ ./build.sh -debug /p:BuildNative=false + lgs@ubuntu ~/git/corefx/ $ ./build.sh /p:BuildNative=false The output is at `bin/[BuildConfiguration]` where `BuildConfiguration` looks something like `netcoreapp--Debug-`. Ex: `bin/netcoreapp-Linux-Debug-x64`. For more details on the build configurations see [project-guidelines](../coding-guidelines/project-guidelines.md) @@ -102,7 +102,7 @@ prajwal@ubuntu ~/corefx $ ./scripts/arm32_ci_script.sh \ --buildConfig=Release ``` -The Linux ARM Emulator is based on the soft floating point and thus the native binaries are generated for the armel architecture. The corefx binaries generated by the above command can be found at `~/corefx/bin/Linux.armel.Release`, `~/corefx/bin/Linux.AnyCPU.Release`, `~/corefx/bin/Unix.AnyCPU.Release`, and `~/corefx/bin/AnyOS.AnyCPU.Release`. +The Linux ARM Emulator is based on the soft floating point and thus the native binaries are generated for the armel architecture. The corefx binaries generated by the above command can be found at `~/corefx/artifacts/bin/Linux.armel.Release`, `~/corefx/artifacts/bin/Linux.AnyCPU.Release`, `~/corefx/artifacts/bin/Unix.AnyCPU.Release`, and `~/corefx/artifacts/bin/AnyOS.AnyCPU.Release`. Build corefx for a new architecture @@ -113,10 +113,10 @@ When building for a new architecture you will need to build the native pieces se Example building for armel ``` src/Native/build-native.sh armel ---> Output goes to bin/runtime/netcoreapp-Linux-Debug-armel +--> Output goes to artifacts/bin/runtime/netcoreapp-Linux-Debug-armel build /p:ArchGroup=x64 /p:BuildNative=false ---> Output goes to bin/runtime/netcoreapp-Linux-Debug-x64 +--> Output goes to artifacts/bin/runtime/netcoreapp-Linux-Debug-x64 ``` The reason you need to build the managed portion for x64 is because it depends on runtime packages for the new architecture which don't exist yet so we use another existing architecture such as x64 as a proxy for building the managed binaries. diff --git a/docs/libraries/building/unix-instructions.md b/docs/libraries/building/unix-instructions.md index fcb39a5..47796f3 100644 --- a/docs/libraries/building/unix-instructions.md +++ b/docs/libraries/building/unix-instructions.md @@ -9,7 +9,7 @@ Building CoreFX on FreeBSD, Linux and OS X Calling the script `build.sh` builds both the native and managed code. -For more information about the different options when building, run `build.sh -?` and look at examples in the [developer-guide](../project-docs/developer-guide.md). +For more information about the different options when building, run `build.sh --help` and look at examples in the [developer-guide](../project-docs/developer-guide.md). ## Minimum Hardware Requirements - 2GB RAM diff --git a/docs/libraries/building/windows-instructions.md b/docs/libraries/building/windows-instructions.md index e9b2559..c367bed 100644 --- a/docs/libraries/building/windows-instructions.md +++ b/docs/libraries/building/windows-instructions.md @@ -103,7 +103,7 @@ Visual Studio Solution (.sln) files exist for related groups of libraries. These Note that when calling the script `build.cmd` attempts to build both the native and managed code. -For more information about the different options when building, run `build.cmd -?` and look at examples in the [developer-guide](../project-docs/developer-guide.md). +For more information about the different options when building, run `build.cmd -help` and look at examples in the [developer-guide](../project-docs/developer-guide.md). ### Running tests from the command line diff --git a/docs/libraries/debugging/debugging-packages.md b/docs/libraries/debugging/debugging-packages.md index d8ff10b..e01a153 100644 --- a/docs/libraries/debugging/debugging-packages.md +++ b/docs/libraries/debugging/debugging-packages.md @@ -99,7 +99,7 @@ ResolvePkgProjReferences: To run a test from a single Build Pivot combination, specify all properties and build the `csproj`: ``` -dotnet msbuild System.Net.ServicePoint.Tests.csproj /t:rebuildandtest /p:TargetGroup=netcoreapp2.0 /p:Outerloop=true /p:xunitoptions=-showprogress /p:ConfigurationGroup=Debug +dotnet msbuild System.Net.ServicePoint.Tests.csproj /t:rebuildandtest /p:TargetGroup=netcoreapp2.0 /p:OuterLoop=true /p:xunitoptions=-showprogress /p:ConfigurationGroup=Debug ``` Will run the test using the following pivot values: * Architecture: AnyCPU diff --git a/docs/libraries/debugging/windows-instructions.md b/docs/libraries/debugging/windows-instructions.md index 29ca07f..26bfd11 100644 --- a/docs/libraries/debugging/windows-instructions.md +++ b/docs/libraries/debugging/windows-instructions.md @@ -173,4 +173,4 @@ Helper scripts are available at https://github.com/dotnet/corefx/tree/master/src * `*System.Threading.Tasks.Dataflow.DataflowEventSource {16F53577-E41D-43D4-B47E-C17025BF4025}`: Provides an event source for tracing Dataflow information. ## Notes -* You can find the test invocation command-line by looking at the logs generated after the `dotnet msbuild /t:rebuild,test` within the test folder. +* You can find the test invocation command-line by looking at the logs generated after the `dotnet msbuild /t:rebuildandtest` within the test folder. diff --git a/docs/libraries/project-docs/benchmarking.md b/docs/libraries/project-docs/benchmarking.md index d745445..325ffef 100644 --- a/docs/libraries/project-docs/benchmarking.md +++ b/docs/libraries/project-docs/benchmarking.md @@ -16,7 +16,7 @@ See [BenchmarkDotNet](https://benchmarkdotnet.org/articles/guides/getting-starte Since `0.11.1` BenchmarkDotNet knows how to run benchmarks with CoreRun. So you just need to provide it the path to CoreRun! The simplest way to do that is via console line arguments: - dotnet run -c Release -f netcoreapp3.0 -- -f *MyBenchmarkName* --coreRun "C:\Projects\corefx\bin\testhost\netcoreapp-Windows_NT-Release-x64\shared\Microsoft.NETCore.App\9.9.9\CoreRun.exe" + dotnet run -c Release -f netcoreapp3.0 -- -f *MyBenchmarkName* --coreRun "C:\Projects\corefx\artifacts\bin\testhost\netcoreapp-Windows_NT-Release-x64\shared\Microsoft.NETCore.App\9.9.9\CoreRun.exe" **Hint:** If you are curious to know what BDN does internally you just need to apply `[KeepBenchmarkFiles]` attribute to your class or set `KeepBenchmarkFiles = true` in your config file. After running the benchmarks you can find the auto-generated files in `%pathToBenchmarkApp\bin\Release\$TFM\` folder. @@ -52,7 +52,7 @@ If you want to run your benchmarks without spawning a new process per benchmark 1. Before you start benchmarking the code you need to build entire CoreFX in Release which is going to generate the right CoreRun bits for you: - C:\Projects\corefx>build.cmd -release /p:ArchGroup=x64 + C:\Projects\corefx>build.cmd -c Release -arch x64 After that, you should be able to find `CoreRun.exe` in a location similar to: @@ -98,7 +98,7 @@ After that, you should be able to find `System.Private.Corelib.dll` in a locatio 2. Build entire CoreFX in Release using your local private build of coreclr (See [Testing With Private CoreCLR Bits](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md#testing-with-private-coreclr-bits)) - C:\Projects\corefx>build.cmd -release /p:CoreCLROverridePath=C:\Projects\coreclr\bin\Product\Windows_NT.x64.Release + C:\Projects\corefx>build.cmd -c Release /p:CoreCLROverridePath=C:\Projects\coreclr\bin\Product\Windows_NT.x64.Release After that, you should be able to find `CoreRun.exe` in a location similar to: @@ -128,7 +128,7 @@ class Program - Rebuild given CoreFX part in Release: - C:\Projects\corefx>build.cmd -release /p:CoreCLROverridePath=C:\Projects\coreclr\bin\Product\Windows_NT.x64.Release + C:\Projects\corefx>build.cmd -c Release /p:CoreCLROverridePath=C:\Projects\coreclr\bin\Product\Windows_NT.x64.Release - OR manually copy over the relevant files from within the root of the coreclr output folder to where `CoreRun.exe` lives within corefx (excluding the subdirectories). This ends up being much faster than the first option and if the only thing that changed is `System.Private.Corelib.dll`, just copy that over: diff --git a/docs/libraries/project-docs/consumes-api.md b/docs/libraries/project-docs/consumes-api.md deleted file mode 100644 index d1e9288..0000000 --- a/docs/libraries/project-docs/consumes-api.md +++ /dev/null @@ -1,7 +0,0 @@ -[Consumes API specification](https://github.com/dotnet/buildtools/blob/master/Documentation/RepoCompose.md#consumes-1) - -In CoreFx, we'll be using the RepoUtil tool to generate consumes data. RepoUtil examines all of the repo's project.json -files to determine external dependencies. - -We have a lot of differing package dependency versions on libraries in our tree (ie test-runtime, ref assembly packages, -implementation packages, etc...). Our stable versioned dependencies will become fixed package outputs in the consumes API. Prerelease fixed packages will still need to be listed in the "fixedPackages" section of RepoData.json. diff --git a/docs/libraries/project-docs/developer-guide.md b/docs/libraries/project-docs/developer-guide.md index 3f33778..7431495 100644 --- a/docs/libraries/project-docs/developer-guide.md +++ b/docs/libraries/project-docs/developer-guide.md @@ -16,13 +16,9 @@ Building the repository The CoreFX repo can be built from a regular, non-admin command prompt. The build produces multiple binaries that make up the CoreFX libraries and the accompanying tests. -Developer Workflow ------------------- -The dev workflow describes the [development process](https://github.com/dotnet/buildtools/blob/master/Documentation/Dev-workflow.md) to follow. It is divided into specific tasks that are fast, transparent and easy to understand. - -For more information about the different options that each task has, use the argument `-?` when calling the script. For example: +For information about the different options that are available use the argument `-help|-h` when calling the build script: ``` -build -? +build -h ``` ### Build @@ -33,18 +29,22 @@ Calling the script `build` attempts to build both the native and managed code. The build configurations are generally defaulted based on where you are building (i.e. which OS or which architecture) but we have a few shortcuts for the individual properties that can be passed to the build scripts: -- `-framework` identifies the target framework for the build. It defaults to `netcoreapp` but possible values include `netcoreapp`, `netfx` or `uap`. (msbuild property `TargetGroup`) +- `-framework|-f` identifies the target framework for the build. It defaults to `netcoreapp` but possible values include `netcoreapp`, `netfx` or `uap`. (msbuild property `TargetGroup`) - `-os` identifies the OS for the build. It defaults to the OS you are running on but possible values include `Windows_NT`, `Unix`, `Linux`, or `OSX`. (msbuild property `OSGroup`) -- `-debug|-release` controls the optimization level the compilers use for the build. It defaults to `Debug`. (msbuild property `ConfigurationGroup`) -- `/p:ArchGroup` identifies the architecture for the build. It defaults to `x64` but possible values include `x64`, `x86`, `arm`, or `arm64`. (msbuild property `ArchGroup`) +- `-configuration|-c Debug|Release` controls the optimization level the compilers use for the build. It defaults to `Debug`. (msbuild property `ConfigurationGroup`) +- `-arch` identifies the architecture for the build. It defaults to `x64` but possible values include `x64`, `x86`, `arm`, or `arm64`. (msbuild property `ArchGroup`) For more details on the build configurations see [project-guidelines](../coding-guidelines/project-guidelines.md#build-pivots). -**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch. +**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch. If you invoke the build script without any actions, the default action chain `-restore -build` is executed. This means that restore and build are not implicit when invoking other actions! + +**Note:** You can chain multiple actions together but the order of execution is fixed and does not relate to the position of the argument in the command. The most common workflow for developers is to call `build` from the root once (preceded by a `clean -all` if you have built previously) and then go and work on the individual library that you are trying to make changes for. On windows folks will usually open up the solution file in the root of that library directory and work in VS. -By default build only builds the product libraries and none of the tests if you want to build and run all the tests you can call `build -test` to build and run only the tests or `build -includetests` to build the project as well as the tests +By default build only builds the product libraries and none of the tests. If you want to build the tests you can call `build -buildtests`. If you want to run the tests you can call `build -test`, `build -integrationTest` or `build -performanceTest`. To build and run the tests combine both arguments: `build -buildtests -test`. To build both the product libraries and the test libraries pass `build -build -buildtests` to the command line. If you want to further configure which test libraries to build you can pass `/p:TestProjectFilter=Tests|IntegrationTests|PerformanceTests` to the command. + +If you invoke the build script without any argument the default arguments will be executed `-restore -build`. Note that -restore and -build are only implicit if no actions are passed in. **Examples** - Clean and build the product libraries @@ -53,17 +53,17 @@ clean -all build ``` -- Building in debug mode for platform x64 +- Building in release mode for platform x64 (restore and build are implicit here as no actions are passed in) ``` -build -debug /p:ArchGroup=x64 +build -c Release -arch x64 ``` -- Building the src and then building and running the tests +- Building the src assemblies and build and run tests (running all tests takes a considerable amount of time!) ``` -build -includetests +build -restore -build -buildtests -test ``` -- Building for different target frameworks +- Building for different target frameworks (restore and build are implicit again as no action is passed in) ``` build -framework netcoreapp build -framework netfx @@ -102,12 +102,12 @@ To build the tests and run them you can call the build script passing -tests opt **Examples** - The following shows how to build only the tests but not run them ``` -build -test -skiptests +build -buildtests ``` - The following builds and runs all tests for netcoreapp in release configuration. ``` -build -test -release -framework=netcoreapp +build -buildtests -test -c Release -f netcoreapp ``` - The following example shows how to pass extra msbuild properties to ignore tests ignored in CI. @@ -145,7 +145,7 @@ build src\System.Collections\tests - All the options listed above like framework and configuration are also supported (note they must be after the directory) ``` -build System.Collections -framework:netfx -release +build System.Collections -f netfx -c Release ``` ### Building individual projects @@ -193,26 +193,26 @@ dotnet msbuild System.Net.NetworkInformation.csproj /t:RebuildAll ### Building all for other OSes By default, building from the root will only build the libraries for the OS you are running on. One can -build for another OS by specifying `build /p:OSGroup=[value]`. +build for another OS by specifying `build -os [value]`. Note that you cannot generally build native components for another OS but you can for managed components so if you need to do that you can do it at the individual project level or build all via passing `/p:BuildNative=false`. ### Building in Release or Debug By default, building from the root or within a project will build the libraries in Debug mode. -One can build in Debug or Release mode from the root by doing `build -release` or `build -debug` or when building a project by specifying `/p:ConfigurationGroup=[Debug|Release]` after the `dotnet msbuild` command. +One can build in Debug or Release mode from the root by doing `build -c Release` or `build -c Debug` or when building a project by specifying `/p:ConfigurationGroup=[Debug|Release]` after the `dotnet msbuild` command. ### Building other Architectures -One can build 32- or 64-bit binaries or for any architecture by specifying in the root `build /p:ArchGroup=[value]` or in a project `/p:ArchGroup=[value]` after the `dotnet msbuild` command. +One can build 32- or 64-bit binaries or for any architecture by specifying in the root `build -arch [value]` or in a project `/p:ArchGroup=[value]` after the `dotnet msbuild` command. ### Tests -We use the OSS testing framework [xunit](http://xunit.github.io/) with the [BuildTools test targets](https://github.com/dotnet/buildtools/blob/master/Documentation/test-targets-usage.md). +We use the OSS testing framework [xunit](http://xunit.github.io/). #### Running tests on the command line -Do build tests you need to pass `-test` flag (`build -test`) to build.cmd/sh or if you want to build both you pass `-includetests` flag (`build -includetests`). +To build tests you need to pass the `-buildtests` flag to build.cmd/sh or if you want to build both src and tests you pass `-buildtests` flag (`build -restore -build -buildtests`). Note that you need to specify -restore and -build additionally as those are only implicit if no action is passed in. For more information about cross-platform testing, please take a look [here](https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-platform-testing.md). @@ -255,20 +255,16 @@ dotnet msbuild System.Runtime.Tests.csproj /p:TargetGroup=netfx The tests can also be filtered based on xunit trait attributes defined in [`Microsoft.DotNet.XUnitExtensions`](https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.XUnitExtensions). These attributes are specified above the test method's definition. The available attributes are: -#### OuterloopAttribute +#### OuterLoopAttribute ```cs [OuterLoop()] ``` -Tests marked as `Outerloop` are for scenarios that don't need to run every build. They may take longer than normal tests, cover seldom hit code paths, or require special setup or resources to execute. These tests are excluded by default when testing through `dotnet msbuild` but can be enabled manually by adding the `Outerloop` property e.g. +Tests marked as `OuterLoop` are for scenarios that don't need to run every build. They may take longer than normal tests, cover seldom hit code paths, or require special setup or resources to execute. These tests are excluded by default when testing through `dotnet msbuild` but can be enabled manually by adding the `-outerloop` switch or `/p:OuterLoop=true` e.g. ```cmd -build -test -Outerloop -``` - -To run only the Outerloop tests, use the following command: -```cmd -dotnet msbuild /t:BuildAndTest /p:WithCategories=OuterLoop +build -test -outerloop +cd src/System.Text.RegularExpressions/tests && dotnet msbuild /t:RebuildAndTest /p:OuterLoop=true ``` #### PlatformSpecificAttribute @@ -412,18 +408,13 @@ dotnet msbuild /t:BuildAndTest /p:OSGroup=Windows_NT dotnet msbuild /t:BuildAndTest /p:OSGroup=OSX /p:WithCategories="OuterLoop;failing"" ``` -Alternatively, you can directly invoke the XUnit executable by changing your working directory to the test execution directory at `bin\tests\{OSPlatformConfig)\{Project}.Tests\{TargetGroup}.{TestTFM}\` which is created when the test project is built. For example, the following command runs all Linux-supported inner-loop tests: -```sh -./corerun xunit.console.dll -notrait category=nonlinuxtests -notrait category=OuterLoop -``` - ### Code Coverage Code coverage is built into the corefx build system. It utilizes OpenCover for generating coverage data and ReportGenerator for generating reports about that data. To run: ```cmd -:: Run full coverage -build -test -Coverage +:: Run full coverage (assuming sources and tests are already built) +build -test -coverage If coverage succeeds, the full report can be found at `artifacts\coverage\index.htm`. diff --git a/docs/libraries/project-docs/oss-signing.md b/docs/libraries/project-docs/oss-signing.md deleted file mode 100644 index 1417f68..0000000 --- a/docs/libraries/project-docs/oss-signing.md +++ /dev/null @@ -1,5 +0,0 @@ -Open Source Signing -=================== - -Documentation moved to [Public Signing](public-signing.md). - diff --git a/docs/libraries/project-docs/performance-tests.md b/docs/libraries/project-docs/performance-tests.md index 56f6cd4..3f3afb2 100644 --- a/docs/libraries/project-docs/performance-tests.md +++ b/docs/libraries/project-docs/performance-tests.md @@ -7,18 +7,18 @@ Building and Running Tests ----------- Performance test files (if present) are stored within a library's ```tests/Performance``` directory and contain test methods that are all marked with a perf-specific *Benchmark* attribute. -**Step # 1:** Prior to running performance tests, a full build from the repo root must be completed: ```build -release``` +**Step # 1:** Prior to running performance tests, a full build from the repo root must be completed: `build -c Release` **Step # 2:** Change directory to the performance tests directory: ```cd path/to/library/tests/Performance``` **Step # 3:** Build and run the tests: - - Windows ```dotnet msbuild /t:BuildAndTest /p:ConfigurationGroup=Release``` - - Linux: ```dotnet msbuild /t:BuildAndTest /p:ConfigurationGroup=Release``` - -**Note: Because test build runs tests concurrently, do not use it for executing performance tests. If you still want to run them concurrently you need to pass the flag `/p:Performance=true` to it: `build -test -release /p:Performance=true`.** + - Windows ```dotnet msbuild /t:BuildAndPerformanceTest /p:ConfigurationGroup=Release``` + - Linux: ```dotnet msbuild /t:BuildAndPerformanceTest /p:ConfigurationGroup=Release``` The results files will be dropped in corefx/artifacts/bin/tests/TESTLIBRARY/FLAVOR/. The console output will also specify the location of these files. +To build and run all tests from root, execute the following command: `build -performanceTest -buildtests -c Release`. + **Getting memory usage** To see memory usage as well as time, add the following property to the command lines above: `/p:CollectFlags=stopwatch+gcapi`. diff --git a/docs/libraries/project-docs/project-nuget-dependencies.md b/docs/libraries/project-docs/project-nuget-dependencies.md deleted file mode 100644 index a1e6640..0000000 --- a/docs/libraries/project-docs/project-nuget-dependencies.md +++ /dev/null @@ -1,4 +0,0 @@ -Project NuGet Dependencies -========================== - -Documentation moved to [Project NuGet Dependencies](https://github.com/dotnet/buildtools/blob/master/Documentation/project-nuget-dependencies.md). diff --git a/docs/libraries/project-docs/standard-platform.md b/docs/libraries/project-docs/standard-platform.md deleted file mode 100644 index ae62ec1..0000000 --- a/docs/libraries/project-docs/standard-platform.md +++ /dev/null @@ -1 +0,0 @@ -this document has moved to [net-platform-standard.md](../architecture/net-platform-standard.md) \ No newline at end of file diff --git a/docs/libraries/project-docs/writing-tests.md b/docs/libraries/project-docs/writing-tests.md index dcb036a..bf13550 100644 --- a/docs/libraries/project-docs/writing-tests.md +++ b/docs/libraries/project-docs/writing-tests.md @@ -54,13 +54,13 @@ public async Task Headers_SetAfterRequestSubmitted_ThrowsInvalidOperationExcepti } ``` -# Outerloop -This one is fairly simple but often used incorrectly. When running tests which depend on outside influences like e.g. Hardware (Internet, SerialPort, ...) and you can't mitigate these dependencies, you might consider using the `[Outerloop]` attribute for your test. +# OuterLoop +This one is fairly simple but often used incorrectly. When running tests which depend on outside influences like e.g. Hardware (Internet, SerialPort, ...) and you can't mitigate these dependencies, you might consider using the `[OuterLoop]` attribute for your test. With this attribute, tests are executed in a dedicated CI loop and won't break the default CI loops which get created when you submit a PR. -To run Outerloop tests locally you need to set the msbuild property "Outerloop" to true: `/p:Outerloop=true`. -To run Outerloop tests in CI you need to mention dotnet-bot and tell him which tests you want to run. See `@dotnet-bot help` for the exact loop names. +To run OuterLoop tests locally you need to set the msbuild property "OuterLoop" to true: `/p:OuterLoop=true`. +To run OuterLoop tests in CI you need to mention dotnet-bot and tell him which tests you want to run. See `@dotnet-bot help` for the exact loop names. -This doesn't mean that you should mark every test which executes against a remote endpoint as Outerloop. See below. +This doesn't mean that you should mark every test which executes against a remote endpoint as OuterLoop. See below. # Relay Server For network related tests which needs to contact a remote endpoint instead of a LoopbackServer, you can use our Relay Servers. We invest in Infrastructure to provide these "safe" remote endpoints. diff --git a/eng/pipelines/libraries/corefx-base.yml b/eng/pipelines/libraries/corefx-base.yml index fa13bf5..27ccef7 100644 --- a/eng/pipelines/libraries/corefx-base.yml +++ b/eng/pipelines/libraries/corefx-base.yml @@ -27,7 +27,7 @@ parameters: # _outerloop: true | false # Required: submitToHelix -> Boolean -> Value to know if it should submit tests payloads to helix. - + # Optional: buildScriptPrefix -> String -> string to append to Unix build script. # buildScriptPrefix: 'HOME=/home/ ' -> 'HOME=/home/ ./build.sh ...' @@ -41,7 +41,7 @@ parameters: # Optional: enableMicrobuild -> Boolean - if microbuild plugin for signing should be enabled # Default: false - + # Optional: preBuildSteps -> Array -> list of steps to be executed before common build steps. # In example, to install build dependencies, or setup an environment. # preBuildSteps: @@ -71,6 +71,8 @@ jobs: - name: ${{ pair.key }} value: ${{ pair.value }} + - _archiveTestsParameter: '' + - ${{ if eq(parameters.isOfficialBuild, 'true') }}: - _msbuildCommonParameters: /p:OfficialBuildId=$(Build.BuildNumber) - ${{ if eq(parameters.isOfficialBuild, 'false') }}: @@ -78,11 +80,12 @@ jobs: - ${{ if eq(job.submitToHelix, 'true') }}: - group: DotNet-HelixApi-Access + - _archiveTestsParameter: /p:ArchiveTests=Tests # Windows variables - ${{ if eq(parameters.targetOS, 'Windows_NT') }}: - _buildScript: build.cmd - - _commonArguments: -ci -includetests -configuration $(_BuildConfig) + - _commonArguments: -restore -build -configuration $(_BuildConfig) -ci -buildtests -arch $(_architecture) - _msbuildCommand: powershell -ExecutionPolicy ByPass -NoProfile eng\common\msbuild.ps1 -warnaserror:0 -ci - ${{ if eq(parameters.isOfficialBuild, 'true') }}: @@ -99,10 +102,10 @@ jobs: # Non-Windows variables - ${{ if ne(parameters.targetOS, 'Windows_NT') }}: - _buildScript: ${{ job.buildScriptPrefix }}./build.sh - - _args: --ci -includetests --configuration $(_BuildConfig) + - _args: --restore --build --configuration $(_BuildConfig) --ci --buildtests --arch $(_architecture) - _commonArguments: $(_args) - ${{ if eq(parameters.isOfficialBuild, 'true') }}: - - _commonArguments: $(_args) -stripSymbols + - _commonArguments: $(_args) --stripSymbols - _msbuildCommand: ${{ job.buildScriptPrefix }}./eng/common/msbuild.sh --warnaserror false --ci - _windowsOfficialBuildArguments: '' @@ -138,7 +141,7 @@ jobs: - ${{ job.preBuildSteps }} - ${{ if eq(job.customBuildSteps[0], '') }}: - + - ${{ if eq(parameters.isOfficialBuild, 'true') }}: - task: NuGetToolInstaller@0 inputs: @@ -158,12 +161,9 @@ jobs: - script: $(_buildScript) $(_commonArguments) - -framework $(_framework) - /p:ArchGroup=$(_architecture) - /p:ConfigurationGroup=$(_BuildConfig) - /p:SkipTests=$(_skipTests) - /p:Outerloop=$(_outerloop) - /p:ArchiveTests=${{ job.submitToHelix }} + -f $(_framework) + /p:OuterLoop=$(_outerloop) + $(_archiveTestsParameter) ${{ job.buildExtraArguments }} $(_msbuildCommonParameters) $(_windowsOfficialBuildArguments) @@ -201,7 +201,7 @@ jobs: helixToken: '' # TODO: Enable azure pipelines reporter for PRs once retry feature is available. enableAzurePipelinesReporter: false - + - ${{ if eq(parameters.isOfficialBuild, 'true') }}: - task: PublishBuildArtifacts@1 displayName: Publish packages to artifacts container diff --git a/eng/pipelines/libraries/helix.yml b/eng/pipelines/libraries/helix.yml index 8171d91..b6395d2 100644 --- a/eng/pipelines/libraries/helix.yml +++ b/eng/pipelines/libraries/helix.yml @@ -20,7 +20,7 @@ steps: /p:ArchGroup=${{ parameters.archGroup }} /p:ConfigurationGroup=${{ parameters.configuration }} /p:OSGroup=${{ parameters.targetOS }} - /p:Outerloop=${{ parameters.outerloop }} + /p:OuterLoop=${{ parameters.outerloop }} /p:TargetGroup=${{ parameters.framework }} /p:HelixTargetQueues=${{ parameters.helixQueues }} /p:HelixBuild=$(Build.BuildNumber) diff --git a/eng/pipelines/libraries/linux.yml b/eng/pipelines/libraries/linux.yml index 8aad8f6..251f936 100644 --- a/eng/pipelines/libraries/linux.yml +++ b/eng/pipelines/libraries/linux.yml @@ -36,7 +36,7 @@ jobs: _helixQueues: $(linuxArm64Queues) _dockerContainer: ubuntu_1604_arm64_cross_container _buildScriptPrefix: 'ROOTFS_DIR=/crossrootfs/arm64 ' - _buildExtraArguments: '' + _buildExtraArguments: --warnAsError false ${{ if eq(parameters.isOuterloopBuild, 'true') }}: x64_Debug: @@ -55,7 +55,7 @@ jobs: _helixQueues: $(linuxArm64Queues) _dockerContainer: ubuntu_1604_arm64_cross_container _buildScriptPrefix: 'ROOTFS_DIR=/crossrootfs/arm64 ' - _buildExtraArguments: '' + _buildExtraArguments: --warnAsError false ${{ if eq(parameters.isOfficialBuild, 'true') }}: musl_x64_Release: @@ -110,7 +110,7 @@ jobs: _BuildConfig: Release _architecture: arm _framework: netcoreapp - _buildExtraArguments: /p:RuntimeOS=ubuntu.16.04 + _buildExtraArguments: /p:RuntimeOS=ubuntu.16.04 --warnAsError false _buildScriptPrefix: 'ROOTFS_DIR=/crossrootfs/arm ' _dockerContainer: ubuntu_1604_arm_cross_container diff --git a/eng/pipelines/libraries/windows.yml b/eng/pipelines/libraries/windows.yml index f5f90b4..112365c 100644 --- a/eng/pipelines/libraries/windows.yml +++ b/eng/pipelines/libraries/windows.yml @@ -127,7 +127,7 @@ jobs: - netcoreappWindowsQueues: Windows.7.Amd64.Open+Windows.81.Amd64.Open+Windows.10.Amd64.ClientRS4.ES.Open - nanoQueues: Windows.10.Nano.Amd64.Open - uapNetfxQueues: Windows.10.Amd64.ClientRS5.Open - + - ${{ if eq(parameters.isOfficialBuild, 'true') }}: - netcoreappWindowsQueues: Windows.7.Amd64+Windows.81.Amd64+Windows.10.Amd64.Core+Windows.10.Amd64.ClientRS4 - nanoQueues: Windows.10.Nano.Amd64 @@ -177,30 +177,27 @@ jobs: customBuildSteps: - script: build.cmd + -restore + -build + -configuration $(_BuildConfig) -ci - -$(_framework) - /p:ArchGroup=$(_architecture) - /p:ConfigurationGroup=$(_BuildConfig) + -buildtests + -allconfigurations + -arch $(_architecture) /p:RuntimeOS=win10 + /p:ArchiveTests=Packages $(_windowsOfficialBuildArguments) $(_msbuildCommonParameters) - displayName: Build Packages - - script: build.cmd - -ci - -test - -$(_framework) - /p:ArchGroup=$(_architecture) - /p:ConfigurationGroup=$(_BuildConfig) - /p:ArchiveTests=true - displayName: Build test projects + displayName: Build Packages and Tests - ${{ if eq(parameters.isOfficialBuild, 'false') }}: - script: build.cmd + -restore + -build + -configuration $(_BuildConfig) -ci - -test - /p:TargetGroup=netstandard - /p:ArchGroup=$(_architecture) - /p:ConfigurationGroup=$(_BuildConfig) - /p:SkipTests=true + -buildtests + -framework netstandard + -arch $(_architecture) displayName: Build Netstandard Test Suite # TODO: UAPAOT official builds should send to helix using continuation runner. diff --git a/src/libraries/Common/tests/Scripts/Tools/ParallelTestExecution.ps1 b/src/libraries/Common/tests/Scripts/Tools/ParallelTestExecution.ps1 index de10882..63d60b0 100644 --- a/src/libraries/Common/tests/Scripts/Tools/ParallelTestExecution.ps1 +++ b/src/libraries/Common/tests/Scripts/Tools/ParallelTestExecution.ps1 @@ -14,7 +14,7 @@ function BuildAndTestBinary { - $output = (msbuild /t:rebuild,test /p:Outerloop=true) + $output = (msbuild /t:rebuild,test /p:OuterLoop=true) if ($lastexitcode -ne 0) { throw "Build/test failed." diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj b/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj index 8d454e1..5ff18ad 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj +++ b/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj @@ -1,4 +1,4 @@ - + CoreFx.Private.TestUtilities {EBDB0247-CA43-4226-B7A1-8FEF21061D09} @@ -17,6 +17,7 @@ + @@ -102,7 +103,6 @@ - diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformApis.Unix.cs b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformApis.Unix.cs new file mode 100644 index 0000000..c1cca99 --- /dev/null +++ b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformApis.Unix.cs @@ -0,0 +1,260 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Runtime.InteropServices; + +namespace System +{ + internal static class PlatformApis + { + private enum Platform + { + Unknown = 0, + Linux = 2, + Darwin = 3, + FreeBSD = 4 + } + + private static partial class NativeMethods + { + public static class Darwin + { + private const int CTL_KERN = 1; + private const int KERN_OSRELEASE = 2; + + public unsafe static string GetKernelRelease() + { + const uint BUFFER_LENGTH = 32; + + var name = stackalloc int[2]; + name[0] = CTL_KERN; + name[1] = KERN_OSRELEASE; + + var buf = stackalloc byte[(int)BUFFER_LENGTH]; + var len = stackalloc uint[1]; + *len = BUFFER_LENGTH; + + try + { + // If the buffer isn't big enough, it seems sysctl still returns 0 and just sets len to the + // necessary buffer size. This appears to be contrary to the man page, but it's easy to detect + // by simply checking len against the buffer length. + if (sysctl(name, 2, buf, len, IntPtr.Zero, 0) == 0 && *len < BUFFER_LENGTH) + { + return Marshal.PtrToStringAnsi((IntPtr)buf, (int)*len); + } + } + catch (Exception ex) + { + throw new PlatformNotSupportedException("Error reading Darwin Kernel Version", ex); + } + throw new PlatformNotSupportedException("Unknown error reading Darwin Kernel Version"); + } + + [DllImport("libc")] + private unsafe static extern int sysctl( + int* name, + uint namelen, + byte* oldp, + uint* oldlenp, + IntPtr newp, + uint newlen); + } + } + + private class DistroInfo + { + public string Id; + public string VersionId; + } + + private static readonly Lazy _platform = new Lazy(DetermineOSPlatform); + private static readonly Lazy _distroInfo = new Lazy(LoadDistroInfo); + + public static string GetOSName() + { + switch (GetOSPlatform()) + { + case Platform.Linux: + return GetDistroId() ?? "Linux"; + case Platform.Darwin: + return "Mac OS X"; + case Platform.FreeBSD: + return "FreeBSD"; + default: + return "Unknown"; + } + } + + public static string GetOSVersion() + { + switch (GetOSPlatform()) + { + case Platform.Linux: + return GetDistroVersionId() ?? string.Empty; + case Platform.Darwin: + return GetDarwinVersion() ?? string.Empty; + case Platform.FreeBSD: + return GetFreeBSDVersion() ?? string.Empty; + default: + return string.Empty; + } + } + + private static string GetDarwinVersion() + { + Version version; + var kernelRelease = NativeMethods.Darwin.GetKernelRelease(); + if (!Version.TryParse(kernelRelease, out version) || version.Major < 5) + { + // 10.0 covers all versions prior to Darwin 5 + // Similarly, if the version is not a valid version number, but we have still detected that it is Darwin, we just assume + // it is OS X 10.0 + return "10.0"; + } + else + { + // Mac OS X 10.1 mapped to Darwin 5.x, and the mapping continues that way + // So just subtract 4 from the Darwin version. + // https://en.wikipedia.org/wiki/Darwin_%28operating_system%29 + return $"10.{version.Major - 4}"; + } + } + + private static string GetFreeBSDVersion() + { + // This is same as sysctl kern.version + // FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC + // What we want is major release as minor releases should be compatible. + String version = RuntimeInformation.OSDescription; + try + { + // second token up to first dot + return RuntimeInformation.OSDescription.Split()[1].Split('.')[0]; + } + catch + { + } + return string.Empty; + } + + private static Platform GetOSPlatform() + { + return _platform.Value; + } + + private static string GetDistroId() + { + return _distroInfo.Value?.Id; + } + + private static string GetDistroVersionId() + { + return _distroInfo.Value?.VersionId; + } + + private static DistroInfo LoadDistroInfo() + { + DistroInfo result = null; + + // Sample os-release file: + // NAME="Ubuntu" + // VERSION = "14.04.3 LTS, Trusty Tahr" + // ID = ubuntu + // ID_LIKE = debian + // PRETTY_NAME = "Ubuntu 14.04.3 LTS" + // VERSION_ID = "14.04" + // HOME_URL = "http://www.ubuntu.com/" + // SUPPORT_URL = "http://help.ubuntu.com/" + // BUG_REPORT_URL = "http://bugs.launchpad.net/ubuntu/" + // We use ID and VERSION_ID + + if (File.Exists("/etc/os-release")) + { + var lines = File.ReadAllLines("/etc/os-release"); + result = new DistroInfo(); + foreach (var line in lines) + { + if (line.StartsWith("ID=", StringComparison.Ordinal)) + { + result.Id = line.Substring(3).Trim('"', '\''); + } + else if (line.StartsWith("VERSION_ID=", StringComparison.Ordinal)) + { + result.VersionId = line.Substring(11).Trim('"', '\''); + } + } + } + else if (File.Exists("/etc/redhat-release")) + { + var lines = File.ReadAllLines("/etc/redhat-release"); + + if (lines.Length >= 1) + { + string line = lines[0]; + if (line.StartsWith("Red Hat Enterprise Linux Server release 6.") || + line.StartsWith("CentOS release 6.")) + { + result = new DistroInfo(); + result.Id = "rhel"; + result.VersionId = "6"; + } + } + } + + if (result != null) + { + result = NormalizeDistroInfo(result); + } + + return result; + } + + // For some distros, we don't want to use the full version from VERSION_ID. One example is + // Red Hat Enterprise Linux, which includes a minor version in their VERSION_ID but minor + // versions are backwards compatable. + // + // In this case, we'll normalized RIDs like 'rhel.7.2' and 'rhel.7.3' to a generic + // 'rhel.7'. This brings RHEL in line with other distros like CentOS or Debian which + // don't put minor version numbers in their VERSION_ID fields because all minor versions + // are backwards compatible. + private static DistroInfo NormalizeDistroInfo(DistroInfo distroInfo) + { + // Handle if VersionId is null by just setting the index to -1. + int lastVersionNumberSeparatorIndex = distroInfo.VersionId?.IndexOf('.') ?? -1; + + if (lastVersionNumberSeparatorIndex != -1 && distroInfo.Id == "alpine") + { + // For Alpine, the version reported has three components, so we need to find the second version separator + lastVersionNumberSeparatorIndex = distroInfo.VersionId.IndexOf('.', lastVersionNumberSeparatorIndex + 1); + } + + if (lastVersionNumberSeparatorIndex != -1 && (distroInfo.Id == "rhel" || distroInfo.Id == "alpine")) + { + distroInfo.VersionId = distroInfo.VersionId.Substring(0, lastVersionNumberSeparatorIndex); + } + + return distroInfo; + } + + private static Platform DetermineOSPlatform() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return Platform.Linux; + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return Platform.Darwin; + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) + { + return Platform.FreeBSD; + } + + return Platform.Unknown; + } + } +} diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs index f6c195a..e36befb 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs +++ b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs @@ -87,7 +87,7 @@ namespace System return nativeLib != IntPtr.Zero; } - public static Version OSXVersion { get; } = ToVersion(Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion); + public static Version OSXVersion { get; } = ToVersion(PlatformApis.GetOSVersion()); public static Version OpenSslVersion => !RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? GetOpenSslVersion() : throw new PlatformNotSupportedException(); @@ -98,9 +98,9 @@ namespace System return "OSX Version=" + s_osxProductVersion.ToString(); } - DistroInfo v = GetDistroInfo(); + var (name, version) = GetDistroInfo(); - return "Distro=" + v.Id + " VersionId=" + v.VersionId; + return "Distro=" + name + " VersionId=" + version; } /// @@ -168,11 +168,8 @@ namespace System return new Version(int.Parse(versionString), 0); } - private static DistroInfo GetDistroInfo() => new DistroInfo() - { - Id = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem, - VersionId = ToVersion(Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion) - }; + private static (string name, Version version) GetDistroInfo() => + (PlatformApis.GetOSName(), ToVersion(PlatformApis.GetOSVersion())); private static bool IsRedHatFamilyAndVersion(int major = -1, int minor = -1, int build = -1, int revision = -1) { @@ -211,8 +208,8 @@ namespace System { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - DistroInfo v = GetDistroInfo(); - if (distroPredicate(v.Id) && VersionEquivalentTo(major, minor, build, revision, v.VersionId)) + var (name, version) = GetDistroInfo(); + if (distroPredicate(name) && VersionEquivalentTo(major, minor, build, revision, version)) { return true; } @@ -225,8 +222,8 @@ namespace System { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - DistroInfo v = GetDistroInfo(); - if (distroPredicate(v.Id) && VersionEquivalentToOrHigher(major, minor, build, revision, v.VersionId)) + var (name, version) = GetDistroInfo(); + if (distroPredicate(name) && VersionEquivalentToOrHigher(major, minor, build, revision, version)) { return true; } @@ -344,11 +341,5 @@ namespace System private static extern int GlobalizationNative_GetICUVersion(); public static bool IsSuperUser => geteuid() == 0; - - private struct DistroInfo - { - public string Id { get; set; } - public Version VersionId { get; set; } - } } } diff --git a/src/libraries/Native/build-native.proj b/src/libraries/Native/build-native.proj index 0250956..0fff349 100644 --- a/src/libraries/Native/build-native.proj +++ b/src/libraries/Native/build-native.proj @@ -6,6 +6,9 @@ + + $(ArtifactsObjDir)_version.h + $(ArtifactsObjDir)_version.c <_BuildNativeArgs>$(ArchGroup) $(ConfigurationGroup) $(OSGroup) outconfig $(Configuration) diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj index d8bd3a8..fc788ad 100644 --- a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj +++ b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj @@ -42,8 +42,7 @@ System.Diagnostics.FileVersionInfo.TestAssembly - - - - + + + diff --git a/src/libraries/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj b/src/libraries/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj index ffeca22..6d78547 100644 --- a/src/libraries/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj +++ b/src/libraries/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj @@ -14,7 +14,11 @@ PreserveNewest - - + + + + + + \ No newline at end of file diff --git a/src/libraries/build.proj b/src/libraries/build.proj index 01c08f7..6445761 100644 --- a/src/libraries/build.proj +++ b/src/libraries/build.proj @@ -5,16 +5,12 @@ - true true true - false true - $(BuildDependsOn);Restore $(BuildDependsOn);BuildNative $(BuildDependsOn);BuildManaged - $(BuildDependsOn);Test $(BuildDependsOn);Pack @@ -58,12 +54,44 @@ + + + <_TestProjects Include="src\tests.builds" /> + + + + + <_TestProjects Include="src\tests.builds" /> - + + + + + + <_TestProjects Include="src\tests.builds" /> + + + + + + + + <_TestProjects Include="src\tests.builds" /> + + + diff --git a/src/libraries/dir.traversal.targets b/src/libraries/dir.traversal.targets index 1b8c4b0..9d3fb2b 100644 --- a/src/libraries/dir.traversal.targets +++ b/src/libraries/dir.traversal.targets @@ -1,6 +1,6 @@ - - + + + DependsOnTargets="$(TestAllProjectsDependsOn)"> + + + IntegrationTest + PerformanceTest + Test + - - + + + BuildAllProjects; + $(TestAllProjectsDependsOn); + diff --git a/src/libraries/external/test-runtime/XUnit.Runtime.depproj b/src/libraries/external/test-runtime/XUnit.Runtime.depproj index 53d56c3..c0051e0 100644 --- a/src/libraries/external/test-runtime/XUnit.Runtime.depproj +++ b/src/libraries/external/test-runtime/XUnit.Runtime.depproj @@ -40,7 +40,6 @@ - @@ -62,7 +61,6 @@ - @@ -124,7 +122,7 @@ - + @@ -138,13 +136,12 @@ AfterTargets="AfterResolveReferences"> - $(PackagesDir)$(MicrosoftDotNetUapTestToolsPackageName)\$(MicrosoftDotNetUapTestToolsPackageVersion)\Tools\$(ArchGroup) $(UAPToolsFolder.Replace('/', '\')) - + @@ -182,8 +179,6 @@ $(PackagesDir)$(TestILCToolsPackageName)\$(ProjectNTfsTestILCPackageVersion)\TestILC - - diff --git a/src/libraries/pkg/test/testPackages.proj b/src/libraries/pkg/test/testPackages.proj index 5e14f2b..998694f 100644 --- a/src/libraries/pkg/test/testPackages.proj +++ b/src/libraries/pkg/test/testPackages.proj @@ -162,7 +162,7 @@ + Condition="'$(ArchiveTests.ToLower())' == 'packages' or '$(ArchiveTests.ToLower())' == 'all'"> + Condition="'$(ArchiveTests.ToLower())' != 'packages' and '$(ArchiveTests.ToLower())' != 'all'"> $(TestDotNetPath) @@ -197,7 +197,7 @@ + Condition="'$(ArchiveTests.ToLower())' != 'packages' and '$(ArchiveTests.ToLower())' != 'all'"> $(TestDotNetPath) diff --git a/src/libraries/tests.builds b/src/libraries/tests.builds index af0b67d..41e85d0 100644 --- a/src/libraries/tests.builds +++ b/src/libraries/tests.builds @@ -1,60 +1,58 @@ - - + + - true + true true true $(TestWorkingDir)**/coverage.xml $(ArtifactsDir)coverage + + true + MakeCommonResourcesPriFile;$(TraversalBuildDependsOn) - + - - - true - - - - - - - - <_ProjectPattern Condition="'$(Performance)' != 'true'">Tests - <_ProjectPattern Condition="'$(Performance)' == 'true'">PerformanceTests + Tests + IntegrationTests + PerformanceTests + + <_TestProjectFilter Condition="'$(TestProjectFilter)' != ''">.$(TestProjectFilter) + + <_TestProjectFilter Condition="'$(TestProjectFilter)' == '' or '$(BuildAllTests)' == 'true'">Tests - - + + - + + + + - - - MakeCommonResourcesPriFile; - $(TraversalBuildDependsOn) - - +