aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2025-02-11 13:53:50 -0800
committerRob Mensching <rob@firegiant.com>2025-02-11 15:49:33 -0800
commit040e50ec2859c1de70cd8e9f957474321774f293 (patch)
treecebfe14eccdb3884d5eefc443b285917b6b4a38b
parentccfed95b510f7cd1b205379d0cec50de69c2d850 (diff)
downloadwix-040e50ec2859c1de70cd8e9f957474321774f293.tar.gz
wix-040e50ec2859c1de70cd8e9f957474321774f293.tar.bz2
wix-040e50ec2859c1de70cd8e9f957474321774f293.zip
Rewrite Prereq tests after hardening and bypassing .NET GUI errors
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs11
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json10
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs12
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj2
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs10
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json10
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj2
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs11
-rw-r--r--src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs4
-rw-r--r--src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp20
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs212
11 files changed, 71 insertions, 233 deletions
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs
index a86f498f..5f0fefe5 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs
+++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs
@@ -1,13 +1,11 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> 1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2 2
3
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
5 <Fragment> 4 <Fragment>
6 <BootstrapperApplication Id="BrokenDnc" SourceFile="!(bindpath.dncx86)\TestBA.exe" Secondary="yes"> 5 <BootstrapperApplication Id="BrokenDnc" SourceFile="!(bindpath.dncx86)\TestBA.exe">
7 <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> 6 <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
8 <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" /> 7 <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
9 <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" /> 8 <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
10 <Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" />
11 <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> 9 <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
12 <Payload SourceFile="!(bindpath.dncx86)\WixToolset.BootstrapperApplicationApi.dll" /> 10 <Payload SourceFile="!(bindpath.dncx86)\WixToolset.BootstrapperApplicationApi.dll" />
13 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> 11 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" />
@@ -17,13 +15,12 @@
17 </Fragment> 15 </Fragment>
18 16
19 <Fragment> 17 <Fragment>
20 <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> 18 <util:FileSearch Variable="TestBAConfigPresent" Path="[BARuntimeDirectory]\TestBA.runtimeconfig.json" Result="exists" />
21 <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" />
22 19
23 <PackageGroup Id="BundlePackages"> 20 <PackageGroup Id="BundlePackages">
24 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" 21 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes"
25 Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" 22 Permanent="yes" DetectCondition="TestBAConfigPresent"
26 InstallArguments="&quot;[BARuntimeDirectory]TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]good.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]bad.runtimeconfig.json&quot;" /> 23 InstallArguments="&quot;[BARuntimeDirectory]\TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]\good.runtimeconfig.json&quot;" />
27 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> 24 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" />
28 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" /> 25 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" />
29 </PackageGroup> 26 </PackageGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json
deleted file mode 100644
index 07a1a830..00000000
--- a/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
1{
2 "runtimeOptions": {
3 "tfm": "net5.5",
4 "rollForward": "Disable",
5 "framework": {
6 "name": "Microsoft.WindowsDesktop.App",
7 "version": "5.5.0"
8 }
9 }
10} \ No newline at end of file
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs
index 7a84bd5b..f5745d0f 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs
+++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs
@@ -1,12 +1,9 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> 1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2 2
3
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
5 <Fragment> 4 <Fragment>
6 <BootstrapperApplication Id="BrokenMba" SourceFile="!(bindpath.net2x86)\TestBA.exe" 5 <BootstrapperApplication Id="BrokenMba" SourceFile="!(bindpath.net2x86)\TestBA.exe">
7 Secondary="yes">
8 <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.exe.config" /> 6 <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.exe.config" />
9 <Payload Name="TestBA.exe.config" SourceFile="bad.config" />
10 <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" /> 7 <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" />
11 <Payload SourceFile="!(bindpath.net2x86)\WixToolset.BootstrapperApplicationApi.dll" /> 8 <Payload SourceFile="!(bindpath.net2x86)\WixToolset.BootstrapperApplicationApi.dll" />
12 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> 9 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" />
@@ -16,13 +13,12 @@
16 </Fragment> 13 </Fragment>
17 14
18 <Fragment> 15 <Fragment>
19 <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.config" Result="exists" /> 16 <util:FileSearch Variable="TestBAConfigPresent" Path="[BARuntimeDirectory]\TestBA.exe.config" Result="exists" />
20 <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" />
21 17
22 <PackageGroup Id="BundlePackages"> 18 <PackageGroup Id="BundlePackages">
23 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" 19 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes"
24 Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" 20 Permanent="yes" DetectCondition="TestBAConfigPresent"
25 InstallArguments="&quot;[BARuntimeDirectory]TestBA.exe.config&quot; &quot;[BARuntimeDirectory]good.config&quot; &quot;[BARuntimeDirectory]bad.config&quot;" /> 21 InstallArguments="&quot;[BARuntimeDirectory]TestBA.exe.config&quot; &quot;[BARuntimeDirectory]good.config&quot;" />
26 <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> 22 <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" />
27 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" /> 23 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" />
28 </PackageGroup> 24 </PackageGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj
index 7ed34aa5..27b9c196 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj
+++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj
@@ -2,7 +2,7 @@
2<Project Sdk="WixToolset.Sdk"> 2<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup> 3 <PropertyGroup>
4 <OutputType>Bundle</OutputType> 4 <OutputType>Bundle</OutputType>
5 <BA>BrokenDncAlwaysPrereq</BA> 5 <BA>BrokenDncSecondary</BA>
6 <UpgradeCode>{D2763AB7-979B-485C-AE52-DD03C23CCB93}</UpgradeCode> 6 <UpgradeCode>{D2763AB7-979B-485C-AE52-DD03C23CCB93}</UpgradeCode>
7 </PropertyGroup> 7 </PropertyGroup>
8 <ItemGroup> 8 <ItemGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs
index e03cad62..12607cf0 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs
+++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs
@@ -2,11 +2,10 @@
2 2
3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
4 <Fragment> 4 <Fragment>
5 <BootstrapperApplication Id="BrokenDncAlwaysPrereq" SourceFile="!(bindpath.dncx86)\TestBA.exe" Secondary="true"> 5 <BootstrapperApplication Id="BrokenDncSecondary" SourceFile="!(bindpath.dncx86)\TestBA.exe" Secondary="yes">
6 <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> 6 <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
7 <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" /> 7 <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
8 <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" /> 8 <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
9 <Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" />
10 <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> 9 <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
11 <Payload SourceFile="!(bindpath.dncx86)\WixToolset.BootstrapperApplicationApi.dll" /> 10 <Payload SourceFile="!(bindpath.dncx86)\WixToolset.BootstrapperApplicationApi.dll" />
12 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> 11 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" />
@@ -16,13 +15,12 @@
16 </Fragment> 15 </Fragment>
17 16
18 <Fragment> 17 <Fragment>
19 <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> 18 <util:FileSearch Variable="TestBAConfigPresent" Path="[BARuntimeDirectory]TestBA.runtimeconfig.json" Result="exists" />
20 <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" />
21 19
22 <PackageGroup Id="BundlePackages"> 20 <PackageGroup Id="BundlePackages">
23 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" 21 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes"
24 Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" 22 Permanent="yes" DetectCondition="TestBAConfigPresent"
25 InstallArguments="&quot;[BARuntimeDirectory]TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]good.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]bad.runtimeconfig.json&quot;" /> 23 InstallArguments="&quot;[BARuntimeDirectory]TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]good.runtimeconfig.json&quot;" />
26 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> 24 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" />
27 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" /> 25 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" />
28 </PackageGroup> 26 </PackageGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json
deleted file mode 100644
index 07a1a830..00000000
--- a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
1{
2 "runtimeOptions": {
3 "tfm": "net5.5",
4 "rollForward": "Disable",
5 "framework": {
6 "name": "Microsoft.WindowsDesktop.App",
7 "version": "5.5.0"
8 }
9 }
10} \ No newline at end of file
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj
index 280193df..1888bc7d 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj
+++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj
@@ -2,7 +2,7 @@
2<Project Sdk="WixToolset.Sdk"> 2<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup> 3 <PropertyGroup>
4 <OutputType>Bundle</OutputType> 4 <OutputType>Bundle</OutputType>
5 <BA>BrokenMbaAlwaysPrereq</BA> 5 <BA>BrokenMbaSecondary</BA>
6 <UpgradeCode>{415CA128-60E1-4D16-ACE8-A1D43E98B997}</UpgradeCode> 6 <UpgradeCode>{415CA128-60E1-4D16-ACE8-A1D43E98B997}</UpgradeCode>
7 </PropertyGroup> 7 </PropertyGroup>
8 <ItemGroup> 8 <ItemGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs
index 2eed4bd1..1b414cb2 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs
+++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs
@@ -1,11 +1,9 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> 1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2 2
3
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
5 <Fragment> 4 <Fragment>
6 <BootstrapperApplication Id="BrokenMbaAlwaysPrereq" SourceFile="!(bindpath.net2x86)\TestBA.exe" Secondary="true"> 5 <BootstrapperApplication Id="BrokenMbaSecondary" SourceFile="!(bindpath.net2x86)\TestBA.exe" Secondary="true">
7 <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.exe.config" /> 6 <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.exe.config" />
8 <Payload Name="TestBA.exe.config" SourceFile="bad.config" />
9 <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" /> 7 <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" />
10 <Payload SourceFile="!(bindpath.net2x86)\WixToolset.BootstrapperApplicationApi.dll" /> 8 <Payload SourceFile="!(bindpath.net2x86)\WixToolset.BootstrapperApplicationApi.dll" />
11 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> 9 <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" />
@@ -15,13 +13,12 @@
15 </Fragment> 13 </Fragment>
16 14
17 <Fragment> 15 <Fragment>
18 <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.config" Result="exists" /> 16 <util:FileSearch Variable="TestBAConfigPresent" Path="[BARuntimeDirectory]\TestBA.exe.config" Result="exists" />
19 <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" />
20 17
21 <PackageGroup Id="BundlePackages"> 18 <PackageGroup Id="BundlePackages">
22 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" 19 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes"
23 Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" 20 Permanent="yes" DetectCondition="TestBAConfigPresent"
24 InstallArguments="&quot;[BARuntimeDirectory]TestBA.exe.config&quot; &quot;[BARuntimeDirectory]good.config&quot; &quot;[BARuntimeDirectory]bad.config&quot;" /> 21 InstallArguments="&quot;[BARuntimeDirectory]TestBA.exe.config&quot; &quot;[BARuntimeDirectory]good.config&quot;" />
25 <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> 22 <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" />
26 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" /> 23 <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" />
27 </PackageGroup> 24 </PackageGroup>
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs
index b6962b65..b994847e 100644
--- a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs
+++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs
@@ -14,11 +14,11 @@
14 </Fragment> 14 </Fragment>
15 15
16 <Fragment> 16 <Fragment>
17 <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> 17 <util:FileSearch Variable="TestBAConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" />
18 18
19 <PackageGroup Id="BundlePackages"> 19 <PackageGroup Id="BundlePackages">
20 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" 20 <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes"
21 Permanent="yes" DetectCondition="NOT GoodConfigPresent" 21 Permanent="yes" DetectCondition="NOT TestBAConfigPresent"
22 InstallArguments="&quot;[BARuntimeDirectory]TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]good.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]bad.runtimeconfig.json&quot;" /> 22 InstallArguments="&quot;[BARuntimeDirectory]TestBA.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]good.runtimeconfig.json&quot; &quot;[BARuntimeDirectory]bad.runtimeconfig.json&quot;" />
23 </PackageGroup> 23 </PackageGroup>
24 </Fragment> 24 </Fragment>
diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp
index 1fa71bc2..b8172e6b 100644
--- a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp
+++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp
@@ -7,27 +7,31 @@ int __cdecl wmain(
7 __in LPWSTR argv[] 7 __in LPWSTR argv[]
8 ) 8 )
9{ 9{
10 DWORD er = ERROR_SUCCESS;
10 HRESULT hr = S_OK; 11 HRESULT hr = S_OK;
11 DWORD dwExitCode = 0;
12 LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL; 12 LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL;
13 LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL; 13 LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL;
14 LPCWSTR wzBadFile = argc > 3 ? argv[3] : NULL; 14 LPCWSTR wzBackupFile = argc > 3 ? argv[3] : NULL;
15 15
16 if (argc != 4) 16 if (!wzDestinationFile || !*wzDestinationFile || !wzGoodFile || !*wzGoodFile)
17 { 17 {
18 ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args"); 18 ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args");
19 } 19 }
20 20
21 if (!::MoveFileW(wzDestinationFile, wzBadFile)) 21 if (wzBackupFile && *wzBackupFile && !::CopyFileW(wzDestinationFile, wzBackupFile, FALSE))
22 { 22 {
23 ExitWithLastError(hr, "Failed to move bad file"); 23 er = ::GetLastError();
24 if (ERROR_PATH_NOT_FOUND != er && ERROR_FILE_NOT_FOUND != er)
25 {
26 ExitOnWin32Error(er, hr, "Failed to copy to backup file");
27 }
24 } 28 }
25 29
26 if (!::MoveFileW(wzGoodFile, wzDestinationFile)) 30 if (!::CopyFileW(wzGoodFile, wzDestinationFile, FALSE))
27 { 31 {
28 ExitWithLastError(hr, "Failed to move good file"); 32 ExitWithLastError(hr, "Failed to copy in good file");
29 } 33 }
30 34
31LExit: 35LExit:
32 return FAILED(hr) ? (int)hr : (int)dwExitCode; 36 return FAILED(hr) ? (int)hr : (int)0;
33} 37}
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs
index 4fccb0e9..bc21458d 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs
@@ -12,22 +12,21 @@ namespace WixToolsetTest.BurnE2E
12 { 12 {
13 public PrereqBaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } 13 public PrereqBaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
14 14
15 const int E_PREREQBA_INFINITE_LOOP = -2_114_714_646;
16
17 /// <summary> 15 /// <summary>
18 /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, 16 /// This bundle purposely misnames its .runtimeconfig.json file to force the PreqBA to kick in
19 /// with an MSI package to represent the prerequisite package. 17 /// and use its EXE prereq package to swap in a good one.
20 /// This verifies that: 18 /// This verifies that:
21 /// The preqba doesn't infinitely try to install prereqs. 19 /// The mangaged BA fails to load due to the missing file.
22 /// The engine automatically uninstalls the bundle since only permanent packages were installed. 20 /// The preqba kicks in to copy in the file.
21 /// The managed BA gets loaded.
23 /// </summary> 22 /// </summary>
24 [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")] 23 [RuntimeFact]
25 public void DncAlwaysPreqBaDetectsInfiniteLoop() 24 public void DncLoadsOnlyAfterInstallingPrereqs()
26 { 25 {
27 var packageA = this.CreatePackageInstaller("PackageA"); 26 var packageA = this.CreatePackageInstaller("PackageA");
28 var packageC = this.CreatePackageInstaller("PackageC"); 27 var packageC = this.CreatePackageInstaller("PackageC");
29 28
30 var bundleC = this.CreateBundleInstaller("BundleC"); 29 var bundleA = this.CreateBundleInstaller("BundleA");
31 30
32 var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); 31 var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
33 32
@@ -35,60 +34,28 @@ namespace WixToolsetTest.BurnE2E
35 Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); 34 Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
36 packageC.VerifyInstalled(false); 35 packageC.VerifyInstalled(false);
37 36
38 bundleC.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); 37 bundleA.Install();
39
40 // Part of the test is Install actually completing.
41 38
42 // Source file should be installed 39 // Source file should be installed
43 Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); 40 Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
44 packageC.VerifyInstalled(false); 41 packageC.VerifyInstalled(true);
45
46 // No non-permanent packages should have ended up installed or cached so it should have unregistered.
47 bundleC.VerifyUnregisteredAndRemovedFromPackageCache();
48 }
49
50 /// <summary>
51 /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist,
52 /// with an MSI package to represent the prerequisite package.
53 /// This verifies that:
54 /// The preqba doesn't infinitely reload itself after failing to load the managed BA.
55 /// The engine automatically uninstalls the bundle since only permanent packages were installed.
56 /// </summary>
57 [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")]
58 public void DncPreqBaDetectsInfiniteLoop()
59 {
60 var packageA = this.CreatePackageInstaller("PackageA");
61 var packageC = this.CreatePackageInstaller("PackageC");
62
63 var bundleA = this.CreateBundleInstaller("BundleA");
64
65 var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
66
67 // Source file should *not* be installed
68 Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
69 packageC.VerifyInstalled(false);
70
71 bundleA.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1");
72 42
73 // Part of the test is Install actually completing. 43 bundleA.VerifyRegisteredAndInPackageCache();
74 44
75 // Source file should be installed 45 bundleA.Uninstall();
76 Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
77 packageC.VerifyInstalled(false);
78 46
79 // No non-permanent packages should have ended up installed or cached so it should have unregistered.
80 bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); 47 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
81 } 48 }
82 49
83 /// <summary> 50 /// <summary>
84 /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, 51 /// This bundle purposely misnames its .runtimeconfig.json file to force the PreqBA to kick in
85 /// with an EXE prereq package to swap it out with a good one. 52 /// and use its EXE prereq package to swap in a good one.
86 /// This verifies that: 53 /// This verifies that:
87 /// The preqba doesn't infinitely try to install prereqs. 54 /// The preqba runs first to fix the file.
88 /// The managed BA gets loaded after installing prereqs. 55 /// The managed BA gets loaded on first try.
89 /// </summary> 56 /// </summary>
90 [RuntimeFact] 57 [RuntimeFact]
91 public void DncAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() 58 public void DncPreqsFirstThenBaLoadsManagedBa()
92 { 59 {
93 var packageA = this.CreatePackageInstaller("PackageA"); 60 var packageA = this.CreatePackageInstaller("PackageA");
94 var packageC = this.CreatePackageInstaller("PackageC"); 61 var packageC = this.CreatePackageInstaller("PackageC");
@@ -114,64 +81,20 @@ namespace WixToolsetTest.BurnE2E
114 bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); 81 bundleC.VerifyUnregisteredAndRemovedFromPackageCache();
115 } 82 }
116 83
117 /// <summary> 84 /// This bundle purposely misnames its WixToolset.Mba.Host.config file to force the PreqBA to kick in
118 /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, 85 /// and use its EXE prereq package to swap in a good one.
119 /// with an EXE prereq package to swap it out with a good one.
120 /// This verifies that: 86 /// This verifies that:
121 /// The preqba doesn't infinitely reload itself after failing to load the managed BA. 87 /// The mangaged BA fails to load due to the missing file.
122 /// The managed BA gets loaded after installing prereqs. 88 /// The preqba kicks in to copy in the file.
89 /// The managed BA gets loaded.
123 /// </summary> 90 /// </summary>
124 [RuntimeFact] 91 [RuntimeFact(Skip = "It is no longer possible to replace the bad.config with a good config, these tests do not work for .NET Framework the way they can for .NET above.")]
125 public void DncPreqBaLoadsManagedBaAfterInstallingPrereqs() 92 public void MbaLoadsOnlyAfterInstallingPrereqs()
126 {
127 var packageA = this.CreatePackageInstaller("PackageA");
128 var packageC = this.CreatePackageInstaller("PackageC");
129
130 var bundleA = this.CreateBundleInstaller("BundleA");
131
132 var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
133
134 // Source file should *not* be installed
135 Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
136 packageC.VerifyInstalled(false);
137
138 bundleA.Install();
139
140 // Source file should be installed
141 Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
142 packageC.VerifyInstalled(true);
143
144 bundleA.VerifyRegisteredAndInPackageCache();
145
146 bundleA.Uninstall();
147
148 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
149 }
150
151 [RuntimeFact]
152 public void DncAlwaysPreqBaForwardsHelpToManagedBa()
153 {
154 var bundleE = this.CreateBundleInstaller("BundleE");
155
156 var bundleLog = bundleE.Help();
157
158 Assert.True(LogVerifier.MessageInLogFile(bundleLog, "This is a BA for automated testing"));
159 }
160
161 /// <summary>
162 /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist,
163 /// with an MSI package to represent the prerequisite package.
164 /// This verifies that:
165 /// The preqba doesn't infinitely try to install prereqs.
166 /// The engine automatically uninstalls the bundle since only permanent packages were installed.
167 /// </summary>
168 [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")]
169 public void MbaAlwaysPreqBaDetectsInfiniteLoop()
170 { 93 {
171 var packageB = this.CreatePackageInstaller("PackageB"); 94 var packageB = this.CreatePackageInstaller("PackageB");
172 var packageC = this.CreatePackageInstaller("PackageC"); 95 var packageC = this.CreatePackageInstaller("PackageC");
173 96
174 var bundleD = this.CreateBundleInstaller("BundleD"); 97 var bundleB = this.CreateBundleInstaller("BundleB");
175 98
176 var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); 99 var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs");
177 100
@@ -179,60 +102,28 @@ namespace WixToolsetTest.BurnE2E
179 Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); 102 Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}");
180 packageC.VerifyInstalled(false); 103 packageC.VerifyInstalled(false);
181 104
182 bundleD.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); 105 bundleB.Install();
183
184 // Part of the test is Install actually completing.
185 106
186 // Source file should be installed 107 // Source file should be installed
187 Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); 108 Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled));
188 packageC.VerifyInstalled(false); 109 packageC.VerifyInstalled(true);
189
190 // No non-permanent packages should have ended up installed or cached so it should have unregistered.
191 bundleD.VerifyUnregisteredAndRemovedFromPackageCache();
192 }
193
194 /// <summary>
195 /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist,
196 /// with an MSI package to represent the prerequisite package.
197 /// This verifies that:
198 /// The preqba doesn't infinitely reload itself after failing to load the managed BA.
199 /// The engine automatically uninstalls the bundle since only permanent packages were installed.
200 /// </summary>
201 [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")]
202 public void MbaPreqBaDetectsInfiniteLoop()
203 {
204 var packageB = this.CreatePackageInstaller("PackageB");
205 var packageC = this.CreatePackageInstaller("PackageC");
206
207 var bundleB = this.CreateBundleInstaller("BundleB");
208
209 var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs");
210
211 // Source file should *not* be installed
212 Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}");
213 packageC.VerifyInstalled(false);
214
215 bundleB.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1");
216 110
217 // Part of the test is Install actually completing. 111 bundleB.VerifyRegisteredAndInPackageCache();
218 112
219 // Source file should be installed 113 bundleB.Uninstall();
220 Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled));
221 packageC.VerifyInstalled(false);
222 114
223 // No non-permanent packages should have ended up installed or cached so it should have unregistered. 115 // No non-permanent packages should have ended up installed or cached so it should have unregistered.
224 bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); 116 bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
225 } 117 }
226 118
227 /// <summary> 119 /// This bundle purposely misnames its WixToolset.Mba.Host.config file to force the PreqBA to kick in
228 /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, 120 /// and use its EXE prereq package to swap in a good one.
229 /// with an EXE prereq package to swap it out with a good one.
230 /// This verifies that: 121 /// This verifies that:
231 /// The preqba doesn't infinitely try to install prereqs. 122 /// The preqba runs first to fix the file.
232 /// The managed BA gets loaded after installing prereqs. 123 /// The managed BA gets loaded on first try.
233 /// </summary> 124 /// </summary>
234 [RuntimeFact] 125 [RuntimeFact(Skip = "It is no longer possible to replace the bad.config with a good config, these tests do not work for .NET Framework the way they can for .NET above.")]
235 public void MbaAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() 126 public void MbaPreqsFirstThenBaLoadsManagedBa()
236 { 127 {
237 var packageB = this.CreatePackageInstaller("PackageB"); 128 var packageB = this.CreatePackageInstaller("PackageB");
238 var packageC = this.CreatePackageInstaller("PackageC"); 129 var packageC = this.CreatePackageInstaller("PackageC");
@@ -258,39 +149,14 @@ namespace WixToolsetTest.BurnE2E
258 bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); 149 bundleD.VerifyUnregisteredAndRemovedFromPackageCache();
259 } 150 }
260 151
261 /// <summary>
262 /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist,
263 /// with an EXE prereq package to swap it out with a good one.
264 /// This verifies that:
265 /// The preqba doesn't infinitely reload itself after failing to load the managed BA.
266 /// The managed BA gets loaded after installing prereqs.
267 /// </summary>
268 [RuntimeFact] 152 [RuntimeFact]
269 public void MbaPreqBaLoadsManagedBaAfterInstallingPrereqs() 153 public void DncAlwaysPreqBaForwardsHelpToManagedBa()
270 { 154 {
271 var packageB = this.CreatePackageInstaller("PackageB"); 155 var bundleE = this.CreateBundleInstaller("BundleE");
272 var packageC = this.CreatePackageInstaller("PackageC");
273
274 var bundleB = this.CreateBundleInstaller("BundleB");
275
276 var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs");
277
278 // Source file should *not* be installed
279 Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}");
280 packageC.VerifyInstalled(false);
281
282 bundleB.Install();
283
284 // Source file should be installed
285 Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled));
286 packageC.VerifyInstalled(true);
287
288 bundleB.VerifyRegisteredAndInPackageCache();
289 156
290 bundleB.Uninstall(); 157 var bundleLog = bundleE.Help();
291 158
292 // No non-permanent packages should have ended up installed or cached so it should have unregistered. 159 Assert.True(LogVerifier.MessageInLogFile(bundleLog, "This is a BA for automated testing"));
293 bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
294 } 160 }
295 } 161 }
296} 162}