Skip JumpList on NanoServer and IoT (#10164)

This commit is contained in:
Dongbo Wang 2019-07-15 17:02:18 -07:00 committed by Travis Plunk
parent 5ef258ef68
commit a4e397697c
4 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,61 @@
parameters:
vmImage: 'win1803'
jobName: 'Nanoserver_Tests'
continueOnError: false
jobs:
- job: ${{ parameters.jobName }}
variables:
scriptName: ${{ parameters.scriptName }}
pool:
vmImage: ${{ parameters.vmImage }}
displayName: ${{ parameters.jobName }}
steps:
- script: |
set
displayName: Capture environment
condition: succeededOrFailed()
- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
downloadType: specific
itemPattern: |
build/**/*
downloadPath: '$(System.ArtifactsDirectory)'
- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture artifacts directory'
continueOnError: true
- pwsh: |
Install-module pester -Scope CurrentUser -Force
displayName: 'Install Pester'
continueOnError: true
- pwsh: |
Import-Module .\tools\ci.psm1
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
$options = (Get-PSOptions)
$path = split-path -path $options.Output
Write-Verbose "Path: '$path'" -Verbose
$rootPath = split-Path -path $path
Expand-Archive -Path '$(System.ArtifactsDirectory)\build\build.zip' -DestinationPath $rootPath -Force
Invoke-Pester -Path ./test/nanoserver -OutputFormat NUnitXml -OutputFile ./test-nanoserver.xml
displayName: Test
condition: succeeded()
- task: PublishTestResults@2
condition: succeededOrFailed()
displayName: Publish Nanoserver Test Results **\test*.xml
inputs:
testRunner: NUnit
testResultsFiles: '**\test*.xml'
testRunTitle: nanoserver
mergeTestResults: true
failTaskOnFailedTests: true

View File

@ -73,6 +73,8 @@ stages:
parameters:
pool: 'Hosted VS2017'
- template: templates/nanoserver.yml
- stage: PackagingWin
displayName: Packaging for Windows
dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it

View File

@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
using System.Management.Automation;
using System.Reflection;
using System.Threading;
@ -20,6 +21,13 @@ namespace Microsoft.PowerShell
// not over-optimize this and always create the JumpList as a non-blocking background STA thread instead.
internal static void CreateRunAsAdministratorJumpList()
{
// The STA apartment state is not supported on NanoServer and Windows IoT.
// Plus, there is not need to create jump list in those environment anyways.
if (Platform.IsNanoServer || Platform.IsIoT)
{
return;
}
// Some COM APIs are implicitly STA only, therefore the executing thread must run in STA.
var thread = new Thread(() =>
{

View File

@ -0,0 +1,15 @@
Describe "Verify PowerShell Runs" {
BeforeAll{
$options = (Get-PSOptions)
$path = split-path -path $options.Output
Write-Verbose "Path: '$path'" -Verbose
$rootPath = split-Path -path $path
$mount = 'C:\powershell'
$container = 'mcr.microsoft.com/powershell:nanoserver-1803'
}
it "Verify Version " {
$version = docker run --rm -v "${rootPath}:${mount}" ${container} "${mount}\publish\pwsh" -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
$version | Should -match '^7\.'
}
}