Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updating test results files in travis.
  • Loading branch information
kalgiz committed Feb 14, 2018
commit a2db0896fbb7d40111bf49a7603cdbb12cede684
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ addons:
artifacts:
paths:
- $(ls powershell*{deb,pkg,AppImage,gz} | tr "\n" ":")
- pester-tests.xml
- ./tools/TestResultsSudo.xml
- ./tools/TestResultsNoSudo.xml

install:
# Default 2.0.0 Ruby is buggy
Expand Down
11 changes: 8 additions & 3 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,16 @@ elseif($Stage -eq 'Build')
$ProgressPreference = $originalProgressPreference
}

$testResultsNoSudo = "$pwd\TestResultsNoSudo.xml"
$testResultsSudo = "$pwd\TestResultsSudo.xml"

$pesterParam = @{
'binDir' = $output
'PassThru' = $true
'Terse' = $true
'Tag' = @()
'ExcludeTag' = @('RequireSudoOnUnix')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to specify two different values for '-OutputFile' and update https://github.com/PowerShell/PowerShell/blob/master/.travis.yml#L19 to upload both files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to store the test results in output files as in ./tools/appveyor.psm1? Currently they are stored in variables ($pesterPassThruNoSudoObject, $pesterPassThruNSudoObject) and there was no -OutputFile specified for Start-PSPester cmdlet in travis.ps1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutputFile has a default. travis.yml is assuming the default

'OutputFile' = $testResultsNoSudo
}

if ($isFullBuild) {
Expand All @@ -228,18 +232,19 @@ elseif($Stage -eq 'Build')
}

# Running tests which do not require sudo.
$pesterPassThruNoSudoObject = Start-PSPester @pesterParam
Start-PSPester @pesterParam

# Running tests, which require sudo.
pesterParam['Tag'] = @('RequireSudoOnUnix')
pesterParam['ExcludeTag'] = @()
pesterParam['Sudo'] = $true
$pesterPassThruSudoObject = Start-PSPester @pesterParam
pesterParam['OutputFile'] = $testResultsSudo
Start-PSPester @pesterParam

# Determine whether the build passed
try {
# this throws if there was an error
@($pesterPassThruNoSudoObject, $pesterPassThruSudoObject) | ForEach-Object { Test-PSPesterResults -ResultObject $_ }
@($testResultsNoSudo, $testResultsSudo) | ForEach-Object { Test-PSPesterResults -TestResultsFile $_ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't change to the files, use the result objects. The files can cause be partial, and cause bugs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I should just keep the code as it was before with pesterPassThru objects, but just add the output files?

$result = "PASS"
}
catch {
Expand Down