Skip to content

Commit 1f5c7e3

Browse files
committed
Azure pipeline test
1 parent 62d1cc5 commit 1f5c7e3

File tree

2 files changed

+86
-29
lines changed

2 files changed

+86
-29
lines changed

.azure-pipelines/jobs/test-windows.yml

+29-29
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
vmImage: ${{ parameters.vmImage }}
1010
strategy:
1111
matrix:
12-
Python27-x86:
13-
python.version: '2.7'
14-
python.architecture: x86
12+
#Python27-x86:
13+
# python.version: '2.7'
14+
# python.architecture: x86
1515
Python37-x64:
1616
python.version: '3.7'
1717
python.architecture: x64
@@ -22,29 +22,29 @@ jobs:
2222
parameters:
2323
runIntegrationTests: true
2424

25-
- job: Test_Secondary
26-
displayName: Test Secondary
27-
# Don't run integration tests for these runs
28-
# Run after Test_Primary so we don't devour time and jobs if tests are going to fail
29-
dependsOn: Test_Primary
30-
31-
pool:
32-
vmImage: ${{ parameters.vmImage }}
33-
strategy:
34-
matrix:
35-
# This is for Windows, so test x86 builds
36-
Python35-x86:
37-
python.version: '3.5'
38-
python.architecture: x86
39-
Python36-x86:
40-
python.version: '3.6'
41-
python.architecture: x86
42-
Python37-x86:
43-
python.version: '3.7'
44-
python.architecture: x86
45-
maxParallel: 5
46-
47-
steps:
48-
- template: ../steps/run-tests-windows.yml
49-
parameters:
50-
runIntegrationTests: false
25+
#- job: Test_Secondary
26+
# displayName: Test Secondary
27+
# # Don't run integration tests for these runs
28+
# # Run after Test_Primary so we don't devour time and jobs if tests are going to fail
29+
# dependsOn: Test_Primary
30+
#
31+
# pool:
32+
# vmImage: ${{ parameters.vmImage }}
33+
# strategy:
34+
# matrix:
35+
# # This is for Windows, so test x86 builds
36+
# Python35-x86:
37+
# python.version: '3.5'
38+
# python.architecture: x86
39+
# Python36-x86:
40+
# python.version: '3.6'
41+
# python.architecture: x86
42+
# Python37-x86:
43+
# python.version: '3.7'
44+
# python.architecture: x86
45+
# maxParallel: 5
46+
#
47+
# steps:
48+
# - template: ../steps/run-tests-windows.yml
49+
# parameters:
50+
# runIntegrationTests: false

.azure-pipelines/steps/run-tests-windows.yml

+57
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,61 @@ steps:
88
versionSpec: '$(python.version)'
99
architecture: '$(python.architecture)'
1010

11+
- powershell: |
12+
function Ensure-Installed($featureName) {
13+
$feature = Get-WindowsFeature -Name $featureName
14+
if ($feature.Installed) {
15+
return
16+
}
17+
if ($feature.InstallState -Ne "Available") {
18+
throw "$featureName is not available"
19+
}
20+
$result = Install-WindowsFeature -Name $featureName
21+
if (!$result.Success) {
22+
throw "Feature $featureName failed installation: $result"
23+
}
24+
if ($result.RestartNeeded -Eq "Yes") {
25+
throw "Restart needed to install $featureName"
26+
}
27+
}
28+
Ensure-Installed FS-iSCSITarget-Server
29+
Ensure-Installed iSCSITarget-VSS-VDS
30+
31+
# Allow connection on loopback interface.
32+
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\iSCSI Target' -Name AllowLoopBack -Value 1
33+
34+
Start-Service msiscsi
35+
$retry = 10
36+
do
37+
{
38+
$count = (Get-Service msiscsi | ? {$_.status -eq "Running"}).count
39+
$retry--
40+
sleep -Milliseconds 500
41+
} until ($count -Eq 0 -or $retry -Eq 0)
42+
43+
$service = Get-Service msiscsi
44+
if ($service.Status -Ne "Running") {
45+
throw "msiscsi not running"
46+
}
47+
48+
#net start MSiSCSI
49+
Get-NetFirewallServiceFilter -Service msiscsi | Enable-NetFirewallRule
50+
51+
New-IscsiVirtualDisk -ComputerName localhost -Path ramdisk:RAMDISK1.vhdx -Size 1GB
52+
$target = New-IscsiServerTarget Target1 -ComputerName localhost -InitiatorId "IQN:*"
53+
Add-IscsiVirtualDiskTargetMapping -ComputerName localhost -TargetName Target1 -Path ramdisk:RAMDISK1.vhdx -Lun 1
54+
55+
New-IscsiTargetPortal -TargetPortalAddress $target.TargetIqn
56+
Get-IscsiTarget | Connect-IscsiTarget
57+
Get-IscsiConnection | Get-Disk | Set-Disk -IsOffline $False
58+
Get-IscsiConnection | Get-Disk | Initialize-Disk -PartitionStyle MBR
59+
Get-IscsiConnection | Get-Disk | New-Partition -UseMaximumSize -AssignDriveLetter -DriveLetter R
60+
Get-IscsiConnection | Get-Disk | Format-Volume -FileSystem NTFS -NewFileSystemLabel Temp -Confirm:$False
61+
displayName: Test
62+
63+
- script: exit 1
64+
displayName: Early return
65+
1166
- powershell: |
1267
Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2026036 -OutFile adksetup.exe
1368
./adksetup.exe /features OptionId.WindowsPerformanceToolkit /log adk-setup.log /ceip off /installpath "C:\Program Files (x86)\Windows Kits\10\"
@@ -39,6 +94,8 @@ steps:
3994
--wpr-profile=GeneralProfile.verbose
4095
--wpr-profile=CPU.verbose
4196
--wpr-output=traces/wpr-result.etl
97+
env:
98+
TEMP: "R:\\"
4299
displayName: Tox run unit tests
43100

44101
- script:

0 commit comments

Comments
 (0)