diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-30 17:08:40 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-01 22:06:11 -0500 |
| commit | 386a3578413ba16b3c0615d47870ee44a0e461f6 (patch) | |
| tree | 1dfcea9e5080f1f15cc880aba1541a962426c58b /src/burn/test/BurnUnitTest/PlanTest.cpp | |
| parent | d97c0d1685ef4c3840776327e76ce25d4dbdbeb1 (diff) | |
| download | wix-386a3578413ba16b3c0615d47870ee44a0e461f6.tar.gz wix-386a3578413ba16b3c0615d47870ee44a0e461f6.tar.bz2 wix-386a3578413ba16b3c0615d47870ee44a0e461f6.zip | |
Implement BundlePackage.
3693
Diffstat (limited to 'src/burn/test/BurnUnitTest/PlanTest.cpp')
| -rw-r--r-- | src/burn/test/BurnUnitTest/PlanTest.cpp | 141 |
1 files changed, 135 insertions, 6 deletions
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp index 143ca7d7..536e5351 100644 --- a/src/burn/test/BurnUnitTest/PlanTest.cpp +++ b/src/burn/test/BurnUnitTest/PlanTest.cpp | |||
| @@ -10,6 +10,7 @@ static HRESULT WINAPI PlanTestBAProc( | |||
| 10 | ); | 10 | ); |
| 11 | 11 | ||
| 12 | static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml"; | 12 | static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml"; |
| 13 | static LPCWSTR wzMultipleBundlePackageManifestFileName = L"BundlePackage_Multiple_manifest.xml"; | ||
| 13 | static LPCWSTR wzSingleExeManifestFileName = L"Failure_BundleD_manifest.xml"; | 14 | static LPCWSTR wzSingleExeManifestFileName = L"Failure_BundleD_manifest.xml"; |
| 14 | static LPCWSTR wzSingleMsiManifestFileName = L"BasicFunctionality_BundleA_manifest.xml"; | 15 | static LPCWSTR wzSingleMsiManifestFileName = L"BasicFunctionality_BundleA_manifest.xml"; |
| 15 | static LPCWSTR wzSingleMsuManifestFileName = L"MsuPackageFixture_manifest.xml"; | 16 | static LPCWSTR wzSingleMsuManifestFileName = L"MsuPackageFixture_manifest.xml"; |
| @@ -340,6 +341,121 @@ namespace Bootstrapper | |||
| 340 | } | 341 | } |
| 341 | 342 | ||
| 342 | [Fact] | 343 | [Fact] |
| 344 | void MultipleBundlePackageInstallTest() | ||
| 345 | { | ||
| 346 | HRESULT hr = S_OK; | ||
| 347 | BURN_ENGINE_STATE engineState = { }; | ||
| 348 | BURN_ENGINE_STATE* pEngineState = &engineState; | ||
| 349 | BURN_PLAN* pPlan = &engineState.plan; | ||
| 350 | |||
| 351 | InitializeEngineStateForCorePlan(wzMultipleBundlePackageManifestFileName, pEngineState); | ||
| 352 | DetectAttachedContainerAsAttached(pEngineState); | ||
| 353 | DetectPermanentPackagesAsPresentAndCached(pEngineState); | ||
| 354 | |||
| 355 | hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL); | ||
| 356 | NativeAssert::Succeeded(hr, "CorePlan failed"); | ||
| 357 | |||
| 358 | Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action); | ||
| 359 | NativeAssert::StringEqual(L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", pPlan->wzBundleId); | ||
| 360 | NativeAssert::StringEqual(L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", pPlan->wzBundleProviderKey); | ||
| 361 | Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle); | ||
| 362 | Assert::Equal<BOOL>(TRUE, pPlan->fPerMachine); | ||
| 363 | Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState); | ||
| 364 | Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback); | ||
| 365 | Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval); | ||
| 366 | Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade); | ||
| 367 | |||
| 368 | BOOL fRollback = FALSE; | ||
| 369 | DWORD dwIndex = 0; | ||
| 370 | ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}"); | ||
| 371 | Assert::Equal(dwIndex, pPlan->cRegistrationActions); | ||
| 372 | |||
| 373 | fRollback = TRUE; | ||
| 374 | dwIndex = 0; | ||
| 375 | ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}"); | ||
| 376 | Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions); | ||
| 377 | |||
| 378 | fRollback = FALSE; | ||
| 379 | dwIndex = 0; | ||
| 380 | ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 1); | ||
| 381 | ValidateCachePackage(pPlan, fRollback, dwIndex++, L"PackageA"); | ||
| 382 | ValidateCacheSignalSyncpoint(pPlan, fRollback, dwIndex++); | ||
| 383 | ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 6); | ||
| 384 | ValidateCachePackage(pPlan, fRollback, dwIndex++, L"PackageB"); | ||
| 385 | ValidateCacheSignalSyncpoint(pPlan, fRollback, dwIndex++); | ||
| 386 | Assert::Equal(dwIndex, pPlan->cCacheActions); | ||
| 387 | |||
| 388 | fRollback = TRUE; | ||
| 389 | dwIndex = 0; | ||
| 390 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); | ||
| 391 | |||
| 392 | Assert::Equal(18575450ull, pPlan->qwEstimatedSize); | ||
| 393 | Assert::Equal(78462280ull, pPlan->qwCacheSizeTotal); | ||
| 394 | |||
| 395 | fRollback = FALSE; | ||
| 396 | dwIndex = 0; | ||
| 397 | DWORD dwExecuteCheckpointId = 2; | ||
| 398 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); | ||
| 399 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 400 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"PackageA"); | ||
| 401 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 402 | ValidateExecuteBundlePackage(pPlan, fRollback, dwIndex++, L"PackageA", BOOTSTRAPPER_ACTION_STATE_INSTALL); | ||
| 403 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 404 | ValidateExecutePackageDependency(pPlan, fRollback, dwIndex++, L"PackageA", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", registerActions1, 1); | ||
| 405 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 406 | dwExecuteCheckpointId += 1; // cache checkpoints | ||
| 407 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 408 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"PackageB"); | ||
| 409 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 410 | ValidateExecuteBundlePackage(pPlan, fRollback, dwIndex++, L"PackageB", BOOTSTRAPPER_ACTION_STATE_INSTALL); | ||
| 411 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 412 | ValidateExecutePackageDependency(pPlan, fRollback, dwIndex++, L"PackageB", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", registerActions1, 1); | ||
| 413 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 414 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 415 | ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++); | ||
| 416 | Assert::Equal(dwIndex, pPlan->cExecuteActions); | ||
| 417 | |||
| 418 | fRollback = TRUE; | ||
| 419 | dwIndex = 0; | ||
| 420 | dwExecuteCheckpointId = 2; | ||
| 421 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); | ||
| 422 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 423 | ValidateExecuteBundlePackage(pPlan, fRollback, dwIndex++, L"PackageA", BOOTSTRAPPER_ACTION_STATE_UNINSTALL); | ||
| 424 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 425 | ValidateExecutePackageDependency(pPlan, fRollback, dwIndex++, L"PackageA", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", unregisterActions1, 1); | ||
| 426 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 427 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 428 | dwExecuteCheckpointId += 1; // cache checkpoints | ||
| 429 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 430 | ValidateExecuteBundlePackage(pPlan, fRollback, dwIndex++, L"PackageB", BOOTSTRAPPER_ACTION_STATE_UNINSTALL); | ||
| 431 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 432 | ValidateExecutePackageDependency(pPlan, fRollback, dwIndex++, L"PackageB", L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", unregisterActions1, 1); | ||
| 433 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 434 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 435 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | ||
| 436 | ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++); | ||
| 437 | Assert::Equal(dwIndex, pPlan->cRollbackActions); | ||
| 438 | |||
| 439 | Assert::Equal(2ul, pPlan->cExecutePackagesTotal); | ||
| 440 | Assert::Equal(4ul, pPlan->cOverallProgressTicksTotal); | ||
| 441 | |||
| 442 | dwIndex = 0; | ||
| 443 | Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions); | ||
| 444 | |||
| 445 | dwIndex = 0; | ||
| 446 | ValidateCleanAction(pPlan, dwIndex++, L"NetFx48Web"); | ||
| 447 | Assert::Equal(dwIndex, pPlan->cCleanActions); | ||
| 448 | |||
| 449 | UINT uIndex = 0; | ||
| 450 | ValidatePlannedProvider(pPlan, uIndex++, L"{35192ED0-C70A-49B2-9D12-3B1FA39B5E6F}", NULL); | ||
| 451 | Assert::Equal(uIndex, pPlan->cPlannedProviders); | ||
| 452 | |||
| 453 | Assert::Equal(3ul, pEngineState->packages.cPackages); | ||
| 454 | ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"PackageA", BURN_PACKAGE_REGISTRATION_STATE_PRESENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT); | ||
| 455 | ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[2], L"PackageB", BURN_PACKAGE_REGISTRATION_STATE_PRESENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT); | ||
| 456 | } | ||
| 457 | |||
| 458 | [Fact] | ||
| 343 | void OrphanCompatiblePackageTest() | 459 | void OrphanCompatiblePackageTest() |
| 344 | { | 460 | { |
| 345 | HRESULT hr = S_OK; | 461 | HRESULT hr = S_OK; |
| @@ -716,7 +832,7 @@ namespace Bootstrapper | |||
| 716 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 832 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 717 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"ExeA"); | 833 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"ExeA"); |
| 718 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 834 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 719 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_INSTALL, NULL); | 835 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_INSTALL); |
| 720 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 836 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 721 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 837 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 722 | ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++); | 838 | ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++); |
| @@ -727,7 +843,7 @@ namespace Bootstrapper | |||
| 727 | dwExecuteCheckpointId = 2; | 843 | dwExecuteCheckpointId = 2; |
| 728 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); | 844 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); |
| 729 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 845 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 730 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_UNINSTALL, NULL); | 846 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_UNINSTALL); |
| 731 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 847 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 732 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 848 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 733 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 849 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| @@ -2125,7 +2241,7 @@ namespace Bootstrapper | |||
| 2125 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); | 2241 | ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE); |
| 2126 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 2242 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 2127 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"NetFx48Web"); | 2243 | ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"NetFx48Web"); |
| 2128 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"NetFx48Web", BOOTSTRAPPER_ACTION_STATE_INSTALL, NULL); | 2244 | ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"NetFx48Web", BOOTSTRAPPER_ACTION_STATE_INSTALL); |
| 2129 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 2245 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| 2130 | dwExecuteCheckpointId += 1; // cache checkpoints | 2246 | dwExecuteCheckpointId += 1; // cache checkpoints |
| 2131 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); | 2247 | ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++); |
| @@ -2678,20 +2794,33 @@ namespace Bootstrapper | |||
| 2678 | Assert::Equal<BOOL>(FALSE, pAction->fDeleted); | 2794 | Assert::Equal<BOOL>(FALSE, pAction->fDeleted); |
| 2679 | } | 2795 | } |
| 2680 | 2796 | ||
| 2797 | void ValidateExecuteBundlePackage( | ||
| 2798 | __in BURN_PLAN* pPlan, | ||
| 2799 | __in BOOL fRollback, | ||
| 2800 | __in DWORD dwIndex, | ||
| 2801 | __in LPCWSTR wzPackageId, | ||
| 2802 | __in BOOTSTRAPPER_ACTION_STATE action | ||
| 2803 | ) | ||
| 2804 | { | ||
| 2805 | BURN_EXECUTE_ACTION* pAction = ValidateExecuteActionExists(pPlan, fRollback, dwIndex); | ||
| 2806 | Assert::Equal<DWORD>(BURN_EXECUTE_ACTION_TYPE_BUNDLE_PACKAGE, pAction->type); | ||
| 2807 | NativeAssert::StringEqual(wzPackageId, pAction->bundlePackage.pPackage->sczId); | ||
| 2808 | Assert::Equal<DWORD>(action, pAction->bundlePackage.action); | ||
| 2809 | Assert::Equal<BOOL>(FALSE, pAction->fDeleted); | ||
| 2810 | } | ||
| 2811 | |||
| 2681 | void ValidateExecuteExePackage( | 2812 | void ValidateExecuteExePackage( |
| 2682 | __in BURN_PLAN* pPlan, | 2813 | __in BURN_PLAN* pPlan, |
| 2683 | __in BOOL fRollback, | 2814 | __in BOOL fRollback, |
| 2684 | __in DWORD dwIndex, | 2815 | __in DWORD dwIndex, |
| 2685 | __in LPCWSTR wzPackageId, | 2816 | __in LPCWSTR wzPackageId, |
| 2686 | __in BOOTSTRAPPER_ACTION_STATE action, | 2817 | __in BOOTSTRAPPER_ACTION_STATE action |
| 2687 | __in LPCWSTR wzIgnoreDependencies | ||
| 2688 | ) | 2818 | ) |
| 2689 | { | 2819 | { |
| 2690 | BURN_EXECUTE_ACTION* pAction = ValidateExecuteActionExists(pPlan, fRollback, dwIndex); | 2820 | BURN_EXECUTE_ACTION* pAction = ValidateExecuteActionExists(pPlan, fRollback, dwIndex); |
| 2691 | Assert::Equal<DWORD>(BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE, pAction->type); | 2821 | Assert::Equal<DWORD>(BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE, pAction->type); |
| 2692 | NativeAssert::StringEqual(wzPackageId, pAction->exePackage.pPackage->sczId); | 2822 | NativeAssert::StringEqual(wzPackageId, pAction->exePackage.pPackage->sczId); |
| 2693 | Assert::Equal<DWORD>(action, pAction->exePackage.action); | 2823 | Assert::Equal<DWORD>(action, pAction->exePackage.action); |
| 2694 | NativeAssert::StringEqual(wzIgnoreDependencies, pAction->exePackage.sczIgnoreDependencies); | ||
| 2695 | Assert::Equal<BOOL>(FALSE, pAction->fDeleted); | 2824 | Assert::Equal<BOOL>(FALSE, pAction->fDeleted); |
| 2696 | } | 2825 | } |
| 2697 | 2826 | ||
