Merge pull request #1701 from andschwa/unix-modules

Remove unsupported commands from Unix modules
This commit is contained in:
Dongbo Wang 2016-08-09 22:28:46 -07:00 committed by GitHub
commit 2aa5c07581
10 changed files with 135 additions and 42 deletions

View file

@ -37,7 +37,7 @@ The PowerShell jobs fail, see [#1010][].
## xUnit
The xUnit tests can only be run on Linux.
The xUnit tests are disabled pending implementation of a new runner.
## Console Output
@ -66,47 +66,19 @@ and 3582bb421 for the merge.
[#929]: https://github.com/PowerShell/PowerShell/issues/929
## Unavailable cmdlets
### ExecutionPolicy unavailable on non-Windows platforms
This project includes the CoreCLR versions of the `Commands.Management`,
`Commands.Utility`, `Security`, and `PSDiagnostics` modules.
The `Archive`, `Diagnostics`, `PSGet`, and `Host` modules are not yet included.
The `WSMan.Management` module cannot be included unless the
`Management.Infrastructure.Native` library is ported.
The CoreCLR version of the `Commands.Utility` module does not contain the
following cmdlets that exist in the FullCLR version:
- ConvertFrom-String
- ConvertTo-Html
- Export-PSSession
- Import-PSSession
- Invoke-RestMethod
- Invoke-WebRequest
- Out-GridView
- Out-Printer
- Send-MailMessage
- Show-Command
- Update-List
### ExecutionPolicy unavailable on non-Windows platform
ExecutionPolicy is not implemented on non-Windows platforms and the following related CmdLets will return the error below.
- Get-ExecutionPolicy
- Set-ExecutionPolicy
ExecutionPolicy is not implemented on non-Windows platforms.
`Get-ExecutionPolicy` will always return `Unrestricted` which is the correct operating mode.
`Set-ExecutionPolicy` will throw `PlatformNotSupported`.
```
Set-ExecutionPolicy : Operation is not supported on this platform.
At line:1 char:1
+ Set-ExecutionPolicy AllSigned
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], Platfor
mNotSupportedException
+ FullyQualifiedErrorId : System.PlatformNotSupportedException,Microsoft.P
owerShell.Commands.SetExecutionPolicyCommand
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], PlatformNotSupportedException
+ FullyQualifiedErrorId : System.PlatformNotSupportedException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
```

View file

@ -0,0 +1,52 @@
@{
GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D"
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
ModuleVersion="3.1.0.0"
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=390785'
FunctionsToExport = @()
CmdletsToExport=@("Add-Content",
"Clear-Content",
"Clear-ItemProperty",
"Join-Path",
"Convert-Path",
"Copy-ItemProperty",
"Get-ChildItem",
"Get-Content",
"Get-ItemProperty",
"Get-ItemPropertyValue",
"Move-ItemProperty",
"Get-Location",
"Set-Location",
"Push-Location",
"Pop-Location",
"New-PSDrive",
"Remove-PSDrive",
"Get-PSDrive",
"Get-Item",
"New-Item",
"Set-Item",
"Remove-Item",
"Move-Item",
"Rename-Item",
"Copy-Item",
"Clear-Item",
"Invoke-Item",
"Get-PSProvider",
"New-ItemProperty",
"Split-Path",
"Test-Path",
"Get-Process",
"Stop-Process",
"Wait-Process",
"Debug-Process",
"Start-Process",
"Remove-ItemProperty",
"Rename-ItemProperty",
"Resolve-Path",
"Set-Content",
"Set-ItemProperty")
}

View file

@ -0,0 +1,30 @@
@{
GUID="1DA87E53-152B-403E-98DC-74D7B4D63D59"
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
ModuleVersion="3.1.0.0"
PowerShellVersion="3.0"
CmdletsToExport= "Format-List", "Format-Custom", "Format-Table", "Format-Wide",
"Out-File", "Out-String", "Get-FormatData", "Export-FormatData", "ConvertFrom-Json", "ConvertTo-Json",
"Invoke-RestMethod", "Invoke-WebRequest", "Register-ObjectEvent", "Register-EngineEvent",
"Wait-Event", "Get-Event", "Remove-Event", "Get-EventSubscriber", "Unregister-Event",
"New-Event", "Add-Member", "Add-Type", "Compare-Object", "ConvertFrom-StringData",
"Export-Csv", "Import-Csv", "ConvertTo-Csv", "ConvertFrom-Csv", "Export-Alias", "Invoke-Expression",
"Get-Alias", "Get-Culture", "Get-Date", "Get-Host", "Get-Member", "Get-Random",
"Get-UICulture", "Get-Unique", "Import-Alias", "Import-LocalizedData",
"Select-String", "Measure-Object", "New-Alias", "New-TimeSpan", "Read-Host", "Set-Alias", "Set-Date",
"Start-Sleep", "Tee-Object", "Measure-Command", "Update-TypeData", "Update-FormatData",
"Remove-TypeData", "Get-TypeData", "Write-Host", "Write-Progress", "New-Object", "Select-Object",
"Group-Object", "Sort-Object", "Get-Variable", "New-Variable", "Set-Variable", "Remove-Variable",
"Clear-Variable", "Export-Clixml", "Import-Clixml", "ConvertTo-Xml", "Select-Xml", "Write-Debug",
"Write-Verbose", "Write-Warning", "Write-Error", "Write-Information", "Write-Output", "Set-PSBreakpoint",
"Get-PSBreakpoint", "Remove-PSBreakpoint", "Enable-PSBreakpoint", "Disable-PSBreakpoint", "Get-PSCallStack",
"Get-TraceSource", "Set-TraceSource", "Trace-Command",
"Get-Runspace", "Debug-Runspace", "Enable-RunspaceDebug", "Disable-RunspaceDebug",
"Get-RunspaceDebug", "Wait-Debugger"
FunctionsToExport= "Get-FileHash", "New-TemporaryFile", "New-Guid", "Format-Hex", "Import-PowerShellDataFile"
AliasesToExport= "fhx"
NestedModules="Microsoft.PowerShell.Commands.Utility.dll","Microsoft.PowerShell.Utility.psm1"
HelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=390787'
}

View file

@ -12,7 +12,6 @@
"mappings": {
"Modules/" : {
"include": [
"../Modules/Windows+Unix-Core",
"../Modules/Unix",
"../Modules/Shared"
],
@ -36,7 +35,6 @@
"mappings": {
"Modules/" : {
"include": [
"../Modules/Windows+Unix-Core",
"../Modules/Unix",
"../Modules/Shared"
],
@ -49,7 +47,7 @@
"*.so",
"*.dylib",
"../../powershell.version"
],
]
},
"dependencies": {

View file

@ -13,7 +13,6 @@
"Modules/" : {
"include": [
"../Modules/Windows-Core",
"../Modules/Windows+Unix-Core",
"../Modules/Windows-Core+Full",
"../Modules/Shared"
],
@ -36,7 +35,6 @@
"Modules/" : {
"include": [
"../Modules/Windows-Core",
"../Modules/Windows+Unix-Core",
"../Modules/Windows-Core+Full",
"../Modules/Shared"
],
@ -50,7 +48,7 @@
"pwrshplugin.pdb",
"Install-PowerShellRemoting.ps1",
"../../powershell.version"
],
]
},
"dependencies": {

View file

@ -51,6 +51,6 @@
"runtimes": {
"win7-x64": { },
"win81-x64": { },
"win10-x64": { },
"win10-x64": { }
}
}

View file

@ -0,0 +1,30 @@
Describe "Unimplemented Management Cmdlet Tests" -Tags "CI" {
$Commands = @(
"Get-Service",
"Stop-Service",
"Start-Service",
"Suspend-Service",
"Resume-Service",
"Restart-Service",
"Set-Service",
"New-Service",
"Restart-Computer",
"Stop-Computer",
"Rename-Computer",
"Get-ComputerInfo",
"Test-Connection",
"Get-TimeZone",
"Set-TimeZone"
)
foreach ($Command in $Commands) {
It "$Command should only be available on Windows" {
[bool](Get-Command $Command -ErrorAction SilentlyContinue) | Should Be $IsWindows
}
}
}

View file

@ -0,0 +1,13 @@
Describe "Unimplemented Utility Cmdlet Tests" -Tags "CI" {
$Commands = @(
"Unblock-File",
"ConvertFrom-SddlString"
)
foreach ($Command in $Commands) {
It "$Command should only be available on Windows" {
[bool](Get-Command $Command -ErrorAction SilentlyContinue) | Should Be $IsWindows
}
}
}