@joebigelow / wix / commits / f1f75591

Don't clean packages during layout.

Fixes 6871

Sean Hall committed Sep 15, 2022 at 14:51 UTC f1f75591bb723ac7358afa142307fe9574d59956
2 files changed +93 -1
src/burn/engine/plan.cpp
+1 -1
@@ -871,7 +871,7 @@ static HRESULT PlanPackagesHelper(
871 }
872
873 // Passthrough packages are never cleaned up by the calling bundle (they delete themselves when appropriate).
874 - if (!pPlan->fEnabledForwardCompatibleBundle)
874 + if (!pPlan->fEnabledForwardCompatibleBundle && BOOTSTRAPPER_ACTION_LAYOUT != pPlan->action)
875 {
876 // Plan clean up of packages.
877 for (DWORD i = 0; i < cPackages; ++i)
src/burn/test/BurnUnitTest/PlanTest.cpp
+92
@@ -1357,6 +1357,88 @@ namespace Bootstrapper
1357 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"ExeA", BURN_PACKAGE_REGISTRATION_STATE_ABSENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT);
1358 }
1359
1360 + [Fact]
1361 + void SingleExeLayoutTest()
1362 + {
1363 + HRESULT hr = S_OK;
1364 + BURN_ENGINE_STATE engineState = { };
1365 + BURN_ENGINE_STATE* pEngineState = &engineState;
1366 + BURN_PLAN* pPlan = &engineState.plan;
1367 +
1368 + InitializeEngineStateForCorePlan(wzSingleExeManifestFileName, pEngineState);
1369 + DetectAttachedContainerAsAttached(pEngineState);
1370 + DetectPermanentPackagesAsPresentAndCached(pEngineState);
1371 +
1372 + hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_LAYOUT);
1373 + NativeAssert::Succeeded(hr, "CorePlan failed");
1374 +
1375 + Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_LAYOUT, pPlan->action);
1376 + NativeAssert::StringEqual(L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", pPlan->wzBundleId);
1377 + NativeAssert::StringEqual(L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", pPlan->wzBundleProviderKey);
1378 + Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
1379 + Assert::Equal<BOOL>(FALSE, pPlan->fPerMachine);
1380 + Assert::Equal<BOOL>(FALSE, pPlan->fCanAffectMachineState);
1381 + Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1382 + Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1383 + Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1384 + Assert::Equal<DWORD>(0, pPlan->dwRegistrationOperations);
1385 + Assert::True(0 != pPlan->sczLayoutDirectory);
1386 + Assert::NotEqual<WCHAR>(0, *pPlan->sczLayoutDirectory);
1387 +
1388 + BOOL fRollback = FALSE;
1389 + DWORD dwIndex = 0;
1390 + Assert::Equal(dwIndex, pPlan->cRegistrationActions);
1391 +
1392 + fRollback = TRUE;
1393 + dwIndex = 0;
1394 + Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
1395 +
1396 + fRollback = FALSE;
1397 + dwIndex = 0;
1398 + ValidateCacheLayoutBundle(pPlan, fRollback, dwIndex++);
1399 + ValidateCachePackage(pPlan, fRollback, dwIndex++, L"NetFx48Web", TRUE, BURN_CACHE_PACKAGE_TYPE_NONE, BURN_CACHE_PACKAGE_TYPE_NONE);
1400 + ValidateCachePackage(pPlan, fRollback, dwIndex++, L"ExeA", TRUE, BURN_CACHE_PACKAGE_TYPE_NONE, BURN_CACHE_PACKAGE_TYPE_NONE);
1401 + Assert::Equal(dwIndex, pPlan->cCacheActions);
1402 +
1403 + fRollback = TRUE;
1404 + dwIndex = 0;
1405 + Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
1406 +
1407 + Assert::Equal(4321686ull, pPlan->qwCacheSizeTotal);
1408 +
1409 + fRollback = FALSE;
1410 + dwIndex = 0;
1411 + DWORD dwExecuteCheckpointId = 1;
1412 + ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
1413 + ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1414 + ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
1415 + Assert::Equal(dwIndex, pPlan->cExecuteActions);
1416 +
1417 + fRollback = TRUE;
1418 + dwIndex = 0;
1419 + dwExecuteCheckpointId = 1;
1420 + ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
1421 + ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1422 + ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
1423 + Assert::Equal(dwIndex, pPlan->cRollbackActions);
1424 +
1425 + Assert::Equal(0ul, pPlan->cExecutePackagesTotal);
1426 + Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal);
1427 +
1428 + dwIndex = 0;
1429 + Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
1430 +
1431 + dwIndex = 0;
1432 + Assert::Equal(dwIndex, pPlan->cCleanActions);
1433 +
1434 + UINT uIndex = 0;
1435 + ValidatePlannedProvider(pPlan, uIndex++, L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", NULL);
1436 + Assert::Equal(uIndex, pPlan->cPlannedProviders);
1437 +
1438 + Assert::Equal(2ul, pEngineState->packages.cPackages);
1439 + ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"ExeA", BURN_PACKAGE_REGISTRATION_STATE_ABSENT, BURN_PACKAGE_REGISTRATION_STATE_ABSENT);
1440 + }
1441 +
1442 [Fact]
1443 void SingleMsiCacheTest()
1444 {
@@ -3169,6 +3251,16 @@ namespace Bootstrapper
3251 Assert::Equal(dwId, pAction->checkpoint.dwId);
3252 }
3253
3254 + void ValidateCacheLayoutBundle(
3255 + __in BURN_PLAN* pPlan,
3256 + __in BOOL fRollback,
3257 + __in DWORD dwIndex
3258 + )
3259 + {
3260 + BURN_CACHE_ACTION* pAction = ValidateCacheActionExists(pPlan, fRollback, dwIndex);
3261 + Assert::Equal<DWORD>(BURN_CACHE_ACTION_TYPE_LAYOUT_BUNDLE, pAction->type);
3262 + }
3263 +
3264 DWORD ValidateCachePackage(
3265 __in BURN_PLAN* pPlan,
3266 __in BOOL fRollback,