Commit graph

5323 commits

Author SHA1 Message Date
Ilya 6a68262ba2 Reformat Measure-Object test (#4972)
Remove multiple tabs and formatting issues.
2017-10-03 07:39:51 +04:00
James Truher [MSFT] f69b760f2b Be sure to change psdefaultparametervalue in the global scope (#4977)
* Be sure that you change psdefaultparametervalue in the global scope

* [Feature]
2017-10-02 16:58:47 -07:00
Mark Kraus 15a6c5748b Replace httpbin.org/gzip Tests with WebListener and Re-Enable Deflate Tests (#4948)
* Add Gzip and Deflate Support to WebListener

* [Feature] Run Feature tests

* [Feature] Address PR Feedback

* [Feature] Re-Run CI

* [feature] Update WebListener Index page

* [Feature] Run Feature tests

* [Feature] Re-run CI
2017-10-02 13:46:53 -07:00
Steve Lee 74df9c2d46 added instructions to get permission to use assets (#4938) 2017-10-02 13:44:41 -07:00
Aditya Patwardhan 1e271ea187 Add Remoting and Job tests (#4928) 2017-10-02 13:43:43 -07:00
Steve Lee d73e97464c Fix incorrect position of a parameter which resulted in the args passed as input instead of as args (#4963) 2017-10-02 12:15:42 -07:00
Dongbo Wang fa170a7e00 Suppress the output of building test tools in Compress-TestContent (#4957)
When uploading CodeCoverage artifacts, `Compress-TestContent` is called which calls `Publish-PSTestTools` to build test tools. The build output was captured by `$codeCoverageArtifacts` which causes `Push-AppveyorArtifact` to spit out a lot of errors. The issue is fixed by this change.
2017-10-02 12:14:19 -07:00
Chunqing Chen 69bce66cf8 add tests for get-command -ShowCommandInfo (#4906) 2017-10-02 10:54:06 -07:00
Jeffrey Snover d8a075e484 Provide the correct form for foreach when there is an error. (#4950)
* Update ParserStrings.resx

* Provide the proper form for foreach

* added "{...}"
2017-10-02 10:12:52 -07:00
Steve Lee 2e901e53c3 fix powershell -version and help (#4958)
PowerShell -v  behavior updated to align with other tools like git, curl, and bash where args after  -v  are silently ignored.

Built-in help updated to reflect changes we've made to the console host in PSCore6 removing unsupported parameters.

* [feature]
removed test that is no longer valid due to change in -version behavior to return error

* [feature]
fixed `-v X` so that it errors out correctly with proper exit code
updated test to catch this

* [feature]
address PR feedback

* [feature]
make -v have behavior consistent with other tools like git, curl, bash where args after -v are ignored
removed duplicate but not exactly help text that wasn't being used in the resource file
removed parameters from help that are not support in PSCore6
2017-10-01 07:39:18 +04:00
Steve Lee a82f6376ab Change CRLF to LF for files that are already in repository (#4956) 2017-09-29 17:43:57 -07:00
Dongbo Wang a4b8dd0a23 Remove Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll (#4868)
The code in `AssemblyLoadContext.dll` doesn't need to be in a separate DLL anymore.
S.M.A.dll depends on `AssemblyLoadContext.dll`, so keeping that code out of S.M.A.dll doesn't help make S.M.A smaller size or less dependent. So the code in `AssemblyLoadContext.dll` is moved to `S.M.A.dll` and then we remove `AssemblyLoadContext.dll`.

The changes are:
- Move `CorePsAssemblyLoadContext.cs` to `src\S.M.A\CoreCLR\`
- Update `CorePsAssemblyLoadContext.cs` to get the test took moved to `Utils.InternalTestHooks` and update tests
- Update `build.psm1` and `.csproj` accrodingly
- Update `pwrshcommon.cpp` to remove `AssemblyLoadContext.dll` from the TPA list.
- `S.M.A.AssemblyExtensions` is removed as `PackageManagement` has finished their move to .NET Core 2.0. (I will work with Bryan to get the latest version uploaded to powershell-core)
2017-09-29 17:26:55 -07:00
Steve Lee 2639cd89ce Autocorrected CRLF to LF (#4943)
Also, fix `Parser.Tests.ps1` after correcting CRLF.
2017-09-29 16:28:15 -07:00
Steve Lee 8fdd68fbaa [feature] (#4954)
remove unnecessary error messages from output
2017-09-29 14:35:13 -07:00
Ilya 757c6b5f39 Write an error for powershell -version 2 (#4931)
Write an error for powershell -version <any value>
2017-09-29 23:20:28 +04:00
Jeffrey Snover b9845d5ec1 Add a new line to 'CommandNotFoundException' error string (#4934)
We're here at PowerShell Unplugged at Ignite, and this error message could *really* use a new line!
2017-09-29 12:16:05 -07:00
Chunqing Chen e3a004c036 Change PS to load the assembly with 'Assembly.LoadFrom' before 'Assembly.Load' when the file path is given (#4196)
It's to solve a side-by-side problem we have with powershell core. If a .NET Core version assembly has the same name as it's .NET ancestor in GAC, then even if you specify the file path to `Import-Module`, powershell core will still load the one in GAC because it tries 'Assembly.Load' first.
Now we change it to use `Assembly.LoadFrom` first when a file path is given, so it works for modules that have side-by-side assemblies.
2017-09-29 11:58:56 -07:00
Ilya b07f24e3c9 Exclude '-Comobject' parameter of 'New-Object' on unsupported platforms (#4922) 2017-09-28 17:29:33 -07:00
Steve Lee 99e3fe586e Enable transcription of native commands on non-Windows (#4871)
Transcription was relying on reading the screen buffer to record output from native commands.
This resulted in an unhandled exception calling an unimplemented API on non-Windows.
The fix is to use redirected output/error if reading the screen buffer is not supported.
We check whether screen scraping is supported or not only when the application is running standalone.
2017-09-28 17:15:37 -07:00
Ilya 6e77537181 Get 'PSVersion' and 'GitCommitId' from the 'ProductVersion' attribute of assembly (#4863) 2017-09-28 09:27:43 -07:00
Chunqing Chen f83e238082 add get-help tests for alias (#4895) 2017-09-28 08:47:42 -07:00
Steve Lee ffa0701200 remove unsupported -showwindow switch (#4903) 2017-09-27 17:51:56 -07:00
James Truher [MSFT] d20d6a606a Add source files for coverage run (#4925)
A number of tests require the sources to be present in order to work correctly.
During cleanup be sure to remove any lingering powershell.exe processes because subsequent runs will not be able to update the test binaries.
2017-09-27 15:36:21 -07:00
Travis Plunk df1993aad0 Enable security flags in native compiler (#4933)
* Enable strong stack protection
Enable  address space layout randomization (ASLR) or PIE

* Enable strong stack protection
Enable  address space layout randomization (ASLR) or PIE
2017-09-27 15:35:23 -07:00
Travis Plunk 951e7527eb Add line secret suppression (#4935) 2017-09-27 15:34:12 -07:00
Travis Plunk f02e692a5d Fix credential scan issues (#4927)
* Add file secret suppression
* Add line secret suppression
* This will be consumed in the VSTS daily build.
* Renamed tests with ConvertTo-SecureString to avoid false positives
2017-09-27 11:54:22 -07:00
Mark Kraus a8e8b1f8e4 Change UserAgent App WindowsPowerShell -> PowerShell (#4914)
* Change UserAgent App WindowsPowerShell -> PowerShell

* [Feature] Run Feature tests

* [feature] Address PR Feedback with more precise assertion

* [feature] Address PR Feedback and add PSUserAgent Test

* [feature] add tag to describe block

* [feature] Remove describe block Add pattern to User-Agent specific tests

* [feature] Address PF Feedback

Remove all assertions for User-Agent that are not specifically about the User-Agent header.

* [feature] Match -> MatchExactly
2017-09-27 07:44:20 -07:00
Ilya 7c64c0ff25 Enable network Select-String test (#4921)
* Enable network string test

* Fix typo

* Use Get-Item to add PSDrive property
2017-09-27 07:20:02 +04:00
Travis Plunk 414d56170b Move release build definition into PowerShell (#4884)
* Add docker related files from PSRelease
base release docker builds on PowerShell release docker images

* ignore the PSRelease folder

* Add vstsbuild.sh wrapper of vstsbuild.ps1

* add vstsbuild.ps1

* Add build.json

* address PR feedbock
2017-09-26 14:02:55 -07:00
Mark Kraus dd02aac3d7 [feature] Fix TestValue to avoid double // in Urls (#4920)
•Adds logic in  Get-WebListenerUrl  to only apply the  TestValue  part of the path if it was supplied.
2017-09-26 09:05:55 +04:00
Steve Lee efbdea5cfe Fix importing remote module using version filters and added tests (#4900)
- Add tests for remote import-module
- Fix issue with remotely importing module where it was checking the version filter incorrectly against the proxy module
   - The filters are applied when importing the module remotely
   - After proxy module is generated it always has a module version of 1.0, so the filters will always fail when importing the proxy locally
2017-09-25 21:37:56 -07:00
Steve Lee 901a61bcc1 Enable auto EOL on git repo side, fix some character encoding issues (#4912)
- add ending newline to files missing it using:
`awk -F: '$2 ~ / no line terminators/ {print $1}' ~/text-files.txt | xargs -I{} sh -c 'printf "\n" >> "$1"' - {}`
- update .gitattributes to enforce autocrlf on all text files
- added <copyright> opening element where it was missing
removed file attribute pointing to wrong filename
- fix mis-encoded character to apostrophe
- replace incorrect encoding of copyright symbol with (c)
- updated file hashes in the test
2017-09-25 15:14:39 -07:00
Mark Kraus b30da378e7 Replace httpbin.org/delay Tests with WebListener (#4905) 2017-09-25 12:50:15 -07:00
Dongbo Wang bb3a840e76 Create generic Linux-x64 packages that are portable to all supported Linux distros (#4902) 2017-09-25 12:49:43 -07:00
Steve Lee 65415c3b9e allow * to be used in registry path for remove-item (#4866)
* [feature]
allow * to be used in registry path for remove-item

* [feature]
address PR feedback
have remove-item return error if -literalpath doesn't resolve to path

* [feature]
fix in navigation exposed an issue with WSMan Config Provider tests
that require -Recurse to be used otherwise a confirmation prompt shows
up
2017-09-25 10:15:38 -07:00
Mark Kraus 3237d43b26 Add ResponseHeadersVariable Parameter to Invoke-RestMethod (#4888)
* Add ResponseHeadersVariable to Invoke-RestMethod

* Add Tests for -ResponseHeadersVariable

* [Feature] Run Feature Tests

* Remove test to address PR feedback

* Alais HV -> RHV per request

* [Feature] Rerun CI

* [Feature] Remove Superfluous Assertion
2017-09-25 10:11:12 -07:00
Steve Lee 1c921cdf85 instructions to demo PowerShell Core on Raspbian (#4882) 2017-09-23 16:38:27 -07:00
Steve Lee 25a32284dd fix tests not setting back $psdefaultparametervalues back correctly (#4892) 2017-09-23 13:48:51 -07:00
James Truher [MSFT] 40577cb61f Add the timezone offset correctly (#4867)
It must be padded to 3 digits and prepended with either '-' or '+'
An incorrectly formatted string will not be able to be converted back to a datetime
2017-09-22 11:25:48 -07:00
Mark Kraus 65cf571b54 Replace httpbin.org/encoding Tests with WebListener (#4869) 2017-09-22 10:09:49 -07:00
Dongbo Wang c9cf843302 Fix a test issue that causes tests to be skipped in Travis CI run (#4891) 2017-09-21 11:54:48 -07:00
Ilya 93dc591025 Add 'ArgumentCompletionsAttribute' to support more argument completion scenarios (#4835)
- Add 'ArgumentCompletionsAttribute' to support argument completion for parameters that cannot have a ValidateSetAttribute.
- Use 'ArgumentCompletionsAttribute' for the '-Format' parameter of 'Get-Date' to enable useful argument compeltions.
2017-09-21 10:52:21 -07:00
Mark Kraus 84ac5218a1 Sort .spelling (#4876) 2017-09-21 10:26:17 -07:00
Mark Kraus 5e24352177 Initialize Headers Dictionary Only Once (#4853)
Switch the  WebResponseObject.Headers Dictionary to initialize once instead of creating a new dictionary on every get. Moved logic to  WebResponseHelper.GetHeadersDictionary()  as this code will be reused outside of  WebResponseObject .

* [Feature] Create Headers Only Once and Only If Called

* {feature] headers -> _headers

* [Feature] Move logic to WebResponseObject for reuse

This code has potential reuse in InvokeRestMethodCommand. Moving it to WebResponseHelper

* Add comment to address PR Feedback.
2017-09-21 12:41:57 +04:00
Dongbo Wang b81aeb4b64 Remove remainder of Utility.Activities (#4880) 2017-09-20 17:27:08 -07:00
Jonas Andersen f281671375 [Feature]Added Remove-service to Management module (#4858)
* [Feature]Remove-Service added to Management module

* [Feature]Capitalization

* [Feature]Added test cases for Remove-Service, Removed return value

* [Feature]Documentation from copy-paste code corrected to reflect the new function

* [Feature]Erroraction to be sure that an error is thrown in testcase

* [Feature]Removed direct reference to module in Pester test

* [Feature]Removed extra line in test

* [Feature]Use FullyQualifiedErrorId in Remove-Service test without a valid servicename

* [Feature]Exposed Remove-Service

* [Feature]Consistent casing, Named Arguments & Remove incorrect exception on cleanup

* [Feature]Remove-Service test should fail if the service was not removed

* [Feature]Cleanup comments & add Remove-Service for CI

* [Feature]Remove-Service in CI set in alphabetic order

* [Feature]Use ParameterSetName instead of _ParameterSetName and rewrite test which used the function class directly

* Revert "[Feature]Use ParameterSetName instead of _ParameterSetName and rewrite test which used the function class directly"

This reverts commit da41f7deb8.

* [Feature]Remove _ParameterSetName check & added test for pipeline input in
Set-Service
2017-09-20 17:24:39 -07:00
Travis Plunk 4c6ad4a133 Revert the changes to Pester from merged PR #4184 (#4881)
That PR incorrectly included Pester changes. Most likely because that individual did not update his submodules.
2017-09-20 16:08:29 -07:00
Steve Lee 646b6a6c41 Add setup steps for MacOS to use PSRP over SSH (#4872) 2017-09-20 15:09:13 -07:00
Dongbo Wang 4c29f5768d Fix bugs with expression redirected to file (#4847)
When handling file redirection for CommandExpression, we don't call 'DoComplete' on the underlying PipelineProcessor of the FileRedirection object, and thus the EndProcessing method is not called on Out-File, which causes different behaviors between <expr> > out.txt and <expr> | Out-File out.txt.

The fix is to make sure 'DoComplete' is called after the stream output has been written to the redirection pipe.

Also fix another issue

This PR also fixes an issue that could mess up restoring the original pipes. Here is the repro:

PS> 1 *> b.txt > a.txt; 123
Cannot perform operation because object "PipelineProcessor" has already been disposed
The root cause is that we don't always restore pipes in the correct order. Please see the code changes in Compiler.cs for more details.

Fix #4812
2017-09-20 14:39:02 -07:00
Staffan Gustafsson 916ef56eeb Call to CodeMethod returning void should work (#4850)
Fixes #4826
2017-09-20 14:37:43 -07:00