aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-09-23 17:59:51 -0700
committerRob Mensching <rob@firegiant.com>2022-09-27 16:25:20 -0700
commitcdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c (patch)
tree82a46758929c04673ddaba2ca20370d08febd364
parent038b93757c3fe329d8943cae55b16536c4718b60 (diff)
downloadwix-cdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c.tar.gz
wix-cdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c.tar.bz2
wix-cdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c.zip
Add patch error test to validate missing baseline patch file
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs22
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs14
2 files changed, 36 insertions, 0 deletions
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
index b4921080..945c346b 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
@@ -372,6 +372,28 @@ namespace WixToolsetTest.CoreIntegration
372 } 372 }
373 } 373 }
374 374
375 [Fact]
376 public void CannotBuildPatchWithMissingBaseline()
377 {
378 var sourceFolder = TestData.Get(@"TestData", "PatchWithMissingBaseline");
379
380 using (var fs = new DisposableFileSystem())
381 {
382 var baseFolder = fs.GetFolder();
383 var tempFolderPatch = Path.Combine(baseFolder, "patch");
384 var templateBaselineFolder = Path.GetDirectoryName(this.templateBaselinePdb);
385 var templateUpdateFolder = Path.GetDirectoryName(this.templateUpdatePdb);
386
387 var result = BuildMspForResult("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { templateBaselineFolder, templateUpdateFolder });
388
389 var messages = result.Messages.Select(m => m.ToString().Replace(tempFolderPatch, "<tempFolderPatch>").Replace(templateBaselineFolder, "<templateBaselineFolder>").Replace(templateUpdateFolder, "<templateUpdateFolder>")).ToArray();
390 WixAssert.CompareLineByLine(new[]
391 {
392 @"The system cannot find the file 'Missing.wixpdb' with type 'WixPatchBaseline'. The following paths were checked: Missing.wixpdb, <tempFolderPatch>\bin\Missing.wixpdb, <templateBaselineFolder>\Missing.wixpdb, <templateUpdateFolder>\Missing.wixpdb",
393 }, messages);
394 }
395 }
396
375 private static string BuildMsi(string outputName, string sourceFolder, string baseFolder, string defineV, string defineA, string defineB, IEnumerable<string> bindpaths = null) 397 private static string BuildMsi(string outputName, string sourceFolder, string baseFolder, string defineV, string defineA, string defineB, IEnumerable<string> bindpaths = null)
376 { 398 {
377 var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); 399 var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath);
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs
new file mode 100644
index 00000000..acd4f2d8
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs
@@ -0,0 +1,14 @@
1<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>
2 <Patch
3 AllowRemoval="yes"
4 DisplayName="~Test Patch v$(V)"
5 Description="~Test Small Update Patch v$(V)"
6 MoreInfoURL="http://www.example.com/"
7 Manufacturer="Example Corporation"
8 Classification="Update">
9
10 <Media Id="1" Cabinet="foo.cab">
11 <PatchBaseline Id="RTM" BaselineFile="Missing.wixpdb" UpdateFile="Update.wixpdb" />
12 </Media>
13 </Patch>
14</Wix>