From edfb746bc88dc20b807cf84bc0f2b5472839afce Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 24 Aug 2019 15:21:35 +0300 Subject: AppVeyor: build km/ for different Windows versions --- .appveyor/build.ps1 | 62 +++++++++++++++++++++++++-------------- .appveyor/test.ps1 | 84 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 98 insertions(+), 48 deletions(-) (limited to '.appveyor') diff --git a/.appveyor/build.ps1 b/.appveyor/build.ps1 index 4e0ebd8..73f8a74 100644 --- a/.appveyor/build.ps1 +++ b/.appveyor/build.ps1 @@ -3,7 +3,8 @@ param( [string] $ProjectDir = $null, [string] $Generator = $null, [string] $Platform = $null, - [string] $Configuration = $null + [string] $Configuration = $null, + [string] $DriverTargetOS = $null ) $ErrorActionPreference = "Stop"; @@ -43,6 +44,7 @@ function Set-AppVeyorDefaults { } $script:Platform = $env:PLATFORM $script:Configuration = $env:CONFIGURATION + $script:DriverTargetOS = $env:appveyor_driver_target_os } function Build-ProjectUserMode { @@ -69,10 +71,12 @@ function Build-ProjectUserMode { function Get-DriverConfiguration { param( [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) - return "Win7 $Configuration" + return "$DriverTargetOS $Configuration" } function Get-DriverBuildDir { @@ -108,14 +112,16 @@ function Build-Driver { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) $build_dir = Get-DriverBuildDir -ProjectDir $ProjectDir -DriverSpec $DriverSpec $solution_path = Get-DriverSolutionPath -ProjectDir $ProjectDir -DriverSpec $DriverSpec - $Configuration = Get-DriverConfiguration -Configuration $Configuration - $msbuild_params = "/p:Configuration=$Configuration;Platform=$Platform;SignMode=TestSign" + $Configuration = Get-DriverConfiguration -Configuration $Configuration -DriverTargetOS $DriverTargetOS + $msbuild_params = "/p:Platform=$Platform;Configuration=$Configuration;SignMode=TestSign" cd $build_dir Invoke-Exe { msbuild.exe $msbuild_params $solution_path } @@ -128,12 +134,21 @@ function Build-ProjectKernelMode { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) - Build-Driver -ProjectDir $ProjectDir -Platform $Platform -Configuration $Configuration -DriverSpec 'minimal' - Build-Driver -ProjectDir $ProjectDir -Platform $Platform -Configuration $Configuration -DriverSpec 'simple' - Build-Driver -ProjectDir $ProjectDir -Platform $Platform -Configuration $Configuration -DriverSpec 'special\nt_namespace' + $drivers = 'minimal', 'simple', 'special\nt_namespace' + + foreach ($driver in $drivers) { + Build-Driver ` + -ProjectDir $ProjectDir ` + -DriverSpec $driver ` + -Platform $Platform ` + -Configuration $Configuration ` + -DriverTargetOS $DriverTargetOS + } } function Build-Project { @@ -147,7 +162,9 @@ function Build-Project { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) Build-ProjectUserMode ` @@ -156,10 +173,11 @@ function Build-Project { -Generator $Generator ` -Platform $Platform ` -Configuration $Configuration - Build-ProjectKernelMode ` - -ProjectDir $ProjectDir ` - -Platform $Platform ` - -Configuration $Configuration + Build-ProjectKernelMode ` + -ProjectDir $ProjectDir ` + -Platform $Platform ` + -Configuration $Configuration ` + -DriverTargetOS $DriverTargetOS } function Build-ProjectAppVeyor { @@ -169,15 +187,17 @@ function Build-ProjectAppVeyor { } try { - Build-Project ` - -ProjectDir $script:ProjectDir ` - -BuildDir $script:BuildDir ` - -Generator $script:Generator ` - -Platform $script:Platform ` - -Configuration $script:Configuration + Build-Project ` + -ProjectDir $script:ProjectDir ` + -BuildDir $script:BuildDir ` + -Generator $script:Generator ` + -Platform $script:Platform ` + -Configuration $script:Configuration ` + -DriverTargetOS $script:DriverTargetOS } finally { if (Test-AppVeyor) { cd $appveyor_cwd + Set-PSDebug -Off } } } diff --git a/.appveyor/test.ps1 b/.appveyor/test.ps1 index 71cb340..3eeebfc 100644 --- a/.appveyor/test.ps1 +++ b/.appveyor/test.ps1 @@ -2,7 +2,8 @@ param( [string] $BuildDir = $null, [string] $ProjectDir = $null, [string] $Configuration = $null, - [string] $Platform = $null + [string] $Platform = $null, + [string] $DriverTargetOS = $null ) $ErrorActionPreference = "Stop"; @@ -37,6 +38,7 @@ function Set-AppVeyorDefaults { $script:BuildDir = 'C:\Projects\build' $script:Platform = $env:PLATFORM $script:Configuration = $env:CONFIGURATION + $script:DriverTargetOS = $env:appveyor_driver_target_os } function Add-UtilsPath { @@ -69,7 +71,9 @@ function Get-DriverBinDir { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) $Platform = switch ($Platform) { @@ -78,9 +82,16 @@ function Get-DriverBinDir { default { throw "Unsupported platform: $Platform" } } + $DriverTargetOS = switch ($DriverTargetOS) { + 'Win7' { 'Windows7' } + 'Win8' { 'Windows8' } + 'Win8.1' { 'WindowsV6.3' } + default { throw "Unsupported target OS: $DriverTargetOS" } + } + $driver_name = Get-DriverName -DriverSpec $DriverSpec - return "$ProjectDir\km\build\wdk8.1update\$DriverSpec\bin\Windows7\$Platform\$Configuration" + return "$ProjectDir\km\build\wdk8.1update\$DriverSpec\bin\$DriverTargetOS\$Platform\$Configuration" } function Get-DriverSysPath { @@ -92,14 +103,17 @@ function Get-DriverSysPath { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) - $bin_dir = Get-DriverBinDir ` - -ProjectDir $ProjectDir ` - -DriverSpec $DriverSpec ` - -Platform $Platform ` - -Configuration $Configuration + $bin_dir = Get-DriverBinDir ` + -ProjectDir $ProjectDir ` + -DriverSpec $DriverSpec ` + -Platform $Platform ` + -Configuration $Configuration ` + -DriverTargetOS $DriverTargetOS $driver_name = Get-DriverName -DriverSpec $DriverSpec return "$bin_dir\$driver_name.vs12.sys" @@ -114,15 +128,18 @@ function Start-Driver { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) $service_name = Get-DriverName -DriverSpec $DriverSpec - $sys_path = Get-DriverSysPath ` - -ProjectDir $ProjectDir ` - -DriverSpec $DriverSpec ` - -Platform $Platform ` - -Configuration $Configuration + $sys_path = Get-DriverSysPath ` + -ProjectDir $ProjectDir ` + -DriverSpec $DriverSpec ` + -Platform $Platform ` + -Configuration $Configuration ` + -DriverTargetOS $DriverTargetOS Write-Host "Starting driver $service_name..." Invoke-Exe { install_service.exe $service_name $sys_path } @@ -176,18 +193,30 @@ function Run-ProjectTests { [Parameter(Mandatory=$true)] [string] $Platform, [Parameter(Mandatory=$true)] - [string] $Configuration + [string] $Configuration, + [Parameter(Mandatory=$true)] + [string] $DriverTargetOS ) Add-UtilsPath -BuildDir $BuildDir -Configuration $Configuration - Start-Driver ` - -ProjectDir $ProjectDir ` - -DriverSpec 'simple' ` - -Platform $Platform ` - -Configuration $Configuration + + $drivers = 'minimal', 'simple', 'special\nt_namespace' + + foreach ($driver in $drivers) { + Start-Driver ` + -ProjectDir $ProjectDir ` + -DriverSpec $driver ` + -Platform $Platform ` + -Configuration $Configuration ` + -DriverTargetOS $DriverTargetOS + } + Verify-ExchangeInts -NewInt 69 -OldInt 42 Verify-ExchangeInts -NewInt 100500 -OldInt 69 - Stop-Driver -DriverSpec 'simple' + + foreach ($driver in $drivers) { + Stop-Driver -DriverSpec $driver + } } function Run-ProjectTestsAppVeyor { @@ -197,11 +226,12 @@ function Run-ProjectTestsAppVeyor { } try { - Run-ProjectTests ` - -ProjectDir $script:ProjectDir ` - -BuildDir $script:BuildDir ` - -Platform $script:Platform ` - -Configuration $script:Configuration + Run-ProjectTests ` + -ProjectDir $script:ProjectDir ` + -BuildDir $script:BuildDir ` + -Platform $script:Platform ` + -Configuration $script:Configuration ` + -DriverTargetOS $script:DriverTargetOS } finally { if (Test-AppVeyor) { cd $appveyor_cwd -- cgit v1.2.3