aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-11-29 22:03:26 -0800
committerRob Mensching <rob@firegiant.com>2017-11-29 22:03:26 -0800
commit71c52d5af2293d3eb79882ce36b0411f81185c11 (patch)
tree23dd116bdd6abc2b0f7b488f490d1b77faa41812 /src/test
parent0fa198ed8c6c6fc81e649466879752a99fe37d08 (diff)
downloadwix-71c52d5af2293d3eb79882ce36b0411f81185c11.tar.gz
wix-71c52d5af2293d3eb79882ce36b0411f81185c11.tar.bz2
wix-71c52d5af2293d3eb79882ce36b0411f81185c11.zip
Fix source path and cabinet processing
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs47
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.wxs27
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/PackageComponents.wxs10
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.en-us.wxl10
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wixproj48
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wxs16
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegrationFixture/WixToolsetTest.CoreIntegrationFixture.csproj11
10 files changed, 178 insertions, 4 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs
index 4b4daeda..da9f3a38 100644
--- a/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs
@@ -39,5 +39,52 @@ namespace WixToolsetTest.CoreIntegrationFixture
39 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); 39 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
40 } 40 }
41 } 41 }
42
43 [Fact]
44 public void CanBuildSimpleModule()
45 {
46 var folder = TestData.Get(@"TestData\SimpleModule");
47
48 using (var fs = new DisposableFileSystem())
49 using (var pushd = new Pushd(folder))
50 {
51 var intermediateFolder = fs.GetFolder();
52
53 var program = new Program();
54 var result = program.Run(new WixToolsetServiceProvider(), new[] { "build", "Module.wxs", "-loc", "Module.en-us.wxl", "-bindpath", "data", "-intermediateFolder", intermediateFolder, "-o", $@"{intermediateFolder}\bin\test.msm" });
55
56 Assert.Equal(0, result);
57
58 Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msm")));
59 Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb")));
60
61 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wir"));
62 Assert.Single(intermediate.Sections);
63
64 var wixFile = intermediate.Sections.SelectMany(s => s.Tuples).OfType<WixFileTuple>().Single();
65 Assert.Equal(@"data\test.txt", wixFile[WixFileTupleFields.Source].AsPath().Path);
66 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
67 }
68 }
69
70 [Fact(Skip = "Not implemented yet.")]
71 public void CanBuildInstanceTransform()
72 {
73 var folder = TestData.Get(@"TestData\InstanceTransform");
74
75 using (var fs = new DisposableFileSystem())
76 using (var pushd = new Pushd(folder))
77 {
78 var intermediateFolder = fs.GetFolder();
79
80 var program = new Program();
81 var result = program.Run(new WixToolsetServiceProvider(), new[] { "build", "Package.wxs", "PackageComponents.wxs", "-loc", "Package.en-us.wxl", "-bindpath", "data", "-intermediateFolder", intermediateFolder, "-o", $@"{intermediateFolder}\bin\test.msi" });
82
83 Assert.Equal(0, result);
84
85 var pdb = Pdb.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false);
86 Assert.NotEmpty(pdb.Output.SubStorages);
87 }
88 }
42 } 89 }
43} 90}
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.en-us.wxl
new file mode 100644
index 00000000..38c12ac1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.en-us.wxl
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 <String Id="FeatureTitle">MsiPackage</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.wxs b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.wxs
new file mode 100644
index 00000000..9c529668
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/Package.wxs
@@ -0,0 +1,27 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5
6 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7 <MediaTemplate />
8
9 <Property Id="INSTANCEPROPERTY" Secure="yes" />
10
11 <InstanceTransforms Property="INSTANCEPROPERTY">
12 <Instance Id="I1" ProductCode="*" ProductName="MsiPackage (Instance 1)" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" />
13 </InstanceTransforms>
14
15 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
16 <ComponentGroupRef Id="ProductComponents" />
17 </Feature>
18 </Product>
19
20 <Fragment>
21 <Directory Id="TARGETDIR" Name="SourceDir">
22 <Directory Id="ProgramFilesFolder">
23 <Directory Id="INSTALLFOLDER" Name="MsiPackageInstance" />
24 </Directory>
25 </Directory>
26 </Fragment>
27</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/PackageComponents.wxs
new file mode 100644
index 00000000..e26c4509
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/PackageComponents.wxs
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Source="test.txt" />
7 </Component>
8 </ComponentGroup>
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/data/test.txt b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/data/test.txt
new file mode 100644
index 00000000..cd0db0e1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/InstanceTransform/data/test.txt
@@ -0,0 +1 @@
This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.en-us.wxl b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.en-us.wxl
new file mode 100644
index 00000000..c74e86a7
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.en-us.wxl
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="Manufacturer">Example Company</String>
9
10</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wixproj b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wixproj
new file mode 100644
index 00000000..597d4318
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wixproj
@@ -0,0 +1,48 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 <ProductVersion>0.9</ProductVersion>
7 <ProjectGuid>27df04c6-3cef-4b9a-bac6-4e78d188384f</ProjectGuid>
8 <OutputName>MergeModule1</OutputName>
9 <OutputType>Module</OutputType>
10 <Name>MergeModule1</Name>
11 <RootNamespace>MergeModule1</RootNamespace>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
14 <PlatformName>$(Platform)</PlatformName>
15 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
16 <DefineConstants>Debug</DefineConstants>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
19 <PlatformName>$(Platform)</PlatformName>
20 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
23 <PlatformName>$(Platform)</PlatformName>
24 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
25 <DefineConstants>Debug</DefineConstants>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
28 <PlatformName>$(Platform)</PlatformName>
29 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 </PropertyGroup>
31 <ItemGroup>
32 <Compile Include="MergeModule.wxs" />
33 </ItemGroup>
34 <ItemGroup>
35 <EmbeddedResource Include="MergeModule.en-us.wxl" />
36 </ItemGroup>
37 <ItemGroup>
38 <WixExtension Include="FgwepExtension.wixext">
39 <Name>FgwepExtension.wixext</Name>
40 <HintPath>$(WixExtDir)\FgwepExtension.wixext.dll</HintPath>
41 </WixExtension>
42 </ItemGroup>
43 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
44 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " />
45 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
46 <Error Text="FG-WiX or WiX Toolset build tools (v3.11 or later) must be installed to build this project. To download FG-WiX, go to https://www.firegiant.com/downloads/. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
47 </Target>
48</Project> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wxs b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wxs
new file mode 100644
index 00000000..260339ba
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/Module.wxs
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Module Id="MergeModule1" Language="1033" Version="1.0.0.0">
4 <Package Id="243FB739-4D05-472F-9CFB-EF6B1017B6DE" Manufacturer="!(loc.Manufacturer)" InstallerVersion="200" />
5
6 <Directory Id="TARGETDIR" Name="SourceDir">
7 <Directory Id="MergeRedirectFolder">
8
9 <Component Id="ModuleComponent" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45">
10 <File Source="test.txt" />
11 </Component>
12
13 </Directory>
14 </Directory>
15 </Module>
16</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/data/test.txt b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/data/test.txt
new file mode 100644
index 00000000..cd0db0e1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/TestData/SimpleModule/data/test.txt
@@ -0,0 +1 @@
This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/WixToolsetTest.CoreIntegrationFixture.csproj b/src/test/WixToolsetTest.CoreIntegrationFixture/WixToolsetTest.CoreIntegrationFixture.csproj
index bce6e6b2..f9042cda 100644
--- a/src/test/WixToolsetTest.CoreIntegrationFixture/WixToolsetTest.CoreIntegrationFixture.csproj
+++ b/src/test/WixToolsetTest.CoreIntegrationFixture/WixToolsetTest.CoreIntegrationFixture.csproj
@@ -7,11 +7,14 @@
7 <IsPackable>false</IsPackable> 7 <IsPackable>false</IsPackable>
8 </PropertyGroup> 8 </PropertyGroup>
9 9
10 <PropertyGroup>
11 <NoWarn>NU1701</NoWarn>
12 </PropertyGroup>
13
14 <ItemGroup> 10 <ItemGroup>
11 <Content Include="TestData\SimpleModule\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
12 <Content Include="TestData\SimpleModule\Module.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
13 <Content Include="TestData\SimpleModule\Module.wxs" CopyToOutputDirectory="PreserveNewest" />
14 <Content Include="TestData\InstanceTransform\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
15 <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
16 <Content Include="TestData\InstanceTransform\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
17 <Content Include="TestData\InstanceTransform\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
15 <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> 18 <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
16 <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 19 <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
17 <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 20 <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" />