Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maint/azure pipeline setup tests #2

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
environment:
matrix:
matrix: []
# Unit and integration tests.
- PYTHON: "C:\\Python27-x64"
RUN_INTEGRATION_TESTS: "True"
- PYTHON: "C:\\Python35-x64"
RUN_INTEGRATION_TESTS: "True"
- PYTHON: "C:\\Python36-x64"
RUN_INTEGRATION_TESTS: "True"
#- PYTHON: "C:\\Python27-x64"
# RUN_INTEGRATION_TESTS: "True"
#- PYTHON: "C:\\Python35-x64"
# RUN_INTEGRATION_TESTS: "True"
#- PYTHON: "C:\\Python36-x64"
# RUN_INTEGRATION_TESTS: "True"
# Unit tests only.
# Nothing for the moment

Expand Down
58 changes: 29 additions & 29 deletions .azure-pipelines/jobs/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions .azure-pipelines/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ jobs:
parameters:
vmImage: ubuntu-16.04

- template: jobs/package.yml
parameters:
vmImage: ubuntu-16.04
#- template: jobs/package.yml
# parameters:
# vmImage: ubuntu-16.04
6 changes: 3 additions & 3 deletions .azure-pipelines/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ jobs:
parameters:
vmImage: xcode9-macos10.13

- template: jobs/package.yml
parameters:
vmImage: xcode9-macos10.13
#- template: jobs/package.yml
# parameters:
# vmImage: xcode9-macos10.13
90 changes: 86 additions & 4 deletions .azure-pipelines/steps/run-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,96 @@ steps:
versionSpec: '$(python.version)'
architecture: '$(python.architecture)'

- powershell: |
echo "Installing FS-iSCSITarget-Server"
Install-WindowsFeature -Name FS-iSCSITarget-Server

# Allow connection on loopback interface.
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\iSCSI Target' -Name AllowLoopBack -Value 1

echo "Starting MsiSCSI"
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"
}

echo "Configuring Firewall"
Get-NetFirewallServiceFilter -Service msiscsi | Enable-NetFirewallRule

echo "Configuring RAMDisk"
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

echo "Connecting to iSCSI"
$ip = (Get-NetIPAddress -AddressFamily IPv4).ipaddress[0]
New-IscsiTargetPortal -TargetPortalAddress $ip
Get-IscsiTarget | Connect-IscsiTarget

echo "Configuring disk"
Get-IscsiConnection | Get-Disk | Set-Disk -IsOffline $False
Get-IscsiConnection | Get-Disk | Initialize-Disk -PartitionStyle MBR
Get-IscsiConnection | Get-Disk | New-Partition -UseMaximumSize -DriveLetter R
Format-Volume -DriveLetter R -NewFileSystemLabel Temp -FileSystem NTFS

echo "Adding permissions"
mkdir R:\Temp
$acl = Get-Acl "R:\Temp"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl
displayName: Test

- 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\"
# Wait for install to complete.
python -c "
import os, time
start = time.time()
last = start
while last - start < 60:
if os.path.exists('C:/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/wpr.exe'):
break
print('Waiting...')
time.sleep(2)
last = time.time()
"
Get-Content adk-setup.log
displayName: ADK Setup

- bash: pip install --upgrade setuptools tox
displayName: Install Tox

- script: tox -e py -- -m unit -n 3 --junit-xml=junit/unit-test.xml
- script: mkdir traces
displayName: Make trace output directory

- script:
tox -e py -- -m unit --junit-xml=junit/unit-test.xml
env:
TEMP: "R:\\Temp"
displayName: Tox run unit tests

#- script:
# tracerpt -l traces/wpr-result.etl -export traces/providers.man
# displayName: Generate trace provider manifest
#
#- task: PublishBuildArtifacts@1
# displayName: 'Publish trace results'
# inputs:
# pathtoPublish: traces
# artifactName: wpr-result-$(python.version)-$(python.architecture).etl
# condition: succeededOrFailed()

- ${{ if eq(parameters.runIntegrationTests, 'true') }}:
- powershell: |
# Fix Git SSL errors
Expand All @@ -23,9 +107,7 @@ steps:

# Shorten paths to get under MAX_PATH or else integration tests will fail
# https://bugs.python.org/issue18199
subst T: $env:TEMP
$env:TEMP = "T:\"
$env:TMP = "T:\"
$env:TEMP = "R:\Temp"

tox -e py -- -m integration -n 3 --duration=5 --junit-xml=junit/integration-test.xml
displayName: Tox run integration tests
Expand Down
6 changes: 3 additions & 3 deletions .azure-pipelines/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ jobs:
parameters:
vmImage: vs2017-win2016

- template: jobs/package.yml
parameters:
vmImage: vs2017-win2016
#- template: jobs/package.yml
# parameters:
# vmImage: vs2017-win2016
74 changes: 37 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ stages:
- secondary

jobs:
include:
# Basic Checks
- stage: primary
env: TOXENV=docs
- env: TOXENV=lint
- env: TOXENV=vendoring
# Latest CPython
- env: GROUP=1
python: 2.7
- env: GROUP=2
python: 2.7
- env: GROUP=1
- env: GROUP=2
include: []
## Basic Checks
#- stage: primary
# env: TOXENV=docs
#- env: TOXENV=lint
#- env: TOXENV=vendoring
## Latest CPython
#- env: GROUP=1
# python: 2.7
#- env: GROUP=2
# python: 2.7
#- env: GROUP=1
#- env: GROUP=2

# Complete checking for ensuring compatibility
# PyPy
- stage: secondary
env: GROUP=1
python: pypy3.5-6.0
- env: GROUP=2
python: pypy3.5-6.0
- env: GROUP=1
python: pypy2.7-6.0
- env: GROUP=2
python: pypy2.7-6.0
# Other Supported CPython
- env: GROUP=1
python: 3.6
- env: GROUP=2
python: 3.6
- env: GROUP=1
python: 3.5
- env: GROUP=2
python: 3.5
## Complete checking for ensuring compatibility
## PyPy
#- stage: secondary
# env: GROUP=1
# python: pypy3.5-6.0
#- env: GROUP=2
# python: pypy3.5-6.0
#- env: GROUP=1
# python: pypy2.7-6.0
#- env: GROUP=2
# python: pypy2.7-6.0
## Other Supported CPython
#- env: GROUP=1
# python: 3.6
#- env: GROUP=2
# python: 3.6
#- env: GROUP=1
# python: 3.5
#- env: GROUP=2
# python: 3.5

- env: GROUP=1
python: 3.8-dev
- env: GROUP=2
python: 3.8-dev
#- env: GROUP=1
# python: 3.8-dev
#- env: GROUP=2
# python: 3.8-dev

fast_finish: true
# It's okay to fail on the in-development CPython version.
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
from tests.lib.venv import VirtualEnvironment


sys.path.append(os.path.dirname(os.path.dirname(__file__)))


pytest_plugins = "tests.plugins.wpr"


def pytest_addoption(parser):
parser.addoption(
"--keep-tmpdir", action="store_true",
Expand Down
Empty file added tests/plugins/__init__.py
Empty file.