@joebigelow / wix-1 / commits / 716c18b6

Use separate intermediate folders when testing patch missing files

Using separate intermediate folders for the build of baseline and update exposes deeper issues with the code under test. Enhanced test for wixtoolset/issues#6387

Rob Mensching committed Mar 25, 2021 at 06:21 UTC 716c18b695656563c575d26cdfcf1b44c7dc620f
1 file changed +20 -10
src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+20 -10
@@ -93,11 +93,13 @@ namespace WixToolsetTest.CoreIntegration
93
94 using (var fs = new DisposableFileSystem())
95 {
96 - var tempFolder = fs.GetFolder();
96 + var tempFolderBaseline = fs.GetFolder();
97 + var tempFolderUpdate = fs.GetFolder();
98 + var tempFolderPatch = fs.GetFolder();
99
98 - var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
99 - var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
100 - var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", hasNoFiles: true);
100 + var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
101 + var update1Pdb = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
102 + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(update1Pdb) }, hasNoFiles: true);
103 var patchPath = Path.ChangeExtension(patchPdb, ".msp");
104
105 Assert.True(File.Exists(baselinePdb));
@@ -116,9 +118,9 @@ namespace WixToolsetTest.CoreIntegration
118
119 var baselinePdb = BuildMsi("Baseline.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.0", "A", "B");
120 var updatePdb = BuildMsi("Update.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.1", "A", "B");
119 - var patchAPdb = BuildMsp("PatchA.msp", Path.Combine(folder, "PatchA"), tempFolder, "1.0.1", true);
120 - var patchBPdb = BuildMsp("PatchB.msp", Path.Combine(folder, "PatchB"), tempFolder, "1.0.1", true);
121 - var patchCPdb = BuildMsp("PatchC.msp", Path.Combine(folder, "PatchC"), tempFolder, "1.0.1", true);
121 + var patchAPdb = BuildMsp("PatchA.msp", Path.Combine(folder, "PatchA"), tempFolder, "1.0.1", hasNoFiles: true);
122 + var patchBPdb = BuildMsp("PatchB.msp", Path.Combine(folder, "PatchB"), tempFolder, "1.0.1", hasNoFiles: true);
123 + var patchCPdb = BuildMsp("PatchC.msp", Path.Combine(folder, "PatchC"), tempFolder, "1.0.1", hasNoFiles: true);
124 var bundleAPdb = BuildBundle("BundleA.exe", Path.Combine(folder, "BundleA"), tempFolder);
125 var bundleBPdb = BuildBundle("BundleB.exe", Path.Combine(folder, "BundleB"), tempFolder);
126 var bundleCPdb = BuildBundle("BundleC.exe", Path.Combine(folder, "BundleC"), tempFolder);
@@ -206,11 +208,11 @@ namespace WixToolsetTest.CoreIntegration
208 return Path.ChangeExtension(outputPath, ".wixpdb");
209 }
210
209 - private static string BuildMsp(string outputName, string sourceFolder, string baseFolder, string defineV, bool hasNoFiles = false)
211 + private static string BuildMsp(string outputName, string sourceFolder, string baseFolder, string defineV, IEnumerable<string> bindpaths = null, bool hasNoFiles = false)
212 {
213 var outputPath = Path.Combine(baseFolder, Path.Combine("bin", outputName));
214
213 - var result = WixRunner.Execute(new[]
215 + var args = new List<string>
216 {
217 "build",
218 hasNoFiles ? "-sw1079" : " ",
@@ -219,7 +221,15 @@ namespace WixToolsetTest.CoreIntegration
221 "-bindpath", Path.Combine(baseFolder, "bin"),
222 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
223 "-o", outputPath
222 - });
224 + };
225 +
226 + foreach (var additionaBindPath in bindpaths ?? Enumerable.Empty<string>())
227 + {
228 + args.Add("-bindpath");
229 + args.Add(additionaBindPath);
230 + }
231 +
232 + var result = WixRunner.Execute(args.ToArray());
233
234 result.AssertSuccess();
235