Skip to content
Closed
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
2 changes: 1 addition & 1 deletion docker/release/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV PS_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+\.\d+)?$' )) {throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+\.\d+)?$"' -f $env:PS_VERSION)}
RUN if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) {throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION)}
RUN Invoke-WebRequest $Env:PS_DOWNLOAD_URL -OutFile powershell.zip

RUN Expand-Archive powershell.zip -DestinationPath \PowerShell
Expand Down
16 changes: 8 additions & 8 deletions docker/tests/container.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "Build Linux Containers" -Tags 'Build', 'Linux' {
[Parameter(Mandatory=$true)]
[string]
$name,

[Parameter(Mandatory=$true)]
[string]
$path
Expand All @@ -33,7 +33,7 @@ Describe "Build Windows Containers" -Tags 'Build', 'Windows' {
[Parameter(Mandatory=$true)]
[string]
$name,

[Parameter(Mandatory=$true)]
[string]
$path
Expand Down Expand Up @@ -62,19 +62,19 @@ Describe "Linux Containers run PowerShell" -Tags 'Behavior', 'Linux' {
Remove-Item $testContext.resolvedXmlPath -ErrorAction SilentlyContinue
Remove-Item $testContext.resolvedLogPath -ErrorAction SilentlyContinue
}

it "Get PSVersion table from $(Get-RepoName):<Name>" -TestCases $script:linuxContainerTests -Skip:$script:skipLinux {
param(
[Parameter(Mandatory=$true)]
[string]
$name,

[Parameter(Mandatory=$true)]
[string]
$path
)

Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name -RepoName (Get-RepoName) | should be '6.0.0-beta'
Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name -RepoName (Get-RepoName) | should be '6.0.0-rc'
}
}

Expand All @@ -87,18 +87,18 @@ Describe "Windows Containers run PowerShell" -Tags 'Behavior', 'Windows' {
Remove-Item $testContext.resolvedXmlPath -ErrorAction SilentlyContinue
Remove-Item $testContext.resolvedLogPath -ErrorAction SilentlyContinue
}

it "Get PSVersion table from $(Get-RepoName):<Name>" -TestCases $script:windowsContainerTests -skip:$script:skipWindows {
param(
[Parameter(Mandatory=$true)]
[string]
$name,

[Parameter(Mandatory=$true)]
[string]
$path
)

Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name -RepoName (Get-RepoName) | should be '6.0.0-beta'
Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name -RepoName (Get-RepoName) | should be '6.0.0-rc'
}
}
2 changes: 1 addition & 1 deletion docker/tests/containerTestCommon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Invoke-Docker
# Return a list of Linux Container Test Cases
function Get-LinuxContainer
{
foreach($os in 'amazonlinux','centos7','opensuse42.2','ubuntu14.04','ubuntu16.04')
foreach($os in 'centos7','ubuntu14.04','ubuntu16.04')
{
Write-Output @{
Name = $os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<value>Cannot bind positional parameters because no names were given.</value>
</data>
<data name="AmbiguousParameterSet" xml:space="preserve">
<value>Parameter set cannot be resolved using the specified named parameters.</value>
<value>Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a grammar expert, but the last part of this sentence reads weird to me. I know that were is used with plural nouns, so you would think that because parameters is used, it should be were, but I think the noun here is actually an insufficient number of parameters which is singular (the an gives it away) sort of like ...or an error was provided.. So it seems that it would be ...parameters was provided..

This is not blocking feedback.

Copy link
Contributor

@markekraus markekraus Nov 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveL-MSFT This is one of those weird English rules. a number of X-es are plural while the number of X-es is singular. In this case we are using an insufficient number of parameters and is the plural form of the phrase. https://en.oxforddictionaries.com/explore/number-of-people-is-or-are

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) Now I know who to ask to approve error messages.

Copy link
Collaborator

@iSazonov iSazonov Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markekraus Could you please look test failures? It seems HttpListener can not start on 8082 port in Describing Web cmdlets tests using the cmdlet's aliases. Also these tests is "alias" tests - I think we should remove its (we have separate test set for aliases).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iSazonov There is an open issue for tracking the HttpListener issue #5464.

</data>
<data name="MissingMandatoryParameter" xml:space="preserve">
<value>Cannot process command because of one or more missing mandatory parameters:{1}.</value>
Expand Down
2 changes: 1 addition & 1 deletion src/libpsl-native/src/followsymlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ char* FollowSymLink(const char* fileName)

if (realPath)
{
return strndup(realPath, strlen(realPath) + 1);
return strndup(realPath, strnlen(realPath, PATH_MAX));
}

// if the path wasn't resolved, use readlink
Expand Down
2 changes: 1 addition & 1 deletion src/libpsl-native/src/getfullyqualifiedname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ char *GetFullyQualifiedName()
}

// return the first canonical name in the list
fullName = strndup(info->ai_canonname, strlen(info->ai_canonname));
fullName = strndup(info->ai_canonname, strnlen(info->ai_canonname, NI_MAXHOST));

// only free info if getaddrinfo was successful
freeaddrinfo(info);
Expand Down
4 changes: 2 additions & 2 deletions src/libpsl-native/test/test-createsymlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEST_F(CreateSymLinkTest, SymLinkToFile)
std::string target = FollowSymLink(fileSymLink.c_str());
char buffer[PATH_MAX];
std::string expected = realpath(file, buffer);
EXPECT_EQ(target, expected);
EXPECT_EQ(expected, target);
}

TEST_F(CreateSymLinkTest, SymLinkToDirectory)
Expand All @@ -103,7 +103,7 @@ TEST_F(CreateSymLinkTest, SymLinkToDirectory)
std::string target = FollowSymLink(dirSymLink.c_str());
char buffer[PATH_MAX];
std::string expected = realpath(dir, buffer);
EXPECT_EQ(target, expected);
EXPECT_EQ(expected, target);
}

TEST_F(CreateSymLinkTest, SymLinkAgain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2740,22 +2740,22 @@ Describe "Validate Invoke-WebRequest and Invoke-RestMethod -InFile" -Tags "Featu
Describe "Web cmdlets tests using the cmdlet's aliases" -Tags "CI" {

BeforeAll {
$response = Start-HttpListener -Port 8082
$response = Start-HttpListener -Port 8079
}

AfterAll {
$null = Stop-HttpListener -Port 8082
$null = Stop-HttpListener -Port 8079
$response.PowerShell.Dispose()
}

It "Execute Invoke-WebRequest" {
$result = iwr "http://localhost:8082/PowerShell?test=response&output=hello" -TimeoutSec 5
$result = iwr "http://localhost:8079/PowerShell?test=response&output=hello" -TimeoutSec 5
$result.StatusCode | Should Be "200"
$result.Content | Should Be "hello"
}

It "Execute Invoke-RestMethod" {
$result = irm "http://localhost:8082/PowerShell?test=response&output={%22hello%22:%22world%22}&contenttype=application/json" -TimeoutSec 5
$result = irm "http://localhost:8079/PowerShell?test=response&output={%22hello%22:%22world%22}&contenttype=application/json" -TimeoutSec 5
$result.Hello | Should Be "world"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

Context "Import-CliXML" {
BeforeAll {
$gpsList = Get-Process powershell
$gpsList = Get-Process pwsh
$gps = $gpsList | Select-Object -First 1
$filePath = Join-Path $subFilePath 'gps.xml'

Expand Down Expand Up @@ -161,7 +161,9 @@
$fileContent | Should Not Be $null

$importedProcess = Import-Clixml $filePath
$importedProcess.ProcessName | Should Not BeNullOrEmpty
$gps.ProcessName | Should Be $importedProcess.ProcessName
$importedProcess.Id | Should Not BeNullOrEmpty
$gps.Id | Should Be $importedProcess.Id
}

Expand All @@ -173,7 +175,9 @@
$fileContent | Should Not Be $null

$importedProcess = Import-Clixml $filePath
$importedProcess.ProcessName | Should Not BeNullOrEmpty
$gps.ProcessName | Should Be $importedProcess.ProcessName
$importedProcess.Id | Should Not BeNullOrEmpty
$gps.Id | Should Be $importedProcess.Id
}

Expand Down
43 changes: 31 additions & 12 deletions tools/appveyor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,31 @@ function Invoke-AppVeyorFull
# Implements the AppVeyor 'build_script' step
function Invoke-AppVeyorBuild
{
# check to be sure our test tags are correct
$result = Get-PesterTag
if ( $result.Result -ne "Pass" ) {
$releaseTag = Get-ReleaseTag
# check to be sure our test tags are correct
$result = Get-PesterTag
if ( $result.Result -ne "Pass" ) {
$result.Warnings
throw "Tags must be CI, Feature, Scenario, or Slow"
}
}

if(Test-DailyBuild)
{
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore
}
if(Test-DailyBuild)
{
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -ReleaseTag $releaseTag
}

Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release'
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $releaseTag
}

# Implements the AppVeyor 'install' step
function Invoke-AppVeyorInstall
{
# Make sure we have all the tags
Sync-PSTags -AddRemoteIfMissing
$releaseTag = Get-ReleaseTag
if($env:APPVEYOR_BUILD_NUMBER)
{
Update-AppveyorBuild -Version "$(Get-PSVersion -OmitCommitId)-$env:APPVEYOR_BUILD_NUMBER"
Update-AppveyorBuild -Version $releaseTag
}

if(Test-DailyBuild){
Expand Down Expand Up @@ -420,14 +422,31 @@ function Get-PackageName
return $name
}

function Get-ReleaseTag
{
$metaDataPath = Join-Path -Path $PSScriptRoot -ChildPath 'metadata.json'
$metaData = Get-Content $metaDataPath | ConvertFrom-Json

$releaseTag = $metadata.NextReleaseTag
if($env:APPVEYOR_BUILD_NUMBER)
{
$releaseTag = $releaseTag.split('.')[0..2] -join '.'
$releaseTag = $releaseTag+'.'+$env:APPVEYOR_BUILD_NUMBER
}

return $releaseTag
}

# Implements AppVeyor 'on_finish' step
function Invoke-AppveyorFinish
{
try {
$releaseTag = Get-ReleaseTag

$packageParams = @{}
if($env:APPVEYOR_BUILD_VERSION)
{
$packageParams += @{Version=$env:APPVEYOR_BUILD_VERSION}
$packageParams += @{ReleaseTag=$releaseTag}
}

# Build packages
Expand All @@ -454,7 +473,7 @@ function Invoke-AppveyorFinish
}
else
{
$previewVersion = (git describe --abbrev=0).Split('-')
$previewVersion = $releaseTag.Split('-')
$previewPrefix = $previewVersion[0]
$previewLabel = $previewVersion[1].replace('.','')

Expand Down
15 changes: 14 additions & 1 deletion tools/install-powershell.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#
.Synopsis
Install PowerShell Core on Windows.
Install PowerShell Core on Windows, Linux or macOS.
.DESCRIPTION
By default, the latest PowerShell Core release package will be installed.
If '-Daily' is specified, then the latest PowerShell Core daily package will be installed.
Expand Down Expand Up @@ -156,6 +156,19 @@ try {
Move-Item -Path $contentPath -Destination $Destination
}

# Edit icon to disambiguate daily builds.
if ($IsWinEnv -and $Daily.IsPresent) {
if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) {
Write-Verbose "Install RCEdit for modifying exe resources" -Verbose
$rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe"
New-Item -Path "~/.rcedit" -Type Directory -Force > $null
Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl
}

Write-Verbose "Change icon to disambiguate it from a released installation" -Verbose
& "~/.rcedit/rcedit-x64.exe" "$Destination\pwsh.exe" --set-icon "$Destination\assets\Powershell_av_colors.ico"
}

## Change the mode of 'pwsh' to 'rwxr-xr-x' to allow execution
if (-not $IsWinEnv) { chmod 755 $Destination/pwsh }

Expand Down
3 changes: 2 additions & 1 deletion tools/metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"ReleaseTag": "v6.0.0-beta.9"
"ReleaseTag": "v6.0.0-rc",
"NextReleaseTag": "v6.1.0-preview.1"
}
1 change: 1 addition & 0 deletions tools/releaseBuild/macOS/PowerShellPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if ($ReleaseTag)
Push-Location
try {
Set-Location /PowerShell
git submodule update --init --recursive --quiet
Import-Module "/PowerShell/build.psm1"
Import-Module "/PowerShell/tools/packaging"

Expand Down
28 changes: 21 additions & 7 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ OS Type: $($PSVersionTable.OS) </br>
}
}

function Get-ReleaseTag
{
$metaDataPath = Join-Path -Path $PSScriptRoot -ChildPath 'metadata.json'
$metaData = Get-Content $metaDataPath | ConvertFrom-Json

$releaseTag = $metadata.NextReleaseTag
if($env:TRAVIS_BUILD_NUMBER)
{
$releaseTag = $releaseTag.split('.')[0..2] -join '.'
$releaseTag = $releaseTag+'.'+$env:TRAVIS_BUILD_NUMBER
}

return $releaseTag
}

# This function retrieves the appropriate svg to be used when presenting
# the daily test run badge
# the location in azure is public readonly
Expand Down Expand Up @@ -171,15 +186,16 @@ if($Stage -eq 'Bootstrap')
}
elseif($Stage -eq 'Build')
{
$BaseVersion = (Get-PSVersion -OmitCommitId) + '-'
$releaseTag = Get-ReleaseTag

Write-Host -Foreground Green "Executing travis.ps1 `$isPR='$isPr' `$isFullBuild='$isFullBuild' - $commitMessage"
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions))

$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
try {
## We use CrossGen build to run tests only if it's the daily build.
Start-PSBuild -CrossGen -PSModuleRestore
Start-PSBuild -CrossGen -PSModuleRestore -ReleaseTag $releaseTag
}
finally{
$ProgressPreference = $originalProgressPreference
Expand Down Expand Up @@ -235,12 +251,10 @@ elseif($Stage -eq 'Build')
}

if ($createPackages) {

$packageParams = @{}
if($env:TRAVIS_BUILD_NUMBER)
{
$version = $BaseVersion + $env:TRAVIS_BUILD_NUMBER
$packageParams += @{Version=$version}
}
$packageParams += @{ReleaseTag=$releaseTag}

# Only build packages for branches, not pull requests
$packages = @(Start-PSPackage @packageParams -SkipReleaseChecks)
# Packaging AppImage depends on the deb package
Expand Down