aboutsummaryrefslogtreecommitdiff
path: root/src/burn/test/BurnUnitTest/PlanTest.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-06-09 15:30:48 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-06-13 09:28:49 -0500
commit6f6e4ced9f398ff37a44b91fdba62479cde29d06 (patch)
tree8cef5b123df7ff11cdc9be79d2e981d9d567d65d /src/burn/test/BurnUnitTest/PlanTest.cpp
parent68ec803fc7f48bb0e0463dc45f6ce40e1f07dbf5 (diff)
downloadwix-6f6e4ced9f398ff37a44b91fdba62479cde29d06.tar.gz
wix-6f6e4ced9f398ff37a44b91fdba62479cde29d06.tar.bz2
wix-6f6e4ced9f398ff37a44b91fdba62479cde29d06.zip
Implement ArpEntry flavored ExePackage.
6772
Diffstat (limited to 'src/burn/test/BurnUnitTest/PlanTest.cpp')
-rw-r--r--src/burn/test/BurnUnitTest/PlanTest.cpp261
1 files changed, 261 insertions, 0 deletions
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp
index be078c5c..2135d9f5 100644
--- a/src/burn/test/BurnUnitTest/PlanTest.cpp
+++ b/src/burn/test/BurnUnitTest/PlanTest.cpp
@@ -9,6 +9,7 @@ static HRESULT WINAPI PlanTestBAProc(
9 __in_opt LPVOID pvContext 9 __in_opt LPVOID pvContext
10 ); 10 );
11 11
12static LPCWSTR wzArpEntryExeManifestFileName = L"ExePackage_PerUserArpEntry_manifest.xml";
12static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml"; 13static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml";
13static LPCWSTR wzMultipleBundlePackageManifestFileName = L"BundlePackage_Multiple_manifest.xml"; 14static LPCWSTR wzMultipleBundlePackageManifestFileName = L"BundlePackage_Multiple_manifest.xml";
14static LPCWSTR wzSingleExeManifestFileName = L"Failure_BundleD_manifest.xml"; 15static LPCWSTR wzSingleExeManifestFileName = L"Failure_BundleD_manifest.xml";
@@ -48,6 +49,266 @@ namespace Bootstrapper
48 } 49 }
49 50
50 [Fact] 51 [Fact]
52 void ArpEntryExeInstallTest()
53 {
54 HRESULT hr = S_OK;
55 BURN_ENGINE_STATE engineState = { };
56 BURN_ENGINE_STATE* pEngineState = &engineState;
57 BURN_PLAN* pPlan = &engineState.plan;
58
59 InitializeEngineStateForCorePlan(wzArpEntryExeManifestFileName, pEngineState);
60 DetectAttachedContainerAsAttached(pEngineState);
61 DetectPermanentPackagesAsPresentAndCached(pEngineState);
62
63 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL);
64 NativeAssert::Succeeded(hr, "CorePlan failed");
65
66 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action);
67 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleId);
68 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleProviderKey);
69 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
70 Assert::Equal<BOOL>(FALSE, pPlan->fPerMachine);
71 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
72 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
73 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
74 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
75 Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
76
77 BOOL fRollback = FALSE;
78 DWORD dwIndex = 0;
79 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
80 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
81
82 fRollback = TRUE;
83 dwIndex = 0;
84 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
85 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
86
87 fRollback = FALSE;
88 dwIndex = 0;
89 ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 1);
90 ValidateCachePackage(pPlan, fRollback, dwIndex++, L"TestExe");
91 ValidateCacheSignalSyncpoint(pPlan, fRollback, dwIndex++);
92 Assert::Equal(dwIndex, pPlan->cCacheActions);
93
94 fRollback = TRUE;
95 dwIndex = 0;
96 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
97
98 Assert::Equal(119695ull, pPlan->qwCacheSizeTotal);
99
100 fRollback = FALSE;
101 dwIndex = 0;
102 DWORD dwExecuteCheckpointId = 2;
103 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
104 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
105 ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"TestExe");
106 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
107 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"TestExe", BOOTSTRAPPER_ACTION_STATE_INSTALL);
108 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
109 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
110 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
111 Assert::Equal(dwIndex, pPlan->cExecuteActions);
112
113 fRollback = TRUE;
114 dwIndex = 0;
115 dwExecuteCheckpointId = 2;
116 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
117 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
118 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"TestExe", BOOTSTRAPPER_ACTION_STATE_UNINSTALL);
119 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
120 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
121 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
122 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
123 Assert::Equal(dwIndex, pPlan->cRollbackActions);
124
125 Assert::Equal(1ul, pPlan->cExecutePackagesTotal);
126 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
127
128 dwIndex = 0;
129 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
130
131 dwIndex = 0;
132 ValidateCleanAction(pPlan, dwIndex++, L"NetFx48Web");
133 Assert::Equal(dwIndex, pPlan->cCleanActions);
134
135 UINT uIndex = 0;
136 ValidatePlannedProvider(pPlan, uIndex++, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", NULL);
137 Assert::Equal(uIndex, pPlan->cPlannedProviders);
138
139 Assert::Equal(2ul, pEngineState->packages.cPackages);
140 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"TestExe", BURN_PACKAGE_REGISTRATION_STATE_PRESENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT);
141 }
142
143 [Fact]
144 void ArpEntryExeInstallObsoleteTest()
145 {
146 HRESULT hr = S_OK;
147 BURN_ENGINE_STATE engineState = { };
148 BURN_ENGINE_STATE* pEngineState = &engineState;
149 BURN_PLAN* pPlan = &engineState.plan;
150
151 InitializeEngineStateForCorePlan(wzArpEntryExeManifestFileName, pEngineState);
152 DetectAttachedContainerAsAttached(pEngineState);
153 DetectPermanentPackagesAsPresentAndCached(pEngineState);
154
155 pEngineState->packages.rgPackages[1].currentState = BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE;
156
157 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL);
158 NativeAssert::Succeeded(hr, "CorePlan failed");
159
160 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action);
161 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleId);
162 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleProviderKey);
163 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
164 Assert::Equal<BOOL>(FALSE, pPlan->fPerMachine);
165 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
166 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
167 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
168 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
169 Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
170
171 BOOL fRollback = FALSE;
172 DWORD dwIndex = 0;
173 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
174 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
175
176 fRollback = TRUE;
177 dwIndex = 0;
178 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
179 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
180
181 fRollback = FALSE;
182 dwIndex = 0;
183 Assert::Equal(dwIndex, pPlan->cCacheActions);
184
185 fRollback = TRUE;
186 dwIndex = 0;
187 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
188
189 Assert::Equal(0ull, pPlan->qwCacheSizeTotal);
190
191 fRollback = FALSE;
192 dwIndex = 0;
193 DWORD dwExecuteCheckpointId = 1;
194 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
195 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
196 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
197 Assert::Equal(dwIndex, pPlan->cExecuteActions);
198
199 fRollback = TRUE;
200 dwIndex = 0;
201 dwExecuteCheckpointId = 1;
202 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
203 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
204 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
205 Assert::Equal(dwIndex, pPlan->cRollbackActions);
206
207 Assert::Equal(0ul, pPlan->cExecutePackagesTotal);
208 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal);
209
210 dwIndex = 0;
211 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
212
213 dwIndex = 0;
214 ValidateCleanAction(pPlan, dwIndex++, L"NetFx48Web");
215 Assert::Equal(dwIndex, pPlan->cCleanActions);
216
217 UINT uIndex = 0;
218 ValidatePlannedProvider(pPlan, uIndex++, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", NULL);
219 Assert::Equal(uIndex, pPlan->cPlannedProviders);
220
221 Assert::Equal(2ul, pEngineState->packages.cPackages);
222 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"TestExe", BURN_PACKAGE_REGISTRATION_STATE_ABSENT, BURN_PACKAGE_REGISTRATION_STATE_ABSENT);
223 }
224
225 [Fact]
226 void ArpEntryExeUninstallTest()
227 {
228 HRESULT hr = S_OK;
229 BURN_ENGINE_STATE engineState = { };
230 BURN_ENGINE_STATE* pEngineState = &engineState;
231 BURN_PLAN* pPlan = &engineState.plan;
232
233 InitializeEngineStateForCorePlan(wzArpEntryExeManifestFileName, pEngineState);
234 DetectPackagesAsPresentAndCached(pEngineState);
235
236 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_UNINSTALL);
237 NativeAssert::Succeeded(hr, "CorePlan failed");
238
239 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_UNINSTALL, pPlan->action);
240 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleId);
241 NativeAssert::StringEqual(L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", pPlan->wzBundleProviderKey);
242 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
243 Assert::Equal<BOOL>(FALSE, pPlan->fPerMachine);
244 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
245 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
246 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
247 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
248 Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
249
250 BOOL fRollback = FALSE;
251 DWORD dwIndex = 0;
252 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
253 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
254
255 fRollback = TRUE;
256 dwIndex = 0;
257 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}");
258 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
259
260 fRollback = FALSE;
261 dwIndex = 0;
262 Assert::Equal(dwIndex, pPlan->cCacheActions);
263
264 fRollback = TRUE;
265 dwIndex = 0;
266 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
267
268 Assert::Equal(0ull, pPlan->qwCacheSizeTotal);
269
270 fRollback = FALSE;
271 dwIndex = 0;
272 DWORD dwExecuteCheckpointId = 1;
273 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
274 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
275 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"TestExe", BOOTSTRAPPER_ACTION_STATE_UNINSTALL);
276 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
277 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
278 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
279 Assert::Equal(dwIndex, pPlan->cExecuteActions);
280
281 fRollback = TRUE;
282 dwIndex = 0;
283 dwExecuteCheckpointId = 1;
284 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
285 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"TestExe", BOOTSTRAPPER_ACTION_STATE_INSTALL);
286 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
287 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
288 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
289 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
290 Assert::Equal(dwIndex, pPlan->cRollbackActions);
291
292 Assert::Equal(1ul, pPlan->cExecutePackagesTotal);
293 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal);
294
295 dwIndex = 0;
296 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
297
298 dwIndex = 0;
299 ValidateCleanAction(pPlan, dwIndex++, L"TestExe");
300 ValidateCleanAction(pPlan, dwIndex++, L"NetFx48Web");
301 Assert::Equal(dwIndex, pPlan->cCleanActions);
302
303 UINT uIndex = 0;
304 ValidatePlannedProvider(pPlan, uIndex++, L"{9C459DAD-0E64-40C8-8C9F-4F68E46AB223}", NULL);
305 Assert::Equal(uIndex, pPlan->cPlannedProviders);
306
307 Assert::Equal(2ul, pEngineState->packages.cPackages);
308 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"TestExe", BURN_PACKAGE_REGISTRATION_STATE_ABSENT, BURN_PACKAGE_REGISTRATION_STATE_ABSENT);
309 }
310
311 [Fact]
51 void MsiTransactionInstallTest() 312 void MsiTransactionInstallTest()
52 { 313 {
53 HRESULT hr = S_OK; 314 HRESULT hr = S_OK;