Running Windows installer tests on Docker.

Cleaning up the Installer tests
- rename project to conform to the rest of the tests
- convert to .xproj
- clean up unused usings
This commit is contained in:
Eric Erhardt 2016-02-19 11:06:21 -06:00
parent 856a077bd1
commit d9adc9214a
14 changed files with 116 additions and 154 deletions

View file

@ -75,8 +75,13 @@ EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestProjectToProjectDependencies", "TestAssets\TestProjects\TestProjectToProjectDependencies\TestProjectToProjectDependencies.xproj", "{947DD232-8D9B-4B78-9C6A-94F807D22222}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.InternalAbstractions", "src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.xproj", "{BD4F0750-4E81-4AD2-90B5-E470881792C3}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Tests", "test\Microsoft.DotNet.ProjectModel.Tests\Microsoft.DotNet.ProjectModel.Tests.xproj", "{0745410A-6629-47EB-AAB5-08D6288CAD72}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Installer", "Installer", "{0E3300A4-DF54-40BF-87D8-E7658330C288}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Msi.Tests", "test\Installer\Microsoft.DotNet.Cli.Msi.Tests\Microsoft.DotNet.Cli.Msi.Tests.xproj", "{0B31C336-149D-471A-B7B1-27B0F1E80F83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -361,6 +366,22 @@ Global
{D521DD9F-0614-4929-93B4-D8FA5682C174}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{D521DD9F-0614-4929-93B4-D8FA5682C174}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{D521DD9F-0614-4929-93B4-D8FA5682C174}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|x64.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|Any CPU.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|x64.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|x64.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{D7B9695D-23EB-4EA8-B8AB-707A0092E1D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7B9695D-23EB-4EA8-B8AB-707A0092E1D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7B9695D-23EB-4EA8-B8AB-707A0092E1D5}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -393,22 +414,6 @@ Global
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Debug|x64.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|Any CPU.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|x64.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.Release|x64.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{CB710268-4A82-48E4-9531-FAF1C8F78F4B}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -537,6 +542,22 @@ Global
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Debug|x64.ActiveCfg = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Debug|x64.Build.0 = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Release|Any CPU.Build.0 = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Release|x64.ActiveCfg = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.Release|x64.Build.0 = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -571,5 +592,7 @@ Global
{947DD232-8D9B-4B78-9C6A-94F807D22222} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
{BD4F0750-4E81-4AD2-90B5-E470881792C3} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{0745410A-6629-47EB-AAB5-08D6288CAD72} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{0E3300A4-DF54-40BF-87D8-E7658330C288} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{0B31C336-149D-471A-B7B1-27B0F1E80F83} = {0E3300A4-DF54-40BF-87D8-E7658330C288}
EndGlobalSection
EndGlobal

View file

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{16614B7F-5CA3-45AE-95C2-003AB39CC09F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Dotnet.Cli.Msi.Tests</RootNamespace>
<AssemblyName>Dotnet.Cli.Msi.Tests</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InstallationTests.cs" />
<Compile Include="InstallFixture.cs" />
<Compile Include="MsiManager.cs" />
<Compile Include="PostInstallTests.cs" />
<Compile Include="PostUninstallTests.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dotnet.Cli.Msi.Tests
{
class Program
{
// A main method is currently required because of https://github.com/dotnet/cli/issues/314
public static void Main(string[] args)
{
return;
}
}
}

View file

@ -1,17 +0,0 @@
{
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.1.0",
"Microsoft.Deployment.WindowsInstaller": "1.0.0"
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.Runtime": ""
}
}
}
}

View file

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace Dotnet.Cli.Msi.Tests

View file

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0B31C336-149D-471A-B7B1-27B0F1E80F83</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Cli.Msi.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Win32;
using Microsoft.Win32;
using Xunit;
namespace Dotnet.Cli.Msi.Tests

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Win32;
using Microsoft.Win32;
using Xunit;
namespace Dotnet.Cli.Msi.Tests

View file

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dotnet.Cli.Msi.Tests")]
[assembly: AssemblyTitle("Microsoft.DotNet.Cli.Msi.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Dotnet.Cli.Msi.Tests")]
[assembly: AssemblyProduct("Microsoft.DotNet.Cli.Msi.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -1,8 +1,6 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using Microsoft.Win32;
namespace Dotnet.Cli.Msi.Tests
{

View file

@ -0,0 +1,14 @@
{
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.1.0",
"Microsoft.Deployment.WindowsInstaller": "1.0.0"
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.Runtime": ""
}
}
}
}

View file

@ -7,23 +7,36 @@ param(
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
function Test-Administrator
{
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
$RepoRoot = Convert-Path "$PSScriptRoot\..\.."
function CopyInstaller([string]$destination)
{
# Copy both the .msi and the .exe to the testBin directory so
# the tests running in the docker container have access to them.
Copy-Item $inputMsi -Destination:$destination
$BundlePath = [System.IO.Path]::ChangeExtension($inputMsi, "exe")
Copy-Item $BundlePath -Destination:$destination
}
Write-Host "Running tests for MSI installer at $inputMsi.."
function CopyTestXUnitRunner([string]$destination)
{
$XUnitRunnerDir = Join-Path $env:NUGET_PACKAGES xunit.runner.console\2.1.0\tools
Copy-Item $XUnitRunnerDir\xunit.console.exe -Destination:$destination
Copy-Item $XUnitRunnerDir\xunit.runner.utility.desktop.dll -Destination:$destination
}
Write-Host "Running tests for MSI installer at $inputMsi."
if(!(Test-Path $inputMsi))
{
throw "$inputMsi not found"
}
$env:CLI_MSI=$inputMsi
$testDir="$PSScriptRoot\Dotnet.Cli.Msi.Tests"
$testBin="$RepoRoot\artifacts\tests\Dotnet.Cli.Msi.Tests"
$xunitRunner="$env:USERPROFILE\.dnx\packages\xunit.runner.console\2.1.0\tools\xunit.console.exe"
$testName = "Microsoft.DotNet.Cli.Msi.Tests"
$testDir="$PSScriptRoot\$testName"
$testBin="$RepoRoot\artifacts\tests\$testName"
pushd "$Stage2Dir\bin"
@ -48,22 +61,26 @@ try {
{
throw "dotnet publish failed with exit code $LastExitCode."
}
<#
if(-Not (Test-Administrator))
{
Write-Host -ForegroundColor Yellow "Current script testmsi.ps1 is not run as admin."
Write-Host -ForegroundColor Yellow "Executing MSI tests require admin privileges."
Write-Host -ForegroundColor Yellow "Failing silently."
Exit 0
}
& $xunitRunner $testBin\Dotnet.Cli.Msi.Tests.exe | Out-Host
if($LastExitCode -ne 0)
if($env:RunInstallerTestsInDocker)
{
throw "xunit runner failed with exit code $LastExitCode."
CopyInstaller $testBin
CopyTestXUnitRunner $testBin
Write-Host "Running installer tests in Windows Container"
$MsiFileName = [System.IO.Path]::GetFileName($inputMsi)
docker run `
-v "$testBin\:D:" `
-e "CLI_MSI=D:\$MsiFileName" `
windowsservercore `
D:\xunit.console.exe D:\$testName.dll | Out-Host
if($LastExitCode -ne 0)
{
throw "xunit runner failed with exit code $LastExitCode."
}
}
#>
}
finally {
popd