From commits-return-6351-archive-asf-public=cust-asf.ponee.io@lucenenet.apache.org Sat Jul 13 17:52:08 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id B97B818025F for ; Sat, 13 Jul 2019 19:52:07 +0200 (CEST) Received: (qmail 55119 invoked by uid 500); 13 Jul 2019 17:52:03 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 54790 invoked by uid 99); 13 Jul 2019 17:52:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jul 2019 17:52:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 2E60A85E1D; Sat, 13 Jul 2019 17:52:02 +0000 (UTC) Date: Sat, 13 Jul 2019 17:52:08 +0000 To: "commits@lucenenet.apache.org" Subject: [lucenenet] 06/07: build.ps1: Added function to summarize the test results on the console MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: nightowl888@apache.org In-Reply-To: <156304032273.1757.13505879194044219406@gitbox.apache.org> References: <156304032273.1757.13505879194044219406@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: lucenenet X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: ca726f6a7b56a1a8e30fd16ccc30e46affb7dbf9 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190713175203.2E60A85E1D@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git commit ca726f6a7b56a1a8e30fd16ccc30e46affb7dbf9 Author: Shad Storhaug AuthorDate: Sat Jul 13 14:54:40 2019 +0700 build.ps1: Added function to summarize the test results on the console --- build/build.ps1 | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/build/build.ps1 b/build/build.ps1 index f68aaeb..8b1b652 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -236,6 +236,8 @@ task Test -depends InstallSDK, UpdateLocalSDKVersion, Restore -description "This } } } + + Summarize-Test-Results } function Get-Package-Version() { @@ -424,6 +426,116 @@ endlocal [System.IO.File]::WriteAllLines($file, $buildBat, $Utf8EncodingNoBom) } +function New-CountersObject ([string]$project, [string]$outcome, [int]$total, [int]$executed, [int]$passed, [int]$failed, [int]$warning, [int]$inconclusive) { + $counters = New-Object -TypeName PSObject + $fields = [ordered]@{Project=$project;Outcome=$outcome;Total=$total;Executed=$executed;Passed=$passed;Failed=$failed;Warning=$warning;Inconclusive=$inconclusive} + $counters | Add-Member -NotePropertyMembers $fields -TypeName Counters + return $counters +} + +function Summarize-Test-Results() { + Write-Host "frameworks_to_test: $frameworks_to_test" -ForegroundColor Gray + $frameworksToTest = $frameworks_to_test -split "\s*?,\s*?" + + foreach ($framework in $frameworksToTest) { + pushd $base_directory + $testReports = Get-ChildItem -Path "$test_results_directory/$framework" -Recurse -File -Filter "*.trx" | ForEach-Object { + $_.FullName + } + popd + + [int]$totalCountForFramework = 0 + [int]$executedCountForFramework = 0 + [int]$passedCountForFramework = 0 + [int]$failedCountForFramework = 0 + [int]$warningCountForFramework = 0 + [int]$inconclusiveCountForFramework = 0 + [string]$outcomeForFramework = 'Completed' + + # HEADER FOR FRAMEWORK + + Write-Host "" + Write-Host "" + Write-Host "************************************************************************************************************" -ForegroundColor Yellow + Write-Host "* *" -ForegroundColor Yellow + Write-Host "* Test Summary For $framework" -ForegroundColor Yellow + Write-Host "* *" -ForegroundColor Yellow + Write-Host "************************************************************************************************************" -ForegroundColor Yellow + + foreach ($testReport in $testReports) { + $testName = [System.IO.Path]::GetFileName([System.IO.Path]::GetDirectoryName($testReport)) + $reader = [System.Xml.XmlReader]::Create($testReport) + try { + while ($reader.Read()) { + + if ($reader.NodeType -eq [System.Xml.XmlNodeType]::Element -and $reader.Name -eq 'ResultSummary') { + $outcome = $reader.GetAttribute('outcome') + if ($outcomeForFramework -eq 'Completed') { + $outcomeForFramework = $outcome + } + } + if ($reader.NodeType -eq [System.Xml.XmlNodeType]::Element -and $reader.Name -eq 'Counters') { + $counters = New-CountersObject ` + -Project $testName ` + -Outcome $outcome ` + -Total $reader.GetAttribute('total') ` + -Executed $reader.GetAttribute('executed') ` + -Passed $reader.GetAttribute('passed') ` + -Failed $reader.GetAttribute('failed') ` + -Warning $reader.GetAttribute('warning') ` + -Inconclusive $reader.GetAttribute('inconclusive') + + $totalCountForFramework += $counters.Total + $executedCountForFramework += $counters.Executed + $passedCountForFramework += $counters.Passed + $failedCountForFramework += $counters.Failed + $warningCountForFramework += $counters.Warning + $inconclusiveCountForFramework += $counters.Inconclusive + $skippedCountForFramework += $counters.Skipped + + $format = @{Expression={$_.Project};Label='Project';Width=35}, + @{Expression={$_.Outcome};Label='Outcome';Width=9}, + @{Expression={$_.Total};Label='Total';Width=8}, + @{Expression={$_.Executed};Label='Executed';Width=10}, + @{Expression={$_.Passed};Label='Passed';Width=8}, + @{Expression={$_.Failed};Label='Failed';Width=8}, + @{Expression={$_.Warning};Label='Warning';Width=9}, + @{Expression={$_.Inconclusive};Label='Inconclusive';Width=14} + + $Counters | Format-Table $format + } + } + + } finally { + $reader.Dispose() + } + + } + + # FOOTER FOR FRAMEWORK + + Write-Host "************************************************************************************************************" -ForegroundColor Magenta + Write-Host "* *" -ForegroundColor Magenta + Write-Host "* Totals For $framework" -ForegroundColor Magenta + Write-Host "* *" -ForegroundColor Magenta + Write-Host "************************************************************************************************************" -ForegroundColor Magenta + Write-Host "" + $foreground = if ($outcomeForFramework -eq 'Failed') { 'Red' } else { 'Green' } + Write-Host "Result: " -NoNewline; Write-Host "$outcomeForFramework" -ForegroundColor $foreground + Write-Host "" + Write-Host "Total: $totalCountForFramework" + Write-Host "Executed: $executedCountForFramework" + $foreground = if ($failedCountForFramework -gt 0) { 'Green' } else { (Get-Host).UI.RawUI.ForegroundColor } + Write-Host "Passed: " -NoNewline; Write-Host "$passedCountForFramework" -ForegroundColor $foreground + $foreground = if ($failedCountForFramework -gt 0) { 'Red' } else { (Get-Host).UI.RawUI.ForegroundColor } + Write-Host "Failed: " -NoNewline; Write-Host "$failedCountForFramework" -ForegroundColor $foreground + $foreground = if ($failedCountForFramework -gt 0) { 'Yellow' } else { (Get-Host).UI.RawUI.ForegroundColor } + Write-Host "Warning: " -NoNewline; Write-Host "$warningCountForFramework" -ForegroundColor $foreground + $foreground = if ($failedCountForFramework -gt 0) { 'Cyan' } else { (Get-Host).UI.RawUI.ForegroundColor } + Write-Host "Inconclusive: " -NoNewline; Write-Host "$inconclusiveCountForFramework" -ForegroundColor $foreground + } +} + function Backup-Files([string[]]$paths) { foreach ($path in $paths) { Backup-File $path