Commit graph

731 commits

Author SHA1 Message Date
Dongbo Wang 2fe10558a2 Add basic test to make sure 'New-PSSession' doesn't crash powershell 2016-12-06 11:33:07 -08:00
David Christian 9c9b56d22f Updated Split-Path to work with UNC Roots (#2788) 2016-12-04 15:00:32 -08:00
Aditya Patwardhan 9a195f44c1 Marked flaky test as pending to unblock daily builds (#2838) 2016-12-04 00:12:51 -08:00
iSazonov 8abb6c3a94 Implicitly convert value assigned to XML property to string (#2678)
Using LanguagePrimitives.ConvertTo (to emulate what would happen if the property were a regular .Net property typed as string), we now convert the value assigned to an XML property to string.
2016-12-02 15:43:10 -08:00
Aditya Patwardhan fbb5c16eb9 Disable help content test for Microsoft.Powershell.Archive module (#2835)
The published help content filename is missing '.psm1', but the help still
works. The bug is in PlatyPS and needs to be fixed to re-enable this test.
2016-12-02 15:32:03 -08:00
Paul Higinbotham d2bf6294ab SSH remoting cmdlet parameter set changes based on RFC 0010 (#2710)
* RFC 0010 SSH remoting cmdlet updates.

* Tweaks to SSH remoting cmdlets

* SSHTransport parameter is now optional instead of mandatory.  Aded fix for CoreCLR entry point when hosted in SSH as a subsystem.

* Added tests

* Code review feedback

* Code review comment changes

* Making SSHTransport switch parameter mandatory because otherwise existing Invoke-Command parameter set

* The new SSH parameter set was causing legacy positional based parameters to no longer work. This fix separates the SSH parameter sets from the existing WinRM parameter sets.

* Fixed region name spelling error.
2016-12-02 14:01:08 -08:00
Aditya Patwardhan d9d97a43ca Add ErrorAction Stop so DeviceGuard function (#2825)
A non-terminating error is thrown when the namespace does not exist by
Get-CimInstance. The namespace is not present on OS versions below Windows
10. It is not caught in the try-catch unless ErrorAction Stop is added.
2016-12-02 11:16:11 -08:00
Dongbo Wang e9fdf8e842 Temporarily disable Update-Help and Save-Help tests in CI builds
Also fix a flaky Start-Sleep test
2016-11-30 13:02:32 -08:00
Aditya Patwardhan dcce8a21af Added -erroraction silentlycontinue for import-module (#2778)
If the module is not available it throws an error. To make sure OpenCover
works on PSv4 and below, -erroraction silentlycontinue was added.
2016-11-23 17:41:24 -08:00
Steve Lee 3d94e35f21 updated error messages to tell user what to do (#2766) 2016-11-23 11:50:18 -08:00
Manikyam Bavandla 67e9bf6376 - Fixed failing PackageManagement related tests in daily-builds (#2759)
- Updated Restore-PSModule function to delete the PSGetModuleInfo.xml so that this file will not be included in the PowerShell release.
- Since PackageManagement module gets installed with PowerShellGet module, removed PackageManagement module name in Restore-PSModule command invocation.
2016-11-21 17:36:51 -08:00
Dongbo Wang 20a0ba041c Fix the indicator for redirecting standard input (#2749) 2016-11-21 16:02:52 -08:00
Jianyun Tao bfe59b3495 # This is a combination of 3 commits.
# The first commit's message is:

Changed to PSModuleRestore switch, i.e., by default no PSModule install

# This is the commit message #2:

install PowerShell modules to publish folder as well as one level up

# This is the commit message #3:

removed workaround
2016-11-19 23:52:16 -08:00
Jianyun Tao 00d5f9c884 remove packagemanagement test code 2016-11-19 23:52:16 -08:00
Jianyun Tao a61f70f2e7 Add PackageManagement acceptance test cases 2016-11-19 23:52:16 -08:00
Mike Richmond e23b0b2002 Add runtime win7-x86 2016-11-18 16:35:16 -08:00
Steve Lee 9e9dbeaa5a updates to opencover module to make it more user friendly and works on coreclr (#2702)
* added type to returned objects
replaced expand-ziparchive with call to Archive module
added defaults to location of opencover.xml, opencover installation, powershell.exe, and location of tests
updated error messages with corrective action
replaced System.Net.WebClient call (not available on coreclr) with invoke-webrequest
scoped change of executionpolicy to process when starting pester to avoid error if system policy is less restrictive
updated version of module

* addressing code review feedback
- check for git before using
- check for opencover.console in path
- fixed path to code coverage build of PS

* added Expand-ZipArchive back to support psv4 scenario
2016-11-18 15:03:59 -08:00
iSazonov 4edde10fda Now Enum values definition have space-insensitive syntax (#2690)
Fix to support whitespace after the `=` and before the value expression.
2016-11-18 14:00:26 -08:00
iSazonov 469924d855 Add support W3C Extended Log File Format in Import-Csv (#2482)
* Add support W3C Extended Log File Format

1. Add support W3C Extended Log File Format
2. Refactoring Import-Csv tests

3. Add #Type tests

* Fx test after review

* Fix tests after review

* Remove unneeded test
2016-11-17 16:29:04 -08:00
James Truher [MSFT] 3f99de5784 Added tests to close code coverage in CIM area (#2528)
* Added tests to close code coverage in CIM area

Added CimAdapter.Tests for adaptation layer (code cribbed from BVT tests)
Added SessionOption.Tests.ps1 (Code cribbed from BVT tests)
Modified CimClass tests by adding more tests
Added CimSession.Tests for basic tests of New-CimSession cmdlet
Added CimInstance.Tests for basic tests of Get-CimInstance

* Add CI tags to tests

* unify test execution to use try/catch for marking tests as skipped

moved test which retrieves cimclass via method to feature as it is not
a common operation, this test can take some time as well
2016-11-17 11:46:07 -08:00
Sergei Vorobev ce26bca8db Re-enable Add-Type coreclr tests (#2705) 2016-11-16 21:23:57 -08:00
Dongbo Wang 7e581be7c4 Add HelpUri for Get-Uptime (#2688)
* Add HelpUri for Get-Uptime

* Update online help test data to include Get-Uptime
2016-11-16 11:13:09 -08:00
iSazonov 47be2c372a Write-Information accept objects from the pipeline (#2680)
* Write-Information accept objects from the pipeline

* Add test

* Fix test

Remove unneeded runspace.

* Clear streams before each test case

Streams of the PowerShell instance might have records from other test runs. Clear the streams before each test case.
2016-11-15 22:41:34 -08:00
Sergei Vorobev 32837f06ee Trying to make 'native command lifecycle' test unflaky
Also move it to the Feature category
2016-11-15 14:49:39 -08:00
Sergei Vorobev 616c15556f Re-shuffle minishell tests 2016-11-15 14:49:39 -08:00
Sergei Vorobev f0a4a7d821 Replace spin-lock by a proper BlockingCollection in NativeCommandProcessor 2016-11-15 14:49:39 -08:00
Sergei Vorobev a6fc5387c2 Add a code to handle finished process correctly on Unix 2016-11-15 14:49:39 -08:00
Sergei Vorobev 9658e62682 Add a test for broken linux pipe in native pipeline 2016-11-15 14:49:39 -08:00
Sergei Vorobev 584aec7c92 Add motivation example for the native pipeline changes 2016-11-15 14:49:39 -08:00
Sergei Vorobev 6acc1e0629 Add error stream and information stream tests
for native pipes
2016-11-15 14:49:39 -08:00
Sergei Vorobev a05fffd9dc Add a minishell clixml tests 2016-11-15 14:49:39 -08:00
Jason Shirk (POWERSHELL) ca2dce3537 Improve coverage for Write-Information output 2016-11-14 14:03:30 -08:00
Jason Shirk (POWERSHELL) acdf1c1d44 Fix LengthInBufferCells test for downlevel
When running on systems that do not support a virtual terminal,
the tests was incorrectly assuming escape sequences were removed.

The fix is to expect different results depending on whether or not
the host supports virtual terminal mode.
2016-11-14 13:59:43 -08:00
nmbradford 25005a0ba0 Fix WebRequest failure to handle missing ContentType in response header (#2666)
If a response to invoke-webrequest does not set the content type in the
response header, an object not set exception is thrown in
WebResponseHelper.CoreClr.cs.  Updated to set contenttype = null.
2016-11-14 13:35:07 -08:00
Jason Shirk bd9e49d8d9 Make Out-Null fast (#2629)
People use Out-Null despite much faster alternatives:

    $null = Do-Stuff
    [void] = Do-Stuff
    Do-Stuff > $null

This change makes Out-Null work in roughly the same say as the above.

The optimization is to detect that we're calling the built-in Out-Null
cmdlet when invoking a pipeline from script (the change won't have any
effect in the PowerShell api). If we detect Out-Null, we rewrite the
pipe to look similar to `Do-Stuff > $null`.
2016-11-11 11:29:53 -08:00
Aditya Patwardhan b18adb85d4 Add OpenCover PS Module to collect code coverage (#2585)
* Add OpenCover PS Module to collect code coverage

OpenCover PS Module helps is collecting Code Coverage using the OpenCover
toolset. The module helps in comparing two code coverage runs as well.

* Change OpenCover.psd1 to ASCII

* Fix an error in path for OpenCover

Fixed an error on path for OpenCover. Also used ZipFile class instead of
cmdlet as it might not be available on CI system.

* Convert module to be Powershell v4 compliant

Changed implementation from classes to PSObjects and implemented
Expand-ZipArchive.

* Added CodeCoverage as a configuration to project.json files

Added CodeCoverage as the new configuration for all the project.json
files. When Start-PSBuild is executed with configuration as CodeCoverage,
we change the degubType to 'full' as required by OpenCover toolset.

Also made changes to appveyor.psm1 to build a CodeCoverage package on
daily builds and publish it as a zip.

* Addressed code review comments

Changed from Add-Member to use pscustomobject type accelator. Removed
[gc]::collect.

* Added explicit garbage collection

* Addressed code review comments

- Make sure that the build Start-PSPackage gets is not a code coverage
  build
- Add debugType = full for FullCLR
- Remove configurations from PackageManagement files as it is not needed.
- Build CodeCoverage build first in AppVeyor.

* Resolve merge conflict

* Fix indentation

* Fix newline at end of file

* Added command discovery for locating OpenCover.console.exe
2016-11-11 11:12:07 -08:00
iSazonov b56bbeabc6 Add Get-Uptime to Microsoft.PowerShell.Utility (C# cmdlet) (#2517)
* Add Get-Uptime (C# code)

1. Add Get-Uptime cmdlet (C# code)
2. Modify psd1 files
3. Add tests

* Remove Pretty parameter after Powershell committee conclusion

1. Remove Pretty parameter
2. Remove tests for Pretty
3. Add Throw if  IsHighResolution is False
4. Fix formatting

* Add test to check throw

1. Add hook that simulate 'System.Diagnostics.Stopwatch.IsHighResolution == false' to test Get-Uptime throw
2. Add test to check throw

* Fixes after review

1. Remove Timespan parameter
2. Remove unneeded tests
3. Fix localization
4. Add string consts
5. Fix throw

* Fix OutputType to add parameter set name information
2016-11-10 09:51:29 -08:00
Nana Lakshmanan 2077e42b52 Fixing background jobs for Unix and Windows (#1972) 2016-11-09 22:44:39 -08:00
Lincoln Atkinson 594fae475b Wire up proper ConsoleHostRawUserInterface.LengthInBufferCells for Unix (#2637)
* Wire up proper ConsoleHostRawUserInterface.LengthInBufferCells for Unix

Ref https://github.com/PowerShell/PowerShell/issues/2502
This allows for Unix console host to properly calculate display width for
strings containing escape sequences (e.g. ANSI color), rather than
falling back to naive string.Length.

* Add basic tests for host LengthInBufferCells calculation
2016-11-09 10:20:31 -08:00
Adam Bertram 35b844a756 Fixed broken link in README (#2643) 2016-11-08 10:22:26 -08:00
Steve Lee ae7b857c23 removed Handles column from Process formatter (#2617)
addressing #1812
2016-11-07 10:39:19 -08:00
Francisco Gomez Gamino 92b0eb336d Adding tests for update/save-help, and fixing existing help tests for
Linux.
2016-11-04 16:39:57 -07:00
Kirk Munro 244827a4aa Added -Top/-Bottom params to Sort-Object for Top/Bottom N sort and many Pester tests (#2518)
* Added -Top/-Bottom params to Sort-Object for Top/Bottom N sorts; added many Pester tests

* updated changelog

* updated CHANGELOG.md

* replaced Get-Service with Get-Alias in Pester tests

* improved performance for -unique -top/-bottom, changed according to PR feedback

* added newlines to end of two files

* Removed whitespace changes

* Missed 2 whitespace changes to undo in last commit

* Updated to try to resolve merge issue

* change heapify return type, cleaned up test code

* unique top/bottom N sorts are now 2-3 times faster

* code cleanup (removed unused vars, simplified logic)
2016-11-04 14:09:48 -07:00
Florian Feldhaus 9ccd778ed6 Enable WebRequestPSCmdlet to not validate HTTPS certificates (#2006)
* Enable WebRequestPSCmdlet to not validate HTTPS certificates

Added switch parameter IgnoreCertificateCheck to WebRequestPSCmdlet to enable Invoke-WebRequest and Invoke-RestMethod to not validate the HTTPS certificate of the server if required.

* Changed IgnoreCertificateCheck parameter name to NoCertificateCheck

Changed the switch parameter IgnoreCertificateCheck to NoCertificateCheck for WebRequestPSCmdlet to enable Invoke-WebRequest and Invoke-RestMethod.

* Changed NoCertificateCheck parameter name to SkipCertificateCheck

Changed the switch parameter NoCertificateCheck to SkipCertificateCheck for WebRequestPSCmdlet to enable Invoke-WebRequest and Invoke-RestMethod.

* Added test for SkipCertificateCheck parameter

Validation of SkipCertificateCheck parameter in Invoke-WebRequest and Invoke-RestMethod. First validating, that exception is thrown for HTTPS URI with expired certificate. Then validating, that no exception is thrown if SkipCertificateCheck parameter is used. HEAD method must be used for Invoke-RestMethod to not return any body. Invoke-RestMethod can't parse the HTML returned when using GET method.

* Updated test for SkipCertificateCheck parameter to use ExecuteWebCommand function
2016-11-03 14:29:17 -07:00
Jason Shirk c8c55b7ce7 Fix NullReferenceException in binder (#2591)
There was a NullReferenceException after turning on constrained language mode
if creating a binding on a thread with no runspace.

The fix is to assume if there is no runspace that we are not in constrained language
mode, and also generate a binding restriction that assumes the same.
2016-11-03 14:15:58 -07:00
Charu Bassi 85825e2b0b Fix Resolve-Path -LiteralPath for drive paths (#2572)
Resolving #2570.
Ignore drive paths in the check. If the input is a drive path,
then "\" is passed as the path to GetDriveQualifiedPath with drive info.
Since, the path here starts with "\", treatAsRelative is set to false
which prevents further formatting of this path.
The check is only valid for PSDrives with root path equals to UNC paths or the paths
in unix.
2016-11-01 18:01:52 -07:00
Jason Shirk b7c04df47b Update NativeCommandProcessor.Tests.ps1
Fix logic error in skipping
2016-11-01 14:15:31 -07:00
Jason Shirk (POWERSHELL) 9b20875d6f Test that pipeline isn't blocked when running windows exes 2016-11-01 14:15:31 -07:00
Steve Lee 1851e1a5dc fixed test on Windows, also should have been pending due to another bug (#2580) 2016-11-01 10:53:19 -07:00
iSazonov 5aee4ba85e Fix Select-Object to approve UX and fix return a property named * (#2421)
There are mainly 2 changes:
1. When '-ExcludeProperty' is specified but '-Property' is not, use "*" as the default value for '-Property'.
2. Allow 'Select-Object -Property noexist-name' to return a PSObject with property noexist-name, unless noexist-name itself contains wildcards.
2016-11-01 10:04:44 -07:00