summaryrefslogtreecommitdiff
path: root/src/burn/test/BurnUnitTest/PlanTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/test/BurnUnitTest/PlanTest.cpp')
-rw-r--r--src/burn/test/BurnUnitTest/PlanTest.cpp200
1 files changed, 200 insertions, 0 deletions
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp
index 4d726fb4..770922b4 100644
--- a/src/burn/test/BurnUnitTest/PlanTest.cpp
+++ b/src/burn/test/BurnUnitTest/PlanTest.cpp
@@ -10,7 +10,9 @@ static HRESULT WINAPI PlanTestBAProc(
10 ); 10 );
11 11
12static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml"; 12static LPCWSTR wzMsiTransactionManifestFileName = L"MsiTransaction_BundleAv1_manifest.xml";
13static LPCWSTR wzSingleExeManifestFileName = L"Failure_BundleD_manifest.xml";
13static LPCWSTR wzSingleMsiManifestFileName = L"BasicFunctionality_BundleA_manifest.xml"; 14static LPCWSTR wzSingleMsiManifestFileName = L"BasicFunctionality_BundleA_manifest.xml";
15static LPCWSTR wzSingleMsuManifestFileName = L"MsuPackageFixture_manifest.xml";
14static LPCWSTR wzSlipstreamManifestFileName = L"Slipstream_BundleA_manifest.xml"; 16static LPCWSTR wzSlipstreamManifestFileName = L"Slipstream_BundleA_manifest.xml";
15static LPCWSTR wzSlipstreamModifiedManifestFileName = L"Slipstream_BundleA_modified_manifest.xml"; 17static LPCWSTR wzSlipstreamModifiedManifestFileName = L"Slipstream_BundleA_modified_manifest.xml";
16 18
@@ -659,6 +661,97 @@ namespace Bootstrapper
659 } 661 }
660 662
661 [Fact] 663 [Fact]
664 void SingleExeInstallTest()
665 {
666 HRESULT hr = S_OK;
667 BURN_ENGINE_STATE engineState = { };
668 BURN_ENGINE_STATE* pEngineState = &engineState;
669 BURN_PLAN* pPlan = &engineState.plan;
670
671 InitializeEngineStateForCorePlan(wzSingleExeManifestFileName, pEngineState);
672 DetectAttachedContainerAsAttached(pEngineState);
673 DetectPermanentPackagesAsPresentAndCached(pEngineState);
674
675 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL);
676 NativeAssert::Succeeded(hr, "CorePlan failed");
677
678 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action);
679 NativeAssert::StringEqual(L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", pPlan->wzBundleId);
680 NativeAssert::StringEqual(L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", pPlan->wzBundleProviderKey);
681 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
682 Assert::Equal<BOOL>(TRUE, pPlan->fPerMachine);
683 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
684 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
685 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
686 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
687
688 BOOL fRollback = FALSE;
689 DWORD dwIndex = 0;
690 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}");
691 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
692
693 fRollback = TRUE;
694 dwIndex = 0;
695 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}");
696 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
697
698 fRollback = FALSE;
699 dwIndex = 0;
700 ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 1);
701 ValidateCachePackage(pPlan, fRollback, dwIndex++, L"ExeA");
702 ValidateCacheSignalSyncpoint(pPlan, fRollback, dwIndex++);
703 Assert::Equal(dwIndex, pPlan->cCacheActions);
704
705 fRollback = TRUE;
706 dwIndex = 0;
707 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
708
709 Assert::Equal(1463267ull, pPlan->qwEstimatedSize);
710 Assert::Equal(119695ull, pPlan->qwCacheSizeTotal);
711
712 fRollback = FALSE;
713 dwIndex = 0;
714 DWORD dwExecuteCheckpointId = 2;
715 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
716 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
717 ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"ExeA");
718 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_INSTALL);
719 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
720 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
721 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
722 Assert::Equal(dwIndex, pPlan->cExecuteActions);
723
724 fRollback = TRUE;
725 dwIndex = 0;
726 dwExecuteCheckpointId = 2;
727 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
728 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
729 ValidateExecuteExePackage(pPlan, fRollback, dwIndex++, L"ExeA", BOOTSTRAPPER_ACTION_STATE_UNINSTALL);
730 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
731 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
732 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
733 Assert::Equal(dwIndex, pPlan->cRollbackActions);
734
735 Assert::Equal(1ul, pPlan->cExecutePackagesTotal);
736 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
737
738 dwIndex = 0;
739 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
740
741 dwIndex = 0;
742 ValidateCleanAction(pPlan, dwIndex++, L"NetFx48Web");
743 ValidateCleanAction(pPlan, dwIndex++, L"ExeA");
744 Assert::Equal(dwIndex, pPlan->cCleanActions);
745
746 UINT uIndex = 0;
747 ValidatePlannedProvider(pPlan, uIndex++, L"{9C184683-04FB-49AD-9D79-65101BDC3EE3}", NULL);
748 Assert::Equal(uIndex, pPlan->cPlannedProviders);
749
750 Assert::Equal(2ul, pEngineState->packages.cPackages);
751 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[1], L"ExeA", BURN_PACKAGE_REGISTRATION_STATE_ABSENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT);
752 }
753
754 [Fact]
662 void SingleMsiCacheTest() 755 void SingleMsiCacheTest()
663 { 756 {
664 HRESULT hr = S_OK; 757 HRESULT hr = S_OK;
@@ -1533,6 +1626,98 @@ namespace Bootstrapper
1533 } 1626 }
1534 1627
1535 [Fact] 1628 [Fact]
1629 void SingleMsuInstallTest()
1630 {
1631 HRESULT hr = S_OK;
1632 BURN_ENGINE_STATE engineState = { };
1633 BURN_ENGINE_STATE* pEngineState = &engineState;
1634 BURN_PLAN* pPlan = &engineState.plan;
1635
1636 InitializeEngineStateForCorePlan(wzSingleMsuManifestFileName, pEngineState);
1637 DetectAttachedContainerAsAttached(pEngineState);
1638 DetectPackagesAsAbsent(pEngineState);
1639
1640 hr = CorePlan(pEngineState, BOOTSTRAPPER_ACTION_INSTALL);
1641 NativeAssert::Succeeded(hr, "CorePlan failed");
1642
1643 Assert::Equal<DWORD>(BOOTSTRAPPER_ACTION_INSTALL, pPlan->action);
1644 NativeAssert::StringEqual(L"{06077C60-DC46-4F4A-8D3C-05F869187191}", pPlan->wzBundleId);
1645 NativeAssert::StringEqual(L"{06077C60-DC46-4F4A-8D3C-05F869187191}", pPlan->wzBundleProviderKey);
1646 Assert::Equal<BOOL>(FALSE, pPlan->fEnabledForwardCompatibleBundle);
1647 Assert::Equal<BOOL>(TRUE, pPlan->fPerMachine);
1648 Assert::Equal<BOOL>(TRUE, pPlan->fCanAffectMachineState);
1649 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1650 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1651 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1652
1653 BOOL fRollback = FALSE;
1654 DWORD dwIndex = 0;
1655 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, TRUE, L"{06077C60-DC46-4F4A-8D3C-05F869187191}", L"{06077C60-DC46-4F4A-8D3C-05F869187191}");
1656 Assert::Equal(dwIndex, pPlan->cRegistrationActions);
1657
1658 fRollback = TRUE;
1659 dwIndex = 0;
1660 ValidateDependentRegistrationAction(pPlan, fRollback, dwIndex++, FALSE, L"{06077C60-DC46-4F4A-8D3C-05F869187191}", L"{06077C60-DC46-4F4A-8D3C-05F869187191}");
1661 Assert::Equal(dwIndex, pPlan->cRollbackRegistrationActions);
1662
1663 fRollback = FALSE;
1664 dwIndex = 0;
1665 ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 1);
1666 ValidateCachePackage(pPlan, fRollback, dwIndex++, L"test.msu");
1667 ValidateCacheSignalSyncpoint(pPlan, fRollback, dwIndex++);
1668 Assert::Equal(dwIndex, pPlan->cCacheActions);
1669
1670 fRollback = TRUE;
1671 dwIndex = 0;
1672 ValidateCacheRollbackPackage(pPlan, fRollback, dwIndex++, L"test.msu");
1673 ValidateCacheCheckpoint(pPlan, fRollback, dwIndex++, 1);
1674 Assert::Equal(dwIndex, pPlan->cRollbackCacheActions);
1675
1676 Assert::Equal(56ull, pPlan->qwEstimatedSize);
1677 Assert::Equal(140ull, pPlan->qwCacheSizeTotal);
1678
1679 fRollback = FALSE;
1680 dwIndex = 0;
1681 DWORD dwExecuteCheckpointId = 2;
1682 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
1683 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1684 ValidateExecuteWaitCachePackage(pPlan, fRollback, dwIndex++, L"test.msu");
1685 ValidateExecuteMsuPackage(pPlan, fRollback, dwIndex++, L"test.msu", BOOTSTRAPPER_ACTION_STATE_INSTALL);
1686 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1687 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1688 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
1689 Assert::Equal(dwIndex, pPlan->cExecuteActions);
1690
1691 fRollback = TRUE;
1692 dwIndex = 0;
1693 dwExecuteCheckpointId = 2;
1694 ValidateExecuteRollbackBoundaryStart(pPlan, fRollback, dwIndex++, L"WixDefaultBoundary", TRUE, FALSE);
1695 ValidateExecuteUncachePackage(pPlan, fRollback, dwIndex++, L"test.msu");
1696 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1697 ValidateExecuteMsuPackage(pPlan, fRollback, dwIndex++, L"test.msu", BOOTSTRAPPER_ACTION_STATE_UNINSTALL);
1698 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1699 ValidateExecuteCheckpoint(pPlan, fRollback, dwIndex++, dwExecuteCheckpointId++);
1700 ValidateExecuteRollbackBoundaryEnd(pPlan, fRollback, dwIndex++);
1701 Assert::Equal(dwIndex, pPlan->cRollbackActions);
1702
1703 Assert::Equal(1ul, pPlan->cExecutePackagesTotal);
1704 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
1705
1706 dwIndex = 0;
1707 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
1708
1709 dwIndex = 0;
1710 Assert::Equal(dwIndex, pPlan->cCleanActions);
1711
1712 UINT uIndex = 0;
1713 ValidatePlannedProvider(pPlan, uIndex++, L"{06077C60-DC46-4F4A-8D3C-05F869187191}", NULL);
1714 Assert::Equal(uIndex, pPlan->cPlannedProviders);
1715
1716 Assert::Equal(1ul, pEngineState->packages.cPackages);
1717 ValidateNonPermanentPackageExpectedStates(&pEngineState->packages.rgPackages[0], L"test.msu", BURN_PACKAGE_REGISTRATION_STATE_PRESENT, BURN_PACKAGE_REGISTRATION_STATE_PRESENT);
1718 }
1719
1720 [Fact]
1536 void SlipstreamInstallTest() 1721 void SlipstreamInstallTest()
1537 { 1722 {
1538 HRESULT hr = S_OK; 1723 HRESULT hr = S_OK;
@@ -2571,6 +2756,21 @@ namespace Bootstrapper
2571 NativeAssert::StringEqual(wzPackageId, pOrderedPatch->pPackage->sczId); 2756 NativeAssert::StringEqual(wzPackageId, pOrderedPatch->pPackage->sczId);
2572 } 2757 }
2573 2758
2759 void ValidateExecuteMsuPackage(
2760 __in BURN_PLAN* pPlan,
2761 __in BOOL fRollback,
2762 __in DWORD dwIndex,
2763 __in LPCWSTR wzPackageId,
2764 __in BOOTSTRAPPER_ACTION_STATE action
2765 )
2766 {
2767 BURN_EXECUTE_ACTION* pAction = ValidateExecuteActionExists(pPlan, fRollback, dwIndex);
2768 Assert::Equal<DWORD>(BURN_EXECUTE_ACTION_TYPE_MSU_PACKAGE, pAction->type);
2769 NativeAssert::StringEqual(wzPackageId, pAction->msuPackage.pPackage->sczId);
2770 Assert::Equal<DWORD>(action, pAction->msuPackage.action);
2771 Assert::Equal<BOOL>(FALSE, pAction->fDeleted);
2772 }
2773
2574 void ValidateExecutePackageDependency( 2774 void ValidateExecutePackageDependency(
2575 __in BURN_PLAN* pPlan, 2775 __in BURN_PLAN* pPlan,
2576 __in BOOL fRollback, 2776 __in BOOL fRollback,