|
8 | 8 | versionSpec: '$(python.version)'
|
9 | 9 | architecture: '$(python.architecture)'
|
10 | 10 |
|
| 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 | + |
11 | 66 | - powershell: |
|
12 | 67 | Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2026036 -OutFile adksetup.exe
|
13 | 68 | ./adksetup.exe /features OptionId.WindowsPerformanceToolkit /log adk-setup.log /ceip off /installpath "C:\Program Files (x86)\Windows Kits\10\"
|
|
39 | 94 | --wpr-profile=GeneralProfile.verbose
|
40 | 95 | --wpr-profile=CPU.verbose
|
41 | 96 | --wpr-output=traces/wpr-result.etl
|
| 97 | + env: |
| 98 | + TEMP: "R:\\" |
42 | 99 | displayName: Tox run unit tests
|
43 | 100 |
|
44 | 101 | - script:
|
|
0 commit comments