diff --git a/.azure-pipelines/jobs/test-windows.yml b/.azure-pipelines/jobs/test-windows.yml index ee869c87c89..17e98f16db2 100644 --- a/.azure-pipelines/jobs/test-windows.yml +++ b/.azure-pipelines/jobs/test-windows.yml @@ -9,9 +9,9 @@ jobs: vmImage: ${{ parameters.vmImage }} strategy: matrix: - Python27-x86: - python.version: '2.7' - python.architecture: x86 + #Python27-x86: + # python.version: '2.7' + # python.architecture: x86 Python37-x64: python.version: '3.7' python.architecture: x64 @@ -22,29 +22,29 @@ jobs: parameters: runIntegrationTests: true -- job: Test_Secondary - displayName: Test Secondary - # Don't run integration tests for these runs - # Run after Test_Primary so we don't devour time and jobs if tests are going to fail - dependsOn: Test_Primary - - pool: - vmImage: ${{ parameters.vmImage }} - strategy: - matrix: - # This is for Windows, so test x86 builds - Python35-x86: - python.version: '3.5' - python.architecture: x86 - Python36-x86: - python.version: '3.6' - python.architecture: x86 - Python37-x86: - python.version: '3.7' - python.architecture: x86 - maxParallel: 5 - - steps: - - template: ../steps/run-tests-windows.yml - parameters: - runIntegrationTests: false +#- job: Test_Secondary +# displayName: Test Secondary +# # Don't run integration tests for these runs +# # Run after Test_Primary so we don't devour time and jobs if tests are going to fail +# dependsOn: Test_Primary +# +# pool: +# vmImage: ${{ parameters.vmImage }} +# strategy: +# matrix: +# # This is for Windows, so test x86 builds +# Python35-x86: +# python.version: '3.5' +# python.architecture: x86 +# Python36-x86: +# python.version: '3.6' +# python.architecture: x86 +# Python37-x86: +# python.version: '3.7' +# python.architecture: x86 +# maxParallel: 5 +# +# steps: +# - template: ../steps/run-tests-windows.yml +# parameters: +# runIntegrationTests: false diff --git a/.azure-pipelines/steps/run-tests-windows.yml b/.azure-pipelines/steps/run-tests-windows.yml index 67d8ed96830..d4e9e428c72 100644 --- a/.azure-pipelines/steps/run-tests-windows.yml +++ b/.azure-pipelines/steps/run-tests-windows.yml @@ -8,6 +8,61 @@ steps: versionSpec: '$(python.version)' architecture: '$(python.architecture)' +- powershell: | + function Ensure-Installed($featureName) { + $feature = Get-WindowsFeature -Name $featureName + if ($feature.Installed) { + return + } + if ($feature.InstallState -Ne "Available") { + throw "$featureName is not available" + } + $result = Install-WindowsFeature -Name $featureName + if (!$result.Success) { + throw "Feature $featureName failed installation: $result" + } + if ($result.RestartNeeded -Eq "Yes") { + throw "Restart needed to install $featureName" + } + } + Ensure-Installed FS-iSCSITarget-Server + Ensure-Installed iSCSITarget-VSS-VDS + + # Allow connection on loopback interface. + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\iSCSI Target' -Name AllowLoopBack -Value 1 + + Start-Service msiscsi + $retry = 10 + do + { + $count = (Get-Service msiscsi | ? {$_.status -eq "Running"}).count + $retry-- + sleep -Milliseconds 500 + } until ($count -Eq 0 -or $retry -Eq 0) + + $service = Get-Service msiscsi + if ($service.Status -Ne "Running") { + throw "msiscsi not running" + } + + #net start MSiSCSI + Get-NetFirewallServiceFilter -Service msiscsi | Enable-NetFirewallRule + + New-IscsiVirtualDisk -ComputerName localhost -Path ramdisk:RAMDISK1.vhdx -Size 1GB + New-IscsiServerTarget Target1 -ComputerName localhost -InitiatorId "IQN:*" + Add-IscsiVirtualDiskTargetMapping -ComputerName localhost -TargetName Target1 -Path ramdisk:RAMDISK1.vhdx -Lun 1 + + New-IscsiTargetPortal -TargetPortalAddress 127.0.0.1 + Get-IscsiTarget | Connect-IscsiTarget + Get-IscsiConnection | Get-Disk | Set-Disk -IsOffline $False + Get-IscsiConnection | Get-Disk | Initialize-Disk -PartitionStyle MBR + Get-IscsiConnection | Get-Disk | New-Partition -UseMaximumSize -AssignDriveLetter -DriveLetter R + Get-IscsiConnection | Get-Disk | Format-Volume -FileSystem NTFS -NewFileSystemLabel Temp -Confirm:$False + displayName: Test + +- script: exit 1 + displayName: Early return + - powershell: | Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2026036 -OutFile adksetup.exe ./adksetup.exe /features OptionId.WindowsPerformanceToolkit /log adk-setup.log /ceip off /installpath "C:\Program Files (x86)\Windows Kits\10\" @@ -39,6 +94,8 @@ steps: --wpr-profile=GeneralProfile.verbose --wpr-profile=CPU.verbose --wpr-output=traces/wpr-result.etl + env: + TEMP: "R:\\" displayName: Tox run unit tests - script: