Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2017-02-07 22:00:34 +0300
committerStephen Toub <stoub@microsoft.com>2017-02-07 22:00:34 +0300
commit548b8d575a2efb9a3ddb2febfd765ee941a71a27 (patch)
tree890149a37dfbf4ad366f9ab79bd0467306bcbe27
parentcfed28ccb666fdf99cf45600f03c826c133f6567 (diff)
Update code coverage docs
-rw-r--r--Documentation/building/code-coverage.md26
-rw-r--r--Documentation/building/facade-code-coverage.bat82
2 files changed, 8 insertions, 100 deletions
diff --git a/Documentation/building/code-coverage.md b/Documentation/building/code-coverage.md
index 403cd8b922..2b19d0f635 100644
--- a/Documentation/building/code-coverage.md
+++ b/Documentation/building/code-coverage.md
@@ -38,6 +38,7 @@ After it's done the report can be found in the build log, it looks like eg
`https://ci.dot.net/job/dotnet_corefx/job/master/job/code_coverage_windows_prtest/16/artifact/bin/tests/coverage`
then add index.htm on the end:
`https://ci.dot.net/job/dotnet_corefx/job/master/job/code_coverage_windows_prtest/16/artifact/bin/tests/coverage/index.htm`
+You can navigate to this from your PR by clicking the "Details" link to the right of the code coverage job listed at the bottom of the PR after having issued the above request to dotnet-bot. In the Jenkins UI for the resulting build, click the "Build Artifacts" link and navigate through the resulting hierarchy to the index.htm file.
## Local Code Coverage Runs
@@ -59,11 +60,11 @@ You can also build and test with code coverage for a particular test project rat
msbuild /t:BuildAndTest
-To do so with code coverage, as with ```build``` append the ```/p:Coverage=true``` argument:
+To do so with code coverage, append the ```/p:Coverage=true``` argument:
msbuild /t:BuildAndTest /p:Coverage=true
-The results for this one library will then also show up in the aforementioned index.htm file. For example, to build, test, and get code coverage results for the System.Diagnostics.Debug library, from the root of my repo I can do:
+The results for this one library will then show up in the aforementioned index.htm file. For example, to build, test, and get code coverage results for the System.Diagnostics.Debug library, from the root of the repo one can do:
cd src\System.Diagnostics.Debug\tests\
msbuild /t:BuildAndTest /p:Coverage=true
@@ -72,22 +73,11 @@ And then once the run completes:
..\..\..\bin\tests\coverage\index.htm
-## Code coverage with mscorlib code
+## Code coverage with System.Private.CoreLib code
-Some of the libraries for which contracts and tests live in the corefx repo are actually implemented in the core runtime library in another repo, e.g. the implementation that backs the System.Runtime contract is in System.Private.Corlib.dll in either the coreclr or corert repo. To run coverage reports for these projects, you need to build mscorlib locally from the coreclr repo.
+Some of the libraries for which contracts and tests live in the corefx repo are actually fully or partially implemented in the core runtime library in another repo, e.g. the implementation that backs the System.Runtime contract is in System.Private.CoreLib.dll in either the coreclr or corert repo. To run coverage reports for these projects, you need to build System.Private.CoreLib locally from the coreclr repo. To get coverage of System.Private.CoreLib while running the tests for a particular library:
-The following steps can be used manually to produce a coverage report, but a customizable batch file can be found [here](facade-code-coverage.bat). Changing the parameters in the first couple of lines lets you run a coverage report easily for any facade project.
+1. Follow the steps outlined at [Testing with Private CoreClr Bits](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md#testing-with-private-coreclr-bits). Make sure to include the optional steps listed as being required for code coverage.
+2. Add /p:CodeCoverageAssemblies="System.Private.CoreLib" to the previously discussed msbuild command, e.g. msbuild /t:BuildAndTest /p:Coverage=true /p:CodeCoverageAssemblies="System.Private.CoreLib"
-1. Build the local test project (`msbuild /T:Build`)
-3. Build coreclr locally in Debug or Release (`build.cmd all Debug skiptests`)
-2. Navigate to the built test directory in the corefx bin (e.g. `bin/tests/AnyOS.AnyCPU.Debug/System.Runtime/netcoreapp1.0` for `System.Runtime`
-4. Delete `coreclr.dll`, `mscorlib.dll`, `mscorlib.ni.dll`, `System.Private.CoreLib.dll` and `System.Private.CoreLib.ni.dll` from that directory
-5. Copy all files in the coreclr `bin` directory to the test directory
-6. Copy all files in the coreclr `bin/PDB` directory to the test directory
-7. Run an OpenCover command with `xunit.console.netcore.exe`. For example:
-
- <corefx-root>/packages/OpenCover/<opencover-version>/tools/OpenCover.Console.exe -oldStyle -filter:"+[*]* -[*.Tests]* -[xunit.*]*" -excludebyfile:"*\Common\src\System\SR.*" -nodefaultfilters -excludebyattribute:*.ExcludeFromCodeCoverage* -skipautoprops -hideskipped:All -threshold:1 -returntargetcode -register:user -targetdir:<path-to corefx-bin> -target:CoreRun.exe -output:coverage.xml -targetargs:"xunit.console.netcore.exe System.Runtime.Tests -xml testResults.xml -notrait Benchmark=true -notrait category=OuterLoop -notrait category=failing -notrait category=nonwindowstests"
-
-8. Run a ReportGenerator command with the generated `coverage.xml` file. For example:
-
- <corefx-root>/packages/ReportGenerator/<opencover-version>/tools/ReportGenerator.exe -reporttypes:Html;Badges -reports:coverage.xml
+The resulting code coverage report should now also include details for System.Private.CoreLib.
diff --git a/Documentation/building/facade-code-coverage.bat b/Documentation/building/facade-code-coverage.bat
deleted file mode 100644
index ef38876b5c..0000000000
--- a/Documentation/building/facade-code-coverage.bat
+++ /dev/null
@@ -1,82 +0,0 @@
-@echo off
-:: Example settings for System.Runtime
-SET project=System.Runtime
-SET msbuildargs=/T:Build
-SET testsubdir=AnyOS.AnyCPU.Debug
-SET filter="+[*]* -[*.Tests]* -[*]System.Collections.* -[*]System.Diagnostics.* -[*]System.Globalization.* -[*]System.IO.* -[*]System.Reflection.* -[*]System.Resources.* -[*]System.Runtime.* -[*]System.Security.* -[*]System.StubHelpers.* -[*]System.Threading.* -[*]Microsoft.* -[*]Windows.* -[*]System.App* -[*]System.Text.Decoder* -[*]System.Text.Encoder* -[*]System.Text.*Encoding -[*]System.Text.Internal* -[xunit.*]*"
-
-:: Update this when OpenCover or ReportGenerator are updated
-SET opencoverversion=4.6.519
-SET reportgeneratorversion=2.4.3
-
-:: Assumes that the corefx and coreclr repo folders are in the same parent folder
-SET root=C:\Users\Hugh\Documents\Github
-
-SET corefx=%root%\corefx
-SET coreclr=%root%\coreclr
-
-SET packages=%corefx%\packages
-SET opencover=%packages%\OpenCover\%opencoverversion%\tools\OpenCover.Console.exe
-SET reportgenerator=%packages%\ReportGenerator\%reportgeneratorversion%\tools\ReportGenerator.exe
-
-SET targetdir=%corefx%\bin\tests\%testsubdir%\%project%.Tests\netcoreapp1.0
-
-SET resultsfile=testresults.xml
-SET coveragefile=coverage.xml
-
-SET coveragedir=coverage
-
-SET originalfolder=%cd%
-SET sourcefolder=%corefx%\src\%project%\tests
-
-SET coreclrbuild=%coreclr%\bin\Product\Windows_NT.x64.Debug
-SET coreclrbuild=%coreclr%\bin\Product\Windows_NT.x64.Release
-
-:: Build the library
-cd %sourcefolder%
-msbuild %msbuildargs%
-cd %originalfolder%
-
-:: Delete old files (see #8381 for why)
-del %targetdir%\mscorlib.dll
-del %targetdir%\mscorlib.ni.dll
-del %targetdir%\System.Private.CoreLib.dll
-del %targetdir%\System.Private.CoreLib.ni.dll
-del %targetdir%\coreclr.dll
-del %targetdir%\CoreRun.exe
-del %targetdir%\CoreConsole.exe
-del %targetdir%\clretwrc.dll
-del %targetdir%\clrjit.dll
-del %targetdir%\dbgshim.dll
-del %targetdir%\mscordaccore.dll
-del %targetdir%\mscordbi.dll
-del %targetdir%\mscorrc.debug.dll
-del %targetdir%\mscorrc.dll
-del %targetdir%\sos.dll
-
-:: Copy over our local build files
-For %%a in (
-%coreclrbuild%\mscorlib.dll
-%coreclrbuild%\PDB\mscorlib.pdb
-%coreclrbuild%\System.Private.CoreLib.dll
-%coreclrbuild%\PDB\System.Private.CoreLib.pdb
-%coreclrbuild%\coreclr.dll
-%coreclrbuild%\PDB\coreclr.pdb
-%coreclrbuild%\CoreRun.exe
-%coreclrbuild%\CoreConsole.exe
-%coreclrbuild%\clretwrc.dll
-%coreclrbuild%\clrjit.dll
-%coreclrbuild%\dbgshim.dll
-%coreclrbuild%\mscordaccore.dll
-%coreclrbuild%\mscordbi.dll
-%coreclrbuild%\mscorrc.debug.dll
-%coreclrbuild%\mscorrc.dll
-%coreclrbuild%\sos.dll
-) do copy /b/v/y "%%~a" "%targetdir%\"
-
-:: Now, run the actual tests and generate a coverage report
-SET corerunargs=%targetdir%\xunit.console.netcore.exe %project%.Tests.dll -xml %resultsfile% -notrait category=OuterLoop -notrait category=failing -notrait category=nonwindowstests
-
-%opencover% -oldStyle -filter:%filter% -excludebyfile:"*\Common\src\System\SR.*" -nodefaultfilters -excludebyattribute:*.ExcludeFromCodeCoverage* -skipautoprops -hideskipped:All -threshold:1 -returntargetcode -register:user -targetdir:%targetdir% -target:CoreRun.exe -output:%coveragefile% -targetargs:"%corerunargs%"
-
-%reportgenerator% -targetdir:%coveragedir% -reporttypes:Html;Badges -reports:%coveragefile% -verbosity:Error \ No newline at end of file