aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-03-30 19:46:56 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-03-30 21:57:49 +1000
commit0afd76e4c5d46f237591d860e7d445e267522187 (patch)
tree9f3b648da7733464c83ba6e253a65a18d17f5583 /src/test
parentd74e3dd4bcc573d0c4b1fb5c36c8bf0115cc21a1 (diff)
downloadwix-0afd76e4c5d46f237591d860e7d445e267522187.tar.gz
wix-0afd76e4c5d46f237591d860e7d445e267522187.tar.bz2
wix-0afd76e4c5d46f237591d860e7d445e267522187.zip
Add DetectSHA2Support "search".
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs5
-rw-r--r--src/test/WixToolsetTest.Util/UtilExtensionFixture.cs55
2 files changed, 29 insertions, 31 deletions
diff --git a/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs b/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs
index cafd4255..82646b37 100644
--- a/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs
+++ b/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs
@@ -7,6 +7,7 @@
7 <util:RegistrySearchRef Id="RegistrySearchId" /> 7 <util:RegistrySearchRef Id="RegistrySearchId" />
8 <util:ProductSearchRef Id="ProductSearchId" /> 8 <util:ProductSearchRef Id="ProductSearchId" />
9 <util:FileSearchRef Id="FileSearchId" /> 9 <util:FileSearchRef Id="FileSearchId" />
10 <util:DetectSHA2SupportRef Id="DetectSHA2SupportId" />
10 11
11 <Chain> 12 <Chain>
12 <MsiPackage SourceFile="test.msi"> 13 <MsiPackage SourceFile="test.msi">
@@ -32,4 +33,8 @@
32 <Fragment> 33 <Fragment>
33 <util:FileSearch Id="FileSearchId" Variable="FileSearchVariable" Path="%windir%\System32\mscoree.dll" Result="exists" /> 34 <util:FileSearch Id="FileSearchId" Variable="FileSearchVariable" Path="%windir%\System32\mscoree.dll" Result="exists" />
34 </Fragment> 35 </Fragment>
36
37 <Fragment>
38 <util:DetectSHA2Support Id="DetectSHA2SupportId" Variable="IsSHA2Supported" />
39 </Fragment>
35</Wix> 40</Wix>
diff --git a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs
index 8f33eff5..c5b370ac 100644
--- a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+++ b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs
@@ -146,6 +146,9 @@ namespace WixToolsetTest.Util
146 { 146 {
147 var baseFolder = fs.GetFolder(); 147 var baseFolder = fs.GetFolder();
148 var intermediateFolder = Path.Combine(baseFolder, "obj"); 148 var intermediateFolder = Path.Combine(baseFolder, "obj");
149 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
150 var baFolderPath = Path.Combine(baseFolder, "ba");
151 var extractFolderPath = Path.Combine(baseFolder, "extract");
149 152
150 var result = WixRunner.Execute(new[] 153 var result = WixRunner.Execute(new[]
151 { 154 {
@@ -156,45 +159,35 @@ namespace WixToolsetTest.Util
156 "-bindpath", Path.Combine(folder, "data"), 159 "-bindpath", Path.Combine(folder, "data"),
157 "-intermediateFolder", intermediateFolder, 160 "-intermediateFolder", intermediateFolder,
158 "-burnStub", burnStubPath, 161 "-burnStub", burnStubPath,
159 "-o", Path.Combine(baseFolder, @"bin\test.exe") 162 "-o", bundlePath
160 }); 163 });
161 164
162 result.AssertSuccess(); 165 result.AssertSuccess();
163 166
164 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); 167 Assert.True(File.Exists(bundlePath));
165#if TODO 168#if TODO
166 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 169 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
167#endif 170#endif
168 171
169 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); 172 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
170 var section = intermediate.Sections.Single(); 173 extractResult.AssertSuccess();
171 174
172 var searchTuples = section.Tuples.OfType<WixSearchTuple>().OrderBy(t => t.Id.Id).ToList(); 175 var bundleExtensionDatas = extractResult.SelectBundleExtensionDataNodes("/be:BundleExtensionData/be:BundleExtension[@Id='WixUtilBundleExtension']");
173 Assert.Equal(3, searchTuples.Count); 176 Assert.Equal(1, bundleExtensionDatas.Count);
174 Assert.Equal("FileSearchId", searchTuples[0].Id.Id); 177 Assert.Equal("<BundleExtension Id='WixUtilBundleExtension'>" +
175 Assert.Equal("FileSearchVariable", searchTuples[0].Variable); 178 "<WixDetectSHA2Support Id='DetectSHA2SupportId' />" +
176 Assert.Equal("ProductSearchId", searchTuples[1].Id.Id); 179 "</BundleExtension>", bundleExtensionDatas[0].GetTestXml());
177 Assert.Equal("ProductSearchVariable", searchTuples[1].Variable); 180
178 Assert.Equal("1 & 2 < 3", searchTuples[1].Condition); 181 var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]");
179 Assert.Equal("RegistrySearchId", searchTuples[2].Id.Id); 182 Assert.Equal(4, utilSearches.Count);
180 Assert.Equal("RegistrySearchVariable", searchTuples[2].Variable); 183 Assert.Equal("<ExtensionSearch Id='DetectSHA2SupportId' Variable='IsSHA2Supported' " +
181 184 "ExtensionId='WixUtilBundleExtension' />", utilSearches[0].GetTestXml());
182 var fileSearchTuple = section.Tuples.OfType<WixFileSearchTuple>().Single(); 185 Assert.Equal("<FileSearch Id='FileSearchId' Variable='FileSearchVariable' " +
183 Assert.Equal("FileSearchId", fileSearchTuple.Id.Id); 186 $@"Path='%windir%\System32\mscoree.dll' Type='exists' />", utilSearches[1].GetTestXml());
184 Assert.Equal(@"%windir%\System32\mscoree.dll", fileSearchTuple.Path); 187 Assert.Equal("<MsiProductSearch Id='ProductSearchId' Variable='ProductSearchVariable' Condition='1 &amp; 2 &lt; 3' " +
185 Assert.Equal(WixFileSearchAttributes.Default | WixFileSearchAttributes.WantExists, fileSearchTuple.Attributes); 188 "UpgradeCode='{738D02BF-E231-4370-8209-E9FD4E1BE2A1}' Type='version' />", utilSearches[2].GetTestXml());
186 189 Assert.Equal("<RegistrySearch Id='RegistrySearchId' Variable='RegistrySearchVariable' " +
187 var productSearchTuple = section.Tuples.OfType<WixProductSearchTuple>().Single(); 190 @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' VariableType='string' />", utilSearches[3].GetTestXml());
188 Assert.Equal("ProductSearchId", productSearchTuple.Id.Id);
189 Assert.Equal("{738D02BF-E231-4370-8209-E9FD4E1BE2A1}", productSearchTuple.Guid);
190 Assert.Equal(WixProductSearchAttributes.Version | WixProductSearchAttributes.UpgradeCode, productSearchTuple.Attributes);
191
192 var registrySearchTuple = section.Tuples.OfType<WixRegistrySearchTuple>().Single();
193 Assert.Equal("RegistrySearchId", registrySearchTuple.Id.Id);
194 Assert.Equal(RegistryRootType.LocalMachine, registrySearchTuple.Root);
195 Assert.Equal(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", registrySearchTuple.Key);
196 Assert.Equal("Release", registrySearchTuple.Value);
197 Assert.Equal(WixRegistrySearchAttributes.WantValue | WixRegistrySearchAttributes.Raw, registrySearchTuple.Attributes);
198 } 191 }
199 } 192 }
200 193