Commit graph

6045 commits

Author SHA1 Message Date
Sergey Vasin 1be0594f45 Improve code coverage in Export-Csv.Tests.ps1. (#6795)
* Improve code coverage in Export-Csv.Tests.ps1.

* Change test logic.
2018-05-04 09:46:26 -07:00
Ilya c1026b3ae8 Remove 'more' function and move the $env:PAGER capability into the help function (#6059) 2018-05-04 09:25:05 -07:00
Patochun 145cb77226 Update Tests Isfile to correct response for "/" (#6754)
I Think the good answer for "/" is a directory, not a file.
So I recommand to change EXPECT_TRUE by EXPECT_FALSE for this case.
2018-05-03 14:28:44 -07:00
PRASOON KARUNAN V ec678be4f4 Implementation of -lp alias for -LiteralPath variable #6732 (#6770)
Implementation of -lp alias for -LiteralPath variable for issue #6732 

Add-Content 

Add-Type 

Clear-Content 

Clear-Item 

Clear-ItemProperty 

Convert-Path 

Copy-Item 

Export-Alias 

Export-Clixml 

Export-Csv 

Export-FormatData 

Format-Hex 

Get-ChildItem 

Get-Content 

Get-FileHash 

Get-Item 

Get-ItemProperty 

Get-ItemPropertyValue 

Import-Alias 

Import-Clixml 

Import-Csv 

Import-PowerShellDataFile 

Move-Item 

Out-File 

Push-Location 

Remove-Item 

Rename-Item 

Resolve-Path 

Select-String 

Select-Xml 

Set-Content 

Set-Item 

Set-ItemProperty 

Set-Location 

Split-Path 

Start-Job 

Start-Transcript 

Tee-Object 

Test-Path 

Unblock-File
2018-05-03 14:22:48 -07:00
Ilya 84344cbb32 Update PowerShell to build with .NET Core SDK 2.1.300-rc1-008662 (#6718)
* Build Update
- Change `TargetFramework` to `netcoreapp2.1` and removed unnecessary `RuntimeFrameworkVersion` from `PowerShell.Common.props`
- Update dotnet SDK to 2.1.300-rc1-008662
- Update `TypeGen` target in `Build.psm1` to work with 2.1
- Rename macOS runtime to `osx-x64` as the old build logic expects 10.12 and breaks running on 10.13 system.
- Remove `PackageReference` to `System.Memory` as it's part of dotnetcore 2.1
- Update search for `crossgen` executable to find the matching version

* Test Update
- Update test tools `WebListener` to latest `asp.net core`
- Marked `AuthHeader Redirect` tests as `Pending` due to change in CoreFX
2018-05-02 16:58:39 -07:00
Christoph Bergmeister 16e1823e33 Packaging: Add registry keys to support library folder background for explorer context menu (#6784)
Fixes #6590 by adding registry keys to support the existing explorer context menu also when being inside a library folder. It follows the existing pattern that was already applied to special cases such as drives, Desktop, etc.
Manually Tested on Win 10 1709
Thanks to @mklement0 for triaging the issue and already researching the required registry key (he should also be included in the release notes)
2018-05-02 14:43:25 -07:00
Dan Travison 385cc1b796 Disallow Basic Auth over HTTP on Unix (#6787)
Disallow Basic Auth over HTTP on Unix

Fix: #6779
2018-05-02 14:29:10 -07:00
Steve Lee 77d10e969e Fix Format-Table where rows were being trimmed unnecessarily if there's only one row of headers (#6772) 2018-05-02 17:59:48 +05:00
Aditya Patwardhan c51a6e38cf
Fix test and infrastructure blocking code coverage runs (#6790)
* Fix Remove-Item test to use a test directory instead of relying on pre-existing directory
* Increase timeout as we are regularly going over it.
2018-05-01 17:28:57 -07:00
Andrew 0e8665dfc0 Updated Docker package tests, fixed error on opensuse42 (#6783)
This PR addresses minor issues with PS-package docker tests.

Historically rpm package version string was different from other packages, however, this is no longer the case, so updating tests to account for that (to simplify things - removing RPM-version parameter from dockerfiles because it is no longer used).
Configs that use 'linux-x64.tar.gz' (currently only "opensuse42.2") are failing, so fixing that in the script.
2018-05-01 10:38:43 -07:00
Bryan Harmat 03b1f2bb99 tools: fix comparison to see if sudo test is needed in install-*.sh (#6771)
The comparison to test if we were using sudo was failing when running as root. We would then run -v, and get a bad error message. fixing the comparison.
2018-05-01 10:35:19 -07:00
Robert Holt 9ca059dcf8 Revert changes from PR #6600 which cause a regression in drive behavior (#6751)
This reverts the commit 35d8de927b, which caused a regression in drive behavior where drive paths were not restored. See issue #6749.
2018-04-30 15:25:11 -07:00
Klaudia Algiz bee98547e4 Fix Select-Object.Tests.ps1 which might fail for Unix OS. (#6747)
Fix Select-Object.Tests.ps1 which might fail for Unix OS.
In the test, the processes which name matches i* are selected and it checks if there is non zero number of these processes. The test assumes that there is always at least one process, probably `init` - idle, but on Unix idle process does not have the name and hence the test might fail
2018-04-30 13:09:16 -07:00
Dongbo Wang 1f9e9d243d Update 'Get-ChangeLog' to make it more accurate (#6764)
Update 'Get-ChangeLog' to make it more accurate

Use "||" as the delimiter instead of "|", so it works for commit message that has the pipeline operator in it.
Handle merges that create a merge node in history.
Do not treat powershell team members as external contributors.
2018-04-30 13:00:28 -07:00
Robert Holt 0c3f429780 Add tests for PowerShell classes inheriting from abstract .NET classes (#6752) 2018-04-30 10:17:20 -07:00
Dongbo Wang 8aec158519
Clean up uses of CommandTypes.Workflow and WorkflowInfo (#6708)
[breaking change] Clean up code related to the uses of `CommandTypes.Workflow` and `WorkflowInfo` in `System.Management.Automation`. This change mainly affects help provider code.

This PR includes a few minor breaking changes:
- Change the `public` constructors of `WorkflowInfo` to `internal`. We don't support workflow in PSCore, so I think it makes sense to not allow people to create `Workflow` instances.
- Remove the type `System.Management.Automation.DebugSource` since it's only used for workflow debugging.
- Remove the overload of `SetParent` from the abstract class `Debugger` that is only used for workflow debugging.
- Remove the same overload of `SetParent` from the derived class `RemotingJobDebugger`.
2018-04-27 23:02:15 -07:00
Sergey Vasin 24069241bc Fix CimCmdlets tests. (#6755) 2018-04-28 09:48:13 +05:00
Aditya Patwardhan 64050a4687 Added Publish-NugetToMyGet to exported functions in psd1 (#6763)
Added the missing export for Publish-NugetToMyGet.
2018-04-27 16:26:13 -07:00
Dongbo Wang aac9467061
Fix preview download links in README.md (#6762)
Replace `~` with `-` for preview download links in README.md
The file names have `~` in them, but when uploading files to Github, `~` will be automatically replaced. So we use `-` for the packages uploaded to Github.
2018-04-27 15:53:50 -07:00
Klaudia Algiz e9b045e819 Update Start-PSPester and Restore-PSPester cmdlets in build.psm1 to check for Pester 4.2 (#6667)
Update Start-PSPester and Restore-PSPester cmdlets in buil.psm1 to check for Pester 4.2 to support exception passthru.
2018-04-27 15:34:54 -07:00
Dongbo Wang 5fd0d6962b
Merge the release branch of v6.1.0-preview.2 to master 2018-04-27 14:22:23 -07:00
Aditya Patwardhan 2c3177a08d Add tests for PowerShell hosting API to verify MyGet packages (#6737) 2018-04-27 13:25:33 -07:00
Dongbo Wang c5415d31a6
Change line ending from CRLF to LF in Microsoft.PowerShell.Management.psd1 (#6758) 2018-04-27 11:05:24 -07:00
Dongbo Wang 9e59bc122a Update the preview version to 6.1.0-preview.2 in README.md 2018-04-27 00:54:42 +00:00
Dongbo Wang daf1accfb4 Update ChangeLog.md for 6.1.0-preview.2 release 2018-04-27 00:04:53 +00:00
Travis Plunk 768cfc4adf
Add script to create a container manifest (#6735)
Add script to create a container manifest
2018-04-26 10:03:53 -07:00
Ilya ffa7e4bac0 Enhance and refactor Add-Type cmdlet (#6141)
- Can compile a source from strings (TypeDefinition and MemberDefinition).
- Can compile from files.
- Can compile only to a file (without loading the produced assembly).
- Do not recompile and don't reload if the sources have not changed.
- Implement `-IgnoreWarnings` to not treat warnings as errors. By default, the cmdlet considers warnings as errors.
- Add VisualBasic support.
- Add new `-CompilerOptions` parameter to allow setting Roslyn command line parameters including:
    - Parser options.
    - Compile options.
    - Emit options.

**ATTENTION:** The `CompilerOptions` can be specified along with other options like `-OutputAssembly`, `-Language` and `-IgnoreWarnings`. The explicit setting parameters will take precedence over the same settings specified in `-CompileOptions`.

See docs about the compiler options:
https://github.com/dotnet/roslyn/blob/master/docs/compilers/CSharp/CommandLine.md
https://github.com/dotnet/roslyn/blob/master/docs/compilers/Visual%20Basic/CommandLine.md

**ATTENTION:** `-OutputType` default is `Library`. If `-OutputType` is absent the `-OutputType` default overlaps a value in `CompileOptions`. In other words output type ("target" ot "t" in command line) is always ignored in `CompileOptions`. We have to use `-OutputType` to set an output type.
2018-04-25 22:40:26 -07:00
Robert Holt 63c0d8d783 Add error handling for interactive #requires (#6469) 2018-04-25 18:04:04 -07:00
Klaudia Algiz 4b149e4191 Use new Pester syntax for Pester tests in module PSDesiredStateConfiguration (#6622) 2018-04-25 17:29:40 -07:00
Klaudia Algiz 045e036205 Update documentation on how to write tests verifying errors conditions (#6687) 2018-04-25 17:26:24 -07:00
Dan Travison 9a2382b67c Update PSRP/Linux NuGet package version to 1.4.2-* (#6711) 2018-04-25 15:48:38 -07:00
Matthew Bobke 35d8de927b Fix New-Item to work correctly when given path is drive root and $PWD is a sub folder of the drive root. (#6600) 2018-04-25 14:32:57 -07:00
Dongbo Wang 95aa40ee64 Expose 'Expand-PSSignedBuild' from packaging module 2018-04-25 11:51:50 -07:00
Ilya a9781dedc2
Add some optimizations in formatting subsystem (#6678)
Use safe pattern 'columns <= columnsThresHold ? stackalloc int[columns] : new int[columns];'
Remove duplicate code.
Use common 'columnsThresHold' constant.
2018-04-25 13:23:28 +05:00
Christoph Bergmeister fa3305534f Use '-WorkingDirectory' parameter to handle context menu when path contains single quotes. (#6660)
Use new '-WorkingDirectory' parameter on pwsh.exe to be able to use context menu when path contains single quotes.
2018-04-24 17:03:14 -07:00
Steve Lee 10900e0a24 Update error message that Disconnect is only supported with WSMan (#6689) 2018-04-24 16:29:01 -07:00
Steve Lee a9d10dda42 Fix two tests that are failing on nightly run (#6723)
- For ConsoleHosts tests, the test is validating error condition, but did not redirect stderr to stdout so the output isn't captured and thus an empty string failing the assertion.
- For SSHConnectionInfo API tests, it's calling a constructor that got overwritten with a new parameter. Fix is to put back that public API and overload it with a new one.
2018-04-24 16:25:55 -07:00
Steve Lee c80cecf35f Enable specifying sshd subsystem to use via -Subsystem (#6603)
The current implementation of PSRP over SSH only enables remoting to one version of PowerShell Core 6.
sshd_config allows specifying multiple subsystems that can start different versions of PowerShell Core 6 (or same versions with different parameters).
Enable use of a new -Subsystem parameter to specify the subsystem to use with ssh.
2018-04-24 12:51:56 -07:00
Ilya 313a8596bb
Pretty print Export-FormatData XML output (#6691)
Pretty print Export-FormatData XML output by default.
Refactor Export-FormatData tests, remove test duplications.
2018-04-24 10:04:42 +05:00
Steve Lee 942c68e796 Add '-WorkingDirectory' parameter to pwsh (#6612)
Add `-WorkingDirectory` parameter to `pwsh` to allow starting in right working directory.
2018-04-23 14:27:47 -07:00
Gabriel Sroka 84a3c9cdc7 Correct a typo in comment for 'Invoke-WebRequest' (#6700) 2018-04-23 14:21:50 -07:00
Ilya 2da7576736
Add tests for Format-Table -Wrap (#6670) 2018-04-23 12:45:14 +05:00
Ilya 5a326135ec
Add new reliable tests for Get-Date -UFormat (#6614) 2018-04-19 13:58:29 +05:00
Ilya c05f1ec3f3
Reduce allocations in TableWriter (#6648)
* [Feature] Reduce allocations in TableWriter
* Revert iterator
ReadOnlySpan is not supported in iterators
* Use columnsThresHold with stackalloc
2018-04-18 19:15:36 +05:00
Paul Higinbotham 80951777cf Port Windows PowerShell AppLocker and DeviceGuard UMCI application white listing support (#6133)
These changes port Windows PowerShell support for Applocker and DeviceGuard User Mode Code Integrity (UMCI) to PSCore6. Windows PowerShell uses public APIs to determine if a system is in locked down mode via AppLocker or DeviceGuard, and automatically runs in constrained language mode. For more information about PowerShell constrained language, see: https://blogs.msdn.microsoft.com/powershell/2017/11/02/powershell-constrained-language-mode/

This support for application whitelisting has mostly existed in PSCore6, but the primary APIs were stubbed out in CorePSStub.cs because they relied on Windows only DeviceGuard (wldp.dll) and AppLocker (Safer APIs) public APIs. These changes re-implement PowerShell lock down APIs on PSCore6 for Windows platforms only. The AppLocker and DeviceGuard public APIs are currently only implemented in Windows OSes and are not supported on Linux or MacOS platforms.

Tests have also been ported to PSCore6 and run only for Windows platforms.
2018-04-17 13:09:17 -07:00
Ilya 62bb0899ac
Reformat Format-Table tests (#6657)
* Convert identations to spaces
* Remove alias tests and extra lines
* Remane extra Describe
* Remove extra parentheses and add spaces
2018-04-17 10:06:39 +05:00
Ilya 2457113c80 Formatting: Use cache for dash padding strings (#6625) 2018-04-14 16:49:01 -07:00
Joey Aiello feb38cff70 Remove extraneous SSH and install docs from the 'demos' folder (#6628) 2018-04-13 15:50:54 -07:00
Dongbo Wang 11631e7412
Clean up 'GetTypeInfo()' calls in engine folder (#6634)
'GetTypeInfo()' were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0).
Most properties and methods in 'System.Type' were missing at that time. Now the call is not needed anymore and should be removed.
2018-04-13 15:10:10 -07:00
Dongbo Wang f9f1bd29ad
Clean up 'GetTypeInfo()' calls in other engine sub-folders (#6635)
'GetTypeInfo()' were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0).
Most properties and methods in 'System.Type' were missing at that time. Now the call is not needed anymore and should be removed.
2018-04-13 15:07:35 -07:00