From d9adc9214ad25fa2617f5166160d771ca622016c Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Fri, 19 Feb 2016 11:06:21 -0600 Subject: [PATCH] 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 --- Microsoft.DotNet.Cli.sln | 55 +++++++++++----- .../Dotnet.Cli.Msi.Tests.csproj | 63 ------------------- .../Installer/Dotnet.Cli.Msi.Tests/Program.cs | 17 ----- .../Dotnet.Cli.Msi.Tests/project.json | 17 ----- .../InstallFixture.cs | 2 - .../InstallationTests.cs | 2 - .../Microsoft.DotNet.Cli.Msi.Tests.xproj | 18 ++++++ .../MsiManager.cs | 1 - .../PostInstallTests.cs | 5 +- .../PostUninstallTests.cs | 5 +- .../Properties/AssemblyInfo.cs | 4 +- .../Utils.cs | 6 +- .../project.json | 14 +++++ test/Installer/testmsi.ps1 | 61 +++++++++++------- 14 files changed, 116 insertions(+), 154 deletions(-) delete mode 100644 test/Installer/Dotnet.Cli.Msi.Tests/Dotnet.Cli.Msi.Tests.csproj delete mode 100644 test/Installer/Dotnet.Cli.Msi.Tests/Program.cs delete mode 100644 test/Installer/Dotnet.Cli.Msi.Tests/project.json rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/InstallFixture.cs (96%) rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/InstallationTests.cs (97%) create mode 100644 test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.xproj rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/MsiManager.cs (98%) rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/PostInstallTests.cs (94%) rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/PostUninstallTests.cs (92%) rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/Properties/AssemblyInfo.cs (91%) rename test/Installer/{Dotnet.Cli.Msi.Tests => Microsoft.DotNet.Cli.Msi.Tests}/Utils.cs (88%) create mode 100644 test/Installer/Microsoft.DotNet.Cli.Msi.Tests/project.json diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 1a128ab24..f7171285b 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -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 diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/Dotnet.Cli.Msi.Tests.csproj b/test/Installer/Dotnet.Cli.Msi.Tests/Dotnet.Cli.Msi.Tests.csproj deleted file mode 100644 index 607b1fb94..000000000 --- a/test/Installer/Dotnet.Cli.Msi.Tests/Dotnet.Cli.Msi.Tests.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Debug - AnyCPU - {16614B7F-5CA3-45AE-95C2-003AB39CC09F} - Library - Properties - Dotnet.Cli.Msi.Tests - Dotnet.Cli.Msi.Tests - v4.6 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/Program.cs b/test/Installer/Dotnet.Cli.Msi.Tests/Program.cs deleted file mode 100644 index 1404a287b..000000000 --- a/test/Installer/Dotnet.Cli.Msi.Tests/Program.cs +++ /dev/null @@ -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; - } - } -} diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/project.json b/test/Installer/Dotnet.Cli.Msi.Tests/project.json deleted file mode 100644 index 8c5e66a00..000000000 --- a/test/Installer/Dotnet.Cli.Msi.Tests/project.json +++ /dev/null @@ -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": "" - } - } - } -} diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/InstallFixture.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallFixture.cs similarity index 96% rename from test/Installer/Dotnet.Cli.Msi.Tests/InstallFixture.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallFixture.cs index 0feb379f5..d42441477 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/InstallFixture.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallFixture.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using Xunit; namespace Dotnet.Cli.Msi.Tests diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/InstallationTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs similarity index 97% rename from test/Installer/Dotnet.Cli.Msi.Tests/InstallationTests.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs index d19c2b07c..9ce0be53d 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/InstallationTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using Xunit; [assembly: CollectionBehavior(DisableTestParallelization = true)] diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.xproj b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.xproj new file mode 100644 index 000000000..64ee27ba4 --- /dev/null +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.xproj @@ -0,0 +1,18 @@ + + + + 14.0.23107 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 0B31C336-149D-471A-B7B1-27B0F1E80F83 + Microsoft.DotNet.Cli.Msi.Tests + ..\..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + \ No newline at end of file diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/MsiManager.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/MsiManager.cs similarity index 98% rename from test/Installer/Dotnet.Cli.Msi.Tests/MsiManager.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/MsiManager.cs index a944a2a44..9aeedc6ad 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/MsiManager.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/MsiManager.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/PostInstallTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs similarity index 94% rename from test/Installer/Dotnet.Cli.Msi.Tests/PostInstallTests.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs index 1f25e23c2..9a6cf9ff4 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/PostInstallTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs @@ -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 diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/PostUninstallTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs similarity index 92% rename from test/Installer/Dotnet.Cli.Msi.Tests/PostUninstallTests.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs index 7b7552159..0ae795142 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/PostUninstallTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs @@ -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 diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/Properties/AssemblyInfo.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Properties/AssemblyInfo.cs similarity index 91% rename from test/Installer/Dotnet.Cli.Msi.Tests/Properties/AssemblyInfo.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Properties/AssemblyInfo.cs index 84f066e3d..28844fb0a 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/Properties/AssemblyInfo.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Properties/AssemblyInfo.cs @@ -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("")] diff --git a/test/Installer/Dotnet.Cli.Msi.Tests/Utils.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Utils.cs similarity index 88% rename from test/Installer/Dotnet.Cli.Msi.Tests/Utils.cs rename to test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Utils.cs index 32707bd85..82085fb4f 100644 --- a/test/Installer/Dotnet.Cli.Msi.Tests/Utils.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Utils.cs @@ -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 { diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/project.json b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/project.json new file mode 100644 index 000000000..fb7c04bd1 --- /dev/null +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/project.json @@ -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": "" + } + } + } +} diff --git a/test/Installer/testmsi.ps1 b/test/Installer/testmsi.ps1 index ea329d8a9..b25f66a48 100644 --- a/test/Installer/testmsi.ps1 +++ b/test/Installer/testmsi.ps1 @@ -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