Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .vsts-ci/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
pr:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
Expand Down
22 changes: 22 additions & 0 deletions .vsts-ci/mac.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
pr:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
Expand Down
16 changes: 16 additions & 0 deletions .vsts-ci/spelling.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- master
- release*
paths:
include:
- '*.md'
pr:
branches:
include:
- master
- release*
paths:
include:
- '*.md'

resources:
- repo: self
Expand Down
22 changes: 22 additions & 0 deletions .vsts-ci/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
pr:
branches:
include:
- master
- release*
paths:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/spelling.yml
queue:
name: Hosted VS2017
parallel: 2 # Limit to two agents at a time
Expand Down
2 changes: 1 addition & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ function New-PSOptions {
# Get the Options of the last build
function Get-PSOptions {
param(
[Parameter(HelpMessage='Defaults to New-PSOption if a build has not ocurred.')]
[Parameter(HelpMessage='Defaults to New-PSOption if a build has not occurred.')]
[switch]
$DefaultToNew
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3519,22 +3519,87 @@ protected override bool ProviderSupportsShouldProcess

#region Command code

private Collection<PathInfo> GetResolvedPaths(string path)
{
Collection<PathInfo> results = null;
try
{
results = SessionState.Path.GetResolvedPSPathFromPSPath(path, CmdletProviderContext);
}
catch (PSNotSupportedException notSupported)
{
WriteError(
new ErrorRecord(
notSupported.ErrorRecord,
notSupported));
}
catch (DriveNotFoundException driveNotFound)
{
WriteError(
new ErrorRecord(
driveNotFound.ErrorRecord,
driveNotFound));
}
catch (ProviderNotFoundException providerNotFound)
{
WriteError(
new ErrorRecord(
providerNotFound.ErrorRecord,
providerNotFound));
}
catch (ItemNotFoundException pathNotFound)
{
WriteError(
new ErrorRecord(
pathNotFound.ErrorRecord,
pathNotFound));
}

return results;
}

/// <summary>
/// Moves the specified item to the specified destination
/// </summary>
protected override void ProcessRecord()
{
if (SuppressWildcardExpansion)
{
RenameItem(Path, literalPath: true);
return;
}

Collection<PathInfo> resolvedPaths = GetResolvedPaths(Path);

if (resolvedPaths == null)
{
return;
}

if (resolvedPaths.Count == 1)
{
RenameItem(resolvedPaths[0].Path, literalPath: true);
}
else
{
RenameItem(WildcardPattern.Unescape(Path), literalPath: true);
}
}

private void RenameItem(string path, bool literalPath = false)
{
CmdletProviderContext currentContext = CmdletProviderContext;
currentContext.SuppressWildcardExpansion = literalPath;

try
{
if (!InvokeProvider.Item.Exists(Path, currentContext))
if (!InvokeProvider.Item.Exists(path, currentContext))
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
NavigationResources.RenameItemDoesntExist,
Path);
path);

WriteError(
new ErrorRecord(
Expand Down Expand Up @@ -3580,7 +3645,7 @@ protected override void ProcessRecord()
bool isCurrentLocationOrAncestor = false;
try
{
isCurrentLocationOrAncestor = SessionState.Path.IsCurrentLocationOrAncestor(_path, currentContext);
isCurrentLocationOrAncestor = SessionState.Path.IsCurrentLocationOrAncestor(path, currentContext);
}
catch (PSNotSupportedException notSupported)
{
Expand Down Expand Up @@ -3621,7 +3686,7 @@ protected override void ProcessRecord()
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
NavigationResources.RenamedItemInUse,
Path);
path);

WriteError(
new ErrorRecord(
Expand All @@ -3635,12 +3700,12 @@ protected override void ProcessRecord()

currentContext.PassThru = PassThru;

tracer.WriteLine("Rename {0} to {1}", Path, NewName);
tracer.WriteLine("Rename {0} to {1}", path, NewName);

try
{
// Now do the rename
InvokeProvider.Item.Rename(Path, NewName, currentContext);
InvokeProvider.Item.Rename(path, NewName, currentContext);
}
catch (PSNotSupportedException notSupported)
{
Expand Down Expand Up @@ -3674,7 +3739,7 @@ protected override void ProcessRecord()
pathNotFound));
return;
}
} // ProcessRecord
}
#endregion Command code

} // RenameItemCommand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@
<value>The RepetitionInterval parameter cannot have a value of zero unless the RepetitionDuration parameter also has a zero value. A zero value removes repetition behavior from the Job trigger.</value>
</data>
<data name="ErrorRenamingScheduledJob" xml:space="preserve">
<value>An error occured while attempting to rename scheduled job from {0} to {1}.</value>
<value>An error occurred while attempting to rename scheduled job from {0} to {1}.</value>
</data>
<data name="ErrorRenamingScheduledJobWithMessage" xml:space="preserve">
<value>An error occured while attempting to rename scheduled job from {0} to {1} with error message: {2}.</value>
<value>An error occurred while attempting to rename scheduled job from {0} to {1} with error message: {2}.</value>
</data>
<data name="BrokenRenamingScheduledJob" xml:space="preserve">
<value>An unrecoverable error occurred while renaming the scheduled job from {0} to {1}. The scheduled job will be removed.</value>
Expand Down
4 changes: 2 additions & 2 deletions src/Schemas/PSMaml/ManagedDeveloper.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<annotation>
<documentation>
This schema describes MAML, the Microsoft Assistance Markup Language.
MAML is intended for software documentation. In particular, it is
intended to accomodate the needs of Microsoft documentation.
MAML is intended for software documentation. In particular, it is
intended to accommodate the needs of Microsoft documentation.
</documentation>
<documentation>
The schema is broken into three main areas: end user, developer and
Expand Down
4 changes: 2 additions & 2 deletions src/Schemas/PSMaml/ManagedDeveloperStructure.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<annotation>
<documentation>
This schema describes MAML, the Microsoft Assistance Markup Language.
MAML is intended for software documentation. In particular, it is
intended to accomodate the needs of Microsoft documentation.
MAML is intended for software documentation. In particular, it is
intended to accommodate the needs of Microsoft documentation.
</documentation>
<documentation>
The schema is broken into three main areas: end user, developer and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,13 @@ private Collection<PathInfo> ResolveDriveQualifiedPath(

s_pathResolutionTracer.WriteLine("Path is DRIVE-QUALIFIED");

string relativePath = GetDriveRootRelativePathFromPSPath(path, context, true, out drive, out providerInstance);
string relativePath =
GetDriveRootRelativePathFromPSPath(
path,
context,
!context.SuppressWildcardExpansion,
out drive,
out providerInstance);

Dbg.Diagnostics.Assert(
drive != null,
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/Host/HostUtilities.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Describe "InvokeOnRunspace method as nested command" -tags "Feature" {
}
}

Describe "InvokeOnRunspace method on remote runspace" -tags "Feature" {
Describe "InvokeOnRunspace method on remote runspace" -tags "Feature","RequireAdminOnWindows" {

BeforeAll {

Expand Down
8 changes: 3 additions & 5 deletions test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Describe "TabCompletion" -Tags CI {
## if $PSHOME contains a space tabcompletion adds ' around the path
@{ inputStr = 'cd $pshome\Modu'; expected = if($PSHOME.Contains(' ')) { "'$(Join-Path $PSHOME 'Modules')'" } else { Join-Path $PSHOME 'Modules' }; setup = $null }
@{ inputStr = 'cd "$pshome\Modu"'; expected = "`"$(Join-Path $PSHOME 'Modules')`""; setup = $null }
@{ inputStr = '$PSHOME\System.Management.Au'; expected = Join-Path $PSHOME 'System.Management.Automation.dll'; setup = $null }
@{ inputStr = '$PSHOME\System.Management.Au'; expected = if($PSHOME.Contains(' ')) { "`& '$(Join-Path $PSHOME 'System.Management.Automation.dll')'" } else { Join-Path $PSHOME 'System.Management.Automation.dll'; setup = $null }}
@{ inputStr = '"$PSHOME\System.Management.Au"'; expected = "`"$(Join-Path $PSHOME 'System.Management.Automation.dll')`""; setup = $null }
@{ inputStr = '& "$PSHOME\System.Management.Au"'; expected = "`"$(Join-Path $PSHOME 'System.Management.Automation.dll')`""; setup = $null }
## tab completion AST-based tests
Expand Down Expand Up @@ -1045,7 +1045,7 @@ dir -Recurse `
}
}

Describe "Tab completion tests with remote Runspace" -Tags Feature {
Describe "Tab completion tests with remote Runspace" -Tags Feature,RequireAdminOnWindows {
BeforeAll {
if ($IsWindows) {
$session = New-RemoteSession
Expand Down Expand Up @@ -1116,9 +1116,7 @@ Describe "WSMan Config Provider tab complete tests" -Tags Feature,RequireAdminOn
$res = TabExpansion2 -inputScript $path -cursorColumn $path.Length
$listener = Get-ChildItem WSMan:\localhost\Listener
$res.CompletionMatches.Count | Should -Be $listener.Count
for ($i = 0; $i -lt $res.CompletionMatches.Count; $i++) {
$res.CompletionMatches[$i].ListItemText | Should -Be $listener[$i].Name
}
$res.CompletionMatches.ListItemText | Should -BeIn $listener.Name
}

It "Tab completion gets dynamic parameters for '<path>' using '<parameter>'" -TestCases @(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@
Describe "Remote module tests" -Tags 'Feature','RequireAdminOnWindows' {

BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if (!$IsWindows) {

if (!$IsWindows)
{
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
$PSDefaultParameterValues["it:skip"] = $true
} else {
$pssession = New-RemoteSession
# pending https://github.com/PowerShell/PowerShell/issues/4819
# $cimsession = New-RemoteSession -CimSession
return
}

$pssession = New-RemoteSession
# pending https://github.com/PowerShell/PowerShell/issues/4819
# $cimsession = New-RemoteSession -CimSession
}

AfterAll {
$global:PSDefaultParameterValues = $originalDefaultParameterValues

if (!$IsWindows)
{
$global:PSDefaultParameterValues = $originalDefaultParameterValues
return
}

if ($pssession -ne $null) { Remove-PSSession $pssession -ErrorAction SilentlyContinue }
}

It "Get-Module fails if not using -ListAvailable with '<parameter>'" -TestCases @(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Describe "Basic Function Provider Tests" -Tags "CI" {
}

It "Fails to rename not existing function" {
{ Rename-Item $nonExistingFunction -NewName $newName -ErrorAction Stop } | Should -Throw -ErrorId "InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand"
{ Rename-Item $nonExistingFunction -NewName $newName -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.RenameItemCommand"
}

It "Fails to rename function which is Constant" {
Expand All @@ -113,8 +113,8 @@ Describe "Basic Function Provider Tests" -Tags "CI" {
}

It "Fails to rename function which is ReadOnly" {
Set-Item $nonExistingFunction -Options "ReadOnly"
{ Rename-Item $nonExistingFunction -NewName $newName -ErrorAction Stop } | Should -Throw -ErrorId "InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand"
Set-Item $nonExistingFunction -Options "ReadOnly" -Value $functionValue
{ Rename-Item $nonExistingFunction -NewName $newName -ErrorAction Stop } | Should -Throw -ErrorId "CannotRenameFunction,Microsoft.PowerShell.Commands.RenameItemCommand"
}

It "Renames ReadOnly function when -Force parameter is on" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try
Enable-Testhook -testhookName TestStopComputer

# TEST START HERE
Describe "Rename-Computer" -Tag Feature {
Describe "Rename-Computer" -Tag Feature,RequireAdminOnWindows {
# if we throw in BeforeEach, the test will fail and the stop will not be called
BeforeEach {
if ( ! (Test-TesthookIsSet -testhookName $RenameTesthook) ) {
Expand Down
Loading