-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Struan Judd
committed
Jan 4, 2024
1 parent
72f6c9e
commit 10a9470
Showing
6 changed files
with
157 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -487,4 +487,6 @@ _site/ | |
_exported_templates/ | ||
|
||
test/**/*.received.* | ||
test/**/activities.yml | ||
activities.yml | ||
per-class | ||
runs-*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Install-Module -Name powershell-yaml | ||
|
||
$runs = @{} | ||
|
||
$files = Get-ChildItem .\per-class -Filter "*.yml" | ||
|
||
$count = 0 | ||
$total = $files.Count | ||
|
||
$files | ForEach-Object { | ||
$run = $_.BaseName | ||
|
||
$count += 1 | ||
$perc = $count * 100 / $total | ||
Write-Progress "Combine" $run -PercentComplete $perc | ||
|
||
$_ | Get-Content | ConvertFrom-Yaml | ` | ||
ForEach-Object { | ||
$_ | ForEach-Object { | ||
if ($_.filename -match "\\test\\") { | ||
return | ||
} | ||
$class = $_.name | ||
if ($runs.Keys -notcontains $class ) { | ||
$runs[$class] = @{filename=$_.filename;allLines=$_.allLines;runs=@{}} | ||
} | ||
$runs[$class].runs[$run] = $_.lines.ToString() | ||
} | ||
} | ||
} | ||
|
||
Write-Progress "Combine" -Completed | ||
|
||
$runs | ConvertTo-Yaml -Options DisableAliases | Set-Content "runs-all.yml" | ||
|
||
$singles = $runs.Keys | Where-Object { $runs[$_].runs.Count -lt 2 } | ||
|
||
foreach ($class in $singles) { | ||
$runs.Remove($class) | ||
} | ||
|
||
$runs | ConvertTo-Yaml -Options DisableAliases | Set-Content "runs-many.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Install-Module -Name powershell-yaml | ||
|
||
dotnet tool restore | ||
dotnet build --disable-build-servers | ||
|
||
New-Item per-class -ItemType Directory -ErrorAction Ignore | Out-Null | ||
|
||
Push-Location .\test\GqlPlus.Verifier.ClassTests | ||
|
||
$base = "-s","coverage.runsettings","-f","cobertura","-o" | ||
$dotnet = "--","dotnet","test","--no-build","--verbosity","quiet","--disable-build-servers","--filter" | ||
|
||
try { | ||
$classes = dotnet test --list-tests --no-build | ` | ||
Select-String " GqlPlus.Verifier" -Raw | ` | ||
ForEach-Object { | ||
($_ -split '\.')[-2] | ||
} | ` | ||
Select-Object -Unique | ||
|
||
$allLinesField = @{L="allLines";E={ ($_.lines.line | | ||
Select-Object -ExpandProperty number | ||
) -join " " | ||
}} | ||
|
||
$linesField = @{L="lines";E={ ($_.lines.line | | ||
Where-Object hits -ne 0 | | ||
Select-Object -ExpandProperty number | ||
) -join " " | ||
}} | ||
|
||
$count = 0 | ||
$total = $classes.Count | ||
|
||
foreach ($run in $classes) { | ||
$count += 1 | ||
$perc = $count * 100 / $total | ||
Write-Progress "Test run" $run -PercentComplete $perc | ||
|
||
$xmlFile = "../../per-class/$run.xml" | ||
$params = $base + @($xmlFile,"-id",$run) + $dotnet + @(".$run.") | ||
dotnet coverage collect @params | Out-Null | ||
|
||
$runField = @{L="run";E={$run}} | ||
|
||
[xml]$xml = Get-Content $xmlFile | ||
$xmlClasses = $xml.coverage.packages | ` | ||
ForEach-Object { $_.package.classes } | ` | ||
Select-Object -ExpandProperty class | ` | ||
Where-Object line-rate -ne 0 | ` | ||
Select-Object $runField,name,filename,line-rate,$linesField,$allLinesField | ||
|
||
$ymlFile = "../../per-class/$run.yml" | ||
$xmlClasses | ConvertTo-Yaml -Options DisableAliases | Set-Content $ymlFile | ||
} | ||
} | ||
finally { | ||
Pop-Location | ||
} | ||
|
||
Write-Progress "Test run" -Completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<RunSettings> | ||
<DataCollectionRunSettings> | ||
<DataCollectors> | ||
<DataCollector friendlyName="Code Coverage" | ||
uri="datacollector://Microsoft/CodeCoverage/2.0" | ||
assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
<Configuration> | ||
<CodeCoverage> | ||
<ModulePaths> | ||
<Include> | ||
<ModulePath>.*\\GqlPlus\.Verifier\.dll$</ModulePath> | ||
</Include> | ||
</ModulePaths> | ||
|
||
<!-- Match attributes on any code element: --> | ||
<Attributes> | ||
<Exclude> | ||
<!-- Don't forget "Attribute" at the end of the name --> | ||
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute> | ||
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute> | ||
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute> | ||
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute> | ||
</Exclude> | ||
</Attributes> | ||
|
||
<!-- We recommend you do not change the following values: --> | ||
|
||
<!-- Set this to True to collect coverage information for functions marked with the "SecuritySafeCritical" attribute. Instead of writing directly into a memory location from such functions, code coverage inserts a probe that redirects to another function, which in turns writes into memory. --> | ||
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation> | ||
<!-- When set to True, collects coverage information from child processes that are launched with low-level ACLs, for example, UWP apps. --> | ||
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses> | ||
<!-- When set to True, collects coverage information from child processes that are launched by test or production code. --> | ||
<CollectFromChildProcesses>True</CollectFromChildProcesses> | ||
<!-- When set to True, restarts the IIS process and collects coverage information from it. --> | ||
<CollectAspDotNet>False</CollectAspDotNet> | ||
<!-- When set to True, static native instrumentation will be enabled. --> | ||
<EnableStaticNativeInstrumentation>True</EnableStaticNativeInstrumentation> | ||
<!-- When set to True, dynamic native instrumentation will be enabled. --> | ||
<EnableDynamicNativeInstrumentation>True</EnableDynamicNativeInstrumentation> | ||
<!-- When set to True, instrumented binaries on disk are removed and original files are restored. --> | ||
<EnableStaticNativeInstrumentationRestore>True</EnableStaticNativeInstrumentationRestore> | ||
|
||
</CodeCoverage> | ||
</Configuration> | ||
</DataCollector> | ||
</DataCollectors> | ||
</DataCollectionRunSettings> | ||
</RunSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters