-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Support running tests in root privilege on Linux. #6145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
13848a5
Adding Sudo parameter to Start-PSPester function.
kalgiz ee7227d
Running tests, which require sudo on Linux.
kalgiz 466c8c7
Running tests on Linux which require Sudo.
kalgiz 31fe5f1
Merge branch 'master' of https://github.com/kalgiz/PowerShell into i5645
kalgiz 07ae3f7
Assigning parameter in the same Parameter Set as PassThru in Start-P…
kalgiz 65b85d3
Correcting tag issues for tests run with sudo on Unix.
kalgiz e53399e
Merge branch 'master' of https://github.com/kalgiz/PowerShell into i5645
kalgiz 42113a7
Correcting cmdlet in travis.ps1 file.
kalgiz e43ddfa
Correcting cmdlet in travis.ps1 file.
kalgiz 0a7bdbb
Style corrections in build.ps1
kalgiz 2130477
Merge branch 'master' of https://github.com/kalgiz/PowerShell into i5645
kalgiz 573d91b
Deleting stale comment.
kalgiz a2db089
Updating test results files in travis.
kalgiz 08736e3
Correcting paths to test results.
kalgiz b328b62
Adding the variable mark
kalgiz dc404aa
Use pass Thru objects in Test-PSPester results instead of output files
kalgiz 554a23b
Merge branch 'master' of https://github.com/kalgiz/PowerShell into i5645
kalgiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
9 changes: 3 additions & 6 deletions
9
test/powershell/Modules/Microsoft.PowerShell.Utility/Set-Date.Tests.ps1
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -200,10 +200,16 @@ elseif($Stage -eq 'Build') | |
| $ProgressPreference = $originalProgressPreference | ||
| } | ||
|
|
||
| $testResultsNoSudo = "$pwd/TestResultsNoSudo.xml" | ||
| $testResultsSudo = "$pwd/TestResultsSudo.xml" | ||
|
|
||
| $pesterParam = @{ | ||
| 'binDir' = $output | ||
| 'PassThru' = $true | ||
| 'Terse' = $true | ||
| 'binDir' = $output | ||
| 'PassThru' = $true | ||
| 'Terse' = $true | ||
| 'Tag' = @() | ||
| 'ExcludeTag' = @('RequireSudoOnUnix') | ||
| 'OutputFile' = $testResultsNoSudo | ||
| } | ||
|
|
||
| if ($isFullBuild) { | ||
|
|
@@ -225,12 +231,20 @@ elseif($Stage -eq 'Build') | |
| Remove-Item -force ${telemetrySemaphoreFilepath} | ||
| } | ||
|
|
||
| $pesterPassThruObject = Start-PSPester @pesterParam | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you need to keep the pass thru objects for each run for use by Test-PSPesterResults |
||
| # Running tests which do not require sudo. | ||
| $pesterPassThruNoSudoObject = Start-PSPester @pesterParam | ||
|
|
||
| # Running tests, which require sudo. | ||
| $pesterParam['Tag'] = @('RequireSudoOnUnix') | ||
| $pesterParam['ExcludeTag'] = @() | ||
| $pesterParam['Sudo'] = $true | ||
| $pesterParam['OutputFile'] = $testResultsSudo | ||
| $pesterPassThruSudoObject = Start-PSPester @pesterParam | ||
|
|
||
| # Determine whether the build passed | ||
| try { | ||
| # this throws if there was an error | ||
| Test-PSPesterResults -ResultObject $pesterPassThruObject | ||
| @($pesterPassThruNoSudoObject, $pesterPassThruSudoObject) | ForEach-Object { Test-PSPesterResults -ResultObject $_ } | ||
| $result = "PASS" | ||
| } | ||
| catch { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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