From cdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 23 Sep 2022 17:59:51 -0700 Subject: Add patch error test to validate missing baseline patch file --- .../WixToolsetTest.CoreIntegration/PatchFixture.cs | 22 ++++++++++++++++++++++ .../TestData/PatchWithMissingBaseline/Patch.wxs | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs 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 } } + [Fact] + public void CannotBuildPatchWithMissingBaseline() + { + var sourceFolder = TestData.Get(@"TestData", "PatchWithMissingBaseline"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var tempFolderPatch = Path.Combine(baseFolder, "patch"); + var templateBaselineFolder = Path.GetDirectoryName(this.templateBaselinePdb); + var templateUpdateFolder = Path.GetDirectoryName(this.templateUpdatePdb); + + var result = BuildMspForResult("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { templateBaselineFolder, templateUpdateFolder }); + + var messages = result.Messages.Select(m => m.ToString().Replace(tempFolderPatch, "").Replace(templateBaselineFolder, "").Replace(templateUpdateFolder, "")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + @"The system cannot find the file 'Missing.wixpdb' with type 'WixPatchBaseline'. The following paths were checked: Missing.wixpdb, \bin\Missing.wixpdb, \Missing.wixpdb, \Missing.wixpdb", + }, messages); + } + } + private static string BuildMsi(string outputName, string sourceFolder, string baseFolder, string defineV, string defineA, string defineB, IEnumerable bindpaths = null) { 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 @@ + + + + + + + + -- cgit v1.2.3-55-g6feb