From 225164037fa885ae87d6367edff354827efb9e18 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 13 Jan 2020 19:34:38 +0000 Subject: [PATCH] Correct case of $PID special variable --- test/powershell/Host/ConsoleHost.Tests.ps1 | 2 +- test/powershell/Host/Logging.Tests.ps1 | 8 ++++---- .../TabCompletion/TabCompletion.Tests.ps1 | 14 ++++++------- .../Operators/NullConditional.Tests.ps1 | 4 ++-- .../Debugging/DebuggingInHost.Tests.ps1 | 2 +- .../Enter-PSHostProcess.Tests.ps1 | 16 +++++++-------- .../Get-PSHostProcessInfo.Tests.ps1 | 2 +- .../History.Tests.ps1 | 2 +- .../Microsoft.PowerShell.Core/Job.Tests.ps1 | 6 +++--- .../Get-Process.Tests.ps1 | 14 ++++++------- .../CmsMessage.Tests.ps1 | 4 ++-- .../Implicit.Remoting.Tests.ps1 | 20 +++++++++---------- .../Select-Object.Tests.ps1 | 2 +- .../Trace-Command.Tests.ps1 | 2 +- .../Write-Stream.Tests.ps1 | 2 +- .../command.tests.ps1 | 2 +- test/tools/Modules/PSSysLog/PSSysLog.psm1 | 2 +- 17 files changed, 52 insertions(+), 52 deletions(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 338899037d..ccfcff70e8 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -761,7 +761,7 @@ namespace StackTest { # Generate a string that is larger than the max pipe name length. $longPipeName = [string]::new("A", 200) - "`$pid" | & $powershell -CustomPipeName $longPipeName -c - + "`$PID" | & $powershell -CustomPipeName $longPipeName -c - $LASTEXITCODE | Should -Be $ExitCodeBadCommandLineParameter } } diff --git a/test/powershell/Host/Logging.Tests.ps1 b/test/powershell/Host/Logging.Tests.ps1 index b55ff6bd56..f66c84246a 100644 --- a/test/powershell/Host/Logging.Tests.ps1 +++ b/test/powershell/Host/Logging.Tests.ps1 @@ -191,7 +191,7 @@ Creating Scriptblock text \(1 of 1\):#012{0}(⏎|#012)*ScriptBlock ID: [0-9a-z\- It 'Verifies scriptblock logging' -Skip:(!$IsSupportedEnvironment) { $configFile = WriteLogSettings -LogId $logId -ScriptBlockLogging -LogLevel Verbose $script = @' -$pid +$PID & ([scriptblock]::create("Write-Verbose 'testheader123' ;Write-verbose 'after'")) '@ $testFileName = 'test01.ps1' @@ -220,7 +220,7 @@ $pid It 'Verifies scriptblock logging with null character' -Skip:(!$IsSupportedEnvironment) { $configFile = WriteLogSettings -LogId $logId -ScriptBlockLogging -LogLevel Verbose $script = @' -$pid +$PID & ([scriptblock]::create("Write-Verbose 'testheader123$([char]0x0000)' ;Write-verbose 'after'")) '@ $testFileName = 'test01.ps1' @@ -338,7 +338,7 @@ Path:.* It 'Verifies scriptblock logging' -Skip:(!$IsSupportedEnvironment) { try { $script = @' -$pid +$PID & ([scriptblock]::create("Write-Verbose 'testheader123' ;Write-verbose 'after'")) '@ $configFile = WriteLogSettings -ScriptBlockLogging -LogId $logId -LogLevel Verbose @@ -376,7 +376,7 @@ $pid It 'Verifies scriptblock logging with null character' -Skip:(!$IsSupportedEnvironment) { try { $script = @' -$pid +$PID & ([scriptblock]::create("Write-Verbose 'testheader123$([char]0x0000)' ;Write-verbose 'after'")) '@ $configFile = WriteLogSettings -ScriptBlockLogging -LogId $logId -LogLevel Verbose diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index 86bccb03aa..6160d25cc1 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -1112,7 +1112,7 @@ dir -Recurse ` "Overridden-TabExpansion-Function" } - $inputStr = '$pid.' + $inputStr = '$PID.' $res = [System.Management.Automation.CommandCompletion]::CompleteInput($inputStr, $inputst.Length, $null) $res.CompletionMatches | Should -HaveCount 1 $res.CompletionMatches[0].CompletionText | Should -BeExactly 'Overridden-TabExpansion-Function' @@ -1124,7 +1124,7 @@ dir -Recurse ` } Set-Alias -Name TabExpansion -Value OverrideTabExpansion - $inputStr = '$pid.' + $inputStr = '$PID.' $res = [System.Management.Automation.CommandCompletion]::CompleteInput($inputStr, $inputst.Length, $null) $res.CompletionMatches | Should -HaveCount 1 $res.CompletionMatches[0].CompletionText | Should -BeExactly "Overridden-TabExpansion-Alias" @@ -1153,12 +1153,12 @@ dir -Recurse ` $ast = {}.Ast; $tokens = [System.Management.Automation.Language.Token[]]@() $testCases = @( - @{ inputStr = {[System.Management.Automation.CommandCompletion]::MapStringInputToParsedInput('$pid.', 7)}; expected = "PSArgumentException" } + @{ inputStr = {[System.Management.Automation.CommandCompletion]::MapStringInputToParsedInput('$PID.', 7)}; expected = "PSArgumentException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($null, $null, $null, $null)}; expected = "PSArgumentNullException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($ast, $null, $null, $null)}; expected = "PSArgumentNullException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($ast, $tokens, $null, $null)}; expected = "PSArgumentNullException" } - @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput('$pid.', 7, $null, $null)}; expected = "PSArgumentException" } - @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput('$pid.', 5, $null, $null)}; expected = "PSArgumentNullException" } + @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput('$PID.', 7, $null, $null)}; expected = "PSArgumentException" } + @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput('$PID.', 5, $null, $null)}; expected = "PSArgumentNullException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($null, $null, $null, $null, $null)}; expected = "PSArgumentNullException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($ast, $null, $null, $null, $null)}; expected = "PSArgumentNullException" } @{ inputStr = {[System.Management.Automation.CommandCompletion]::CompleteInput($ast, $tokens, $null, $null, $null)}; expected = "PSArgumentNullException" } @@ -1218,7 +1218,7 @@ dir -Recurse ` $testCases = @( @{ inputStr = "Invoke-CimMethod -ClassName Win32_Process -MethodName Crea"; expected = "Create" } @{ inputStr = "Get-CimInstance -ClassName Win32_Process | Invoke-CimMethod -MethodName AttachDeb"; expected = "AttachDebugger" } - @{ inputStr = 'Get-CimInstance Win32_Process | ?{ $_.ProcessId -eq $Pid } | Get-CimAssociatedInstance -ResultClassName Win32_Co*uterSyst'; expected = "Win32_ComputerSystem" } + @{ inputStr = 'Get-CimInstance Win32_Process | ?{ $_.ProcessId -eq $PID } | Get-CimAssociatedInstance -ResultClassName Win32_Co*uterSyst'; expected = "Win32_ComputerSystem" } @{ inputStr = "Get-CimInstance -ClassName Win32_Environm"; expected = "Win32_Environment" } @{ inputStr = "New-CimInstance -ClassName Win32_Environm"; expected = "Win32_Environment" } @{ inputStr = 'New-CimInstance -ClassName Win32_Process | %{ $_.Captio'; expected = "Caption" } @@ -1228,7 +1228,7 @@ dir -Recurse ` @{ inputStr = 'Invoke-CimMethod -Namespace root/StandardCimv2 -ClassName MSFT_NetIPAddress -MethodName Crea'; expected = 'Create' } @{ inputStr = '$win32_process = Get-CimInstance -ClassName Win32_Process; $win32_process | Invoke-CimMethod -MethodName AttachDe'; expected = 'AttachDebugger' } @{ inputStr = '$win32_process = Get-CimInstance -ClassName Win32_Process; Invoke-CimMethod -InputObject $win32_process -MethodName AttachDe'; expected = 'AttachDebugger' } - @{ inputStr = 'Get-CimInstance Win32_Process | ?{ $_.ProcessId -eq $Pid } | Get-CimAssociatedInstance -ResultClassName Win32_ComputerS'; expected = 'Win32_ComputerSystem' } + @{ inputStr = 'Get-CimInstance Win32_Process | ?{ $_.ProcessId -eq $PID } | Get-CimAssociatedInstance -ResultClassName Win32_ComputerS'; expected = 'Win32_ComputerSystem' } @{ inputStr = 'Get-CimInstance -Namespace root/Interop -ClassName Win32_PowerSupplyP'; expected = 'Win32_PowerSupplyProfile' } @{ inputStr = 'Get-CimInstance __NAMESP'; expected = '__NAMESPACE' } @{ inputStr = 'Get-CimInstance -Namespace root/Inter'; expected = 'root/Interop' } diff --git a/test/powershell/Language/Operators/NullConditional.Tests.ps1 b/test/powershell/Language/Operators/NullConditional.Tests.ps1 index 3bb2140271..7284b8e406 100644 --- a/test/powershell/Language/Operators/NullConditional.Tests.ps1 +++ b/test/powershell/Language/Operators/NullConditional.Tests.ps1 @@ -300,7 +300,7 @@ Describe 'NullConditionalMemberAccess' -Tag 'CI' { ${array}?.length | Should -Be 3 ${hash}?.a | Should -Be 1 - (Get-Process -Id $pid)?.Name | Should -BeLike "pwsh*" + (Get-Process -Id $PID)?.Name | Should -BeLike "pwsh*" (Get-Item $TestDrive)?.EnumerateFiles()?.Name | Should -BeExactly 'testfile.txt' [int32]::MaxValue?.ToString() | Should -BeExactly '2147483647' @@ -365,7 +365,7 @@ Describe 'NullConditionalMemberAccess' -Tag 'CI' { It 'Use ?. on a dynamic property name' { $testContent = @' $propName = 'Name' - (Get-Process -Id $pid)?.$propName | Should -BeLike 'pwsh*' + (Get-Process -Id $PID)?.$propName | Should -BeLike 'pwsh*' ${doesNotExist}?.$propName() | Should -BeNullOrEmpty '@ diff --git a/test/powershell/Language/Scripting/Debugging/DebuggingInHost.Tests.ps1 b/test/powershell/Language/Scripting/Debugging/DebuggingInHost.Tests.ps1 index c87bba13ca..2252d2b8df 100644 --- a/test/powershell/Language/Scripting/Debugging/DebuggingInHost.Tests.ps1 +++ b/test/powershell/Language/Scripting/Debugging/DebuggingInHost.Tests.ps1 @@ -16,7 +16,7 @@ Describe "Tests Debugger GetCallStack() on runspaces when attached to a WinRM ho # Get WinRM host process id [powershell] $ps = [powershell]::Create() $ps.Runspace = $rs - $result = $ps.AddScript('$pid').Invoke() + $result = $ps.AddScript('$PID').Invoke() It "Verifies the WinRM host process Id was found" { $result | Should -Not -BeNullOrEmpty ($result.Count -eq 1) | Should -BeTrue diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Enter-PSHostProcess.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Enter-PSHostProcess.Tests.ps1 index 4a3519df92..780744a439 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Enter-PSHostProcess.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Enter-PSHostProcess.Tests.ps1 @@ -40,7 +40,7 @@ function Invoke-PSHostProcessScript { $commandStr = @' Start-Sleep -Seconds {0} Enter-PSHostProcess {1} -ErrorAction Stop -$pid +$PID Exit-PSHostProcess '@ -f $i, $ArgumentString @@ -69,10 +69,10 @@ Describe "Enter-PSHostProcess tests" -Tag Feature { Context "By Process Id" { BeforeEach { - # Start a normal job where the first thing it does is return $pid. After that, spin forever. + # Start a normal job where the first thing it does is return $PID. After that, spin forever. # We will use this job as the target process for Enter-PSHostProcess $pwshJob = Start-Job { - $pid + $PID while ($true) { Start-Sleep -Seconds 30 | Out-Null } @@ -98,10 +98,10 @@ Describe "Enter-PSHostProcess tests" -Tag Feature { } It "Can enter, exit, and re-enter another Windows PowerShell PSHost" -Skip:(!$IsWindows) { - # Start a PowerShell job where the first thing it does is return $pid. After that, spin forever. + # Start a PowerShell job where the first thing it does is return $PID. After that, spin forever. # We will use this job as the target process for Enter-PSHostProcess $powershellJob = Start-Job { - $pid + $PID while ($true) { Start-Sleep -Seconds 30 | Out-Null } @@ -134,7 +134,7 @@ Describe "Enter-PSHostProcess tests" -Tag Feature { $rs.Open() $ps = [powershell]::Create() $ps.Runspace = $rs - $ps.AddScript('$pid') + $ps.AddScript('$PID') [int]$retry = 0 $result = $null @@ -164,12 +164,12 @@ Describe "Enter-PSHostProcess tests" -Tag Feature { $pipeName = [System.IO.Path]::GetRandomFileName() $pipePath = Get-PipePath -PipeName $pipeName - # Start a job where the first thing it does is set the custom pipe name, then return $pid. + # Start a job where the first thing it does is set the custom pipe name, then return $PID. # After that, spin forever. # We will use this job as the target process for Enter-PSHostProcess $pwshJob = Start-Job -ArgumentList $pipeName { [System.Management.Automation.Remoting.RemoteSessionNamedPipeServer]::CreateCustomNamedPipeServer($args[0]) - $pid + $PID while ($true) { Start-Sleep -Seconds 30 | Out-Null } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1 index faf55265ee..a8665db1d3 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1 @@ -26,7 +26,7 @@ Describe "Get-PSHostProcessInfo tests" -Tag CI { } It "Should return own self" { - (Get-PSHostProcessInfo).ProcessId | Should -Contain $pid + (Get-PSHostProcessInfo).ProcessId | Should -Contain $PID } It "Should list info for other PowerShell hosted processes" { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/History.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/History.Tests.ps1 index 9ae2f1e3bc..8ba2687913 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/History.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/History.Tests.ps1 @@ -100,7 +100,7 @@ Describe "History cmdlet test cases" -Tags "CI" { $ps = [PowerShell]::Create() $null = $ps.AddScript("(Get-Command Get-Process).Visibility = 'Private'").Invoke() $ps.Commands.Clear() - $null = $ps.AddScript("Get-Process -id $pid") + $null = $ps.AddScript("Get-Process -id $PID") $null = $ps.Invoke($null, $invocationSettings) $ps.Commands.Clear() $null = $ps.AddScript("Invoke-History -id 1") diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1 index da1f21ba1c..f042a0bb23 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1 @@ -205,14 +205,14 @@ Describe "Ampersand background test" -tag "CI","Slow" { Receive-Job $j -Wait | Should -BeExactly "Hi Bob! Hi Mary! Hi Bill!" } It 'Make sure that $PID from the parent process does not overwrite $PID in the child process' { - $j = Write-Output $pid & + $j = Write-Output $PID & $cpid = Receive-Job $j -Wait - $pid | Should -Not -BeExactly $cpid + $PID | Should -Not -BeExactly $cpid } It 'Make sure that $global:PID from the parent process does not overwrite $global:PID in the child process' { $j = Write-Output $global:pid & $cpid = Receive-Job -Wait $j - $pid | Should -Not -BeExactly $cpid + $PID | Should -Not -BeExactly $cpid } It "starts in the current directory" { $j = Get-Location | Foreach-Object -MemberName Path & diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 index 8eacdb06cd..77ddab0640 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 @@ -2,11 +2,11 @@ # Licensed under the MIT License. Describe "Get-Process for admin" -Tags @('CI', 'RequireAdminOnWindows') { It "Should support -IncludeUserName" { - (Get-Process -Id $pid -IncludeUserName).UserName | Should -Match $env:USERNAME + (Get-Process -Id $PID -IncludeUserName).UserName | Should -Match $env:USERNAME } It "Should support -Module" -Pending:$IsMacOS { - $modules = Get-Process -Id $pid -Module + $modules = Get-Process -Id $PID -Module $modules.GetType() | Should -BeExactly "System.Object[]" foreach ($module in $modules) { $module.GetType() | Should -BeExactly "System.Diagnostics.ProcessModule" @@ -14,7 +14,7 @@ Describe "Get-Process for admin" -Tags @('CI', 'RequireAdminOnWindows') { } It "Should support -FileVersionInfo" { - $pwshVersion = Get-Process -Id $pid -FileVersionInfo + $pwshVersion = Get-Process -Id $PID -FileVersionInfo if ($IsWindows) { $pwshVersion.FileVersion | Should -Match $PSVersionTable.PSVersion.ToString().Split("-")[0] $pwshVersion.FileMajorPart | Should -BeExactly $PSVersionTable.PSVersion.Major @@ -71,11 +71,11 @@ Describe "Get-Process" -Tags "CI" { } It "Test for process property = Name" { - (Get-Process -Id $pid).Name | Should -BeExactly "pwsh" + (Get-Process -Id $PID).Name | Should -BeExactly "pwsh" } It "Test for process property = Id" { - (Get-Process -Id $pid).Id | Should -BeExactly $pid + (Get-Process -Id $PID).Id | Should -BeExactly $PID } It "Should fail to run Get-Process with -IncludeUserName without admin" -Skip:(!$IsWindows) { @@ -119,12 +119,12 @@ Describe "Get-Process Formatting" -Tags "Feature" { Describe "Process Parent property" -Tags "CI" { It "Has Parent process property" { $powershellexe = (get-process -id $PID).mainmodule.filename - & $powershellexe -noprofile -command '(Get-Process -Id $pid).Parent' | Should -Not -BeNullOrEmpty + & $powershellexe -noprofile -command '(Get-Process -Id $PID).Parent' | Should -Not -BeNullOrEmpty } It "Has valid parent process ID property" { $powershellexe = (get-process -id $PID).mainmodule.filename - & $powershellexe -noprofile -command '(Get-Process -Id $pid).Parent.Id' | Should -Be $pid + & $powershellexe -noprofile -command '(Get-Process -Id $PID).Parent.Id' | Should -Be $PID } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 index 725c936f50..0ab474b484 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 @@ -327,9 +327,9 @@ Describe "CmsMessage cmdlets thorough tests" -Tags "Feature" { } It "Verify protect message using OutString" { - $protected = Get-Process -Id $pid | Protect-CmsMessage -To (Get-GoodCertificateLocation) + $protected = Get-Process -Id $PID | Protect-CmsMessage -To (Get-GoodCertificateLocation) $decrypted = $protected | Unprotect-CmsMessage -To (Get-GoodCertificateLocation) # Should have had PID in output - $decrypted | Should -Match $pid + $decrypted | Should -Match $PID } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 index 3ddc835fca..064783bdeb 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 @@ -354,7 +354,7 @@ try } It "Verifies that proxy returns remote pid" { - (Get-Variable -Name pid).Value | Should -Not -Be $pid + (Get-Variable -Name pid).Value | Should -Not -Be $PID } It "Verfies Remove-Module doesn't remove user's runspace" { @@ -762,15 +762,15 @@ try } It "proxy should return remote pid" { - (Get-VariableProxy -Name:pid).Value | Should -Not -Be $pid + (Get-VariableProxy -Name:pid).Value | Should -Not -Be $PID } It "proxy should return remote pid" { - (Get-Variable -Name:pid).Value | Should -Not -Be $pid + (Get-Variable -Name:pid).Value | Should -Not -Be $PID } It "proxy should return remote pid" { - $(& (Get-Command gvalias -Type alias) -Name:pid).Value | Should -Not -Be $pid + $(& (Get-Command gvalias -Type alias) -Name:pid).Value | Should -Not -Be $PID } It "NoName-c8aeb5c8-2388-4d64-98c1-a9c6c218d404" { @@ -995,9 +995,9 @@ try } # Sanity checks. - Invoke-Command $session {Get-Process -pid $pid | foo} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" - Invoke-Command $session {Get-Process -pid $pid | foo -Total 5} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" - Invoke-Command $session {Get-Process -pid $pid | foo -Priority normal} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + Invoke-Command $session {Get-Process -pid $PID | foo} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + Invoke-Command $session {Get-Process -pid $PID | foo -Total 5} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + Invoke-Command $session {Get-Process -pid $PID | foo -Priority normal} | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" $module = Import-PSSession $session foo -AllowClobber } @@ -1008,15 +1008,15 @@ try } It "Pipeline binding works by property name" { - (Get-Process -id $pid | foo) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + (Get-Process -id $PID | foo) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" } It "Pipeline binding works by property name" { - (Get-Process -id $pid | foo -Total 5) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + (Get-Process -id $PID | foo -Total 5) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" } It "Pipeline binding works by property name" { - (Get-Process -id $pid | foo -Priority normal) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" + (Get-Process -id $PID | foo -Priority normal) | Should -BeExactly "Bound parameter: PriorityClass TotalProcessorTime" } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1 index d04ce8d069..e1de2303a4 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1 @@ -346,7 +346,7 @@ Describe "Select-Object with Property = '*'" -Tags "CI" { } It "Select-Object with ExpandProperty and Property don't skip processing ExcludeProperty" { - $p = Get-Process -Id $pid | Select-Object -Property Process* -ExcludeProperty ProcessorAffinity -ExpandProperty Modules + $p = Get-Process -Id $PID | Select-Object -Property Process* -ExcludeProperty ProcessorAffinity -ExpandProperty Modules $p[0].psobject.Properties.Item("ProcessorAffinity") | Should -BeNullOrEmpty } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 index e6191836fb..204bed9376 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 @@ -80,7 +80,7 @@ Describe "Trace-Command" -tags "CI" { $log = Get-Content $logfile | Where-Object {$_ -like "*ProcessID=*"} $results = $log | ForEach-Object {$_.Split("=")[1]} - $results | ForEach-Object { $_ | Should -Be $pid } + $results | ForEach-Object { $_ | Should -Be $PID } } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 index d08fa455da..3fa2381472 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 @@ -80,7 +80,7 @@ Describe "Stream writer tests" -Tags "CI" { # redirect the streams is sufficient $result = Write-Information "Test Message" *>&1 $result.NativeThreadId | Should -Not -Be 0 - $result.ProcessId | Should -Be $pid + $result.ProcessId | Should -Be $PID $result | Should -BeOfType System.Management.Automation.InformationRecord # Use Match instead of Be so we can avoid dealing with a potential domain name diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/command.tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/command.tests.ps1 index fee1c049fe..989ced59cd 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/command.tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/command.tests.ps1 @@ -76,7 +76,7 @@ Describe "Trace-Command" -tags "Feature" { $log = Get-Content $logfile | Where-Object {$_ -like "*ProcessID=*"} $results = $log | ForEach-Object {$_.Split("=")[1]} - $results | ForEach-Object { $_ | Should -Be $pid } + $results | ForEach-Object { $_ | Should -Be $PID } } } } diff --git a/test/tools/Modules/PSSysLog/PSSysLog.psm1 b/test/tools/Modules/PSSysLog/PSSysLog.psm1 index 287ae8511f..70a7d963f6 100644 --- a/test/tools/Modules/PSSysLog/PSSysLog.psm1 +++ b/test/tools/Modules/PSSysLog/PSSysLog.psm1 @@ -149,7 +149,7 @@ Class OsLogIds [int] $Thread = 2; [int] $Type = 3; [int] $Activity = 4; - [int] $Pid = 5; + [int] $PID = 5; [int] $TTL = 6; [int] $ProcessName = 7; [int] $Module = 8;