summaryrefslogtreecommitdiff
path: root/src/burn/test/BurnUnitTest/PlanTest.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-02-10 18:09:34 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-02-10 19:51:19 -0600
commit27a0db4070a2b5756282bf15b957dd7f0021417f (patch)
tree2d0cdfe80d5ccd6d207bdf664a4f8e512281c1cf /src/burn/test/BurnUnitTest/PlanTest.cpp
parent091573d459d6ab4947bd39bd3bc8faee3d18b4fc (diff)
downloadwix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.gz
wix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.bz2
wix-27a0db4070a2b5756282bf15b957dd7f0021417f.zip
When rolling back a bundle failure, reinstall all upgrade related bundles.
Fixes #3421
Diffstat (limited to 'src/burn/test/BurnUnitTest/PlanTest.cpp')
-rw-r--r--src/burn/test/BurnUnitTest/PlanTest.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp
index 99644115..81484234 100644
--- a/src/burn/test/BurnUnitTest/PlanTest.cpp
+++ b/src/burn/test/BurnUnitTest/PlanTest.cpp
@@ -170,6 +170,10 @@ namespace Bootstrapper
170 Assert::Equal(7ul, pPlan->cOverallProgressTicksTotal); 170 Assert::Equal(7ul, pPlan->cOverallProgressTicksTotal);
171 171
172 dwIndex = 0; 172 dwIndex = 0;
173 ValidateRestoreRelatedBundle(pPlan, dwIndex++, L"{FD9920AD-DBCA-4C6C-8CD5-B47431CE8D21}", BOOTSTRAPPER_ACTION_STATE_INSTALL, NULL);
174 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
175
176 dwIndex = 0;
173 Assert::Equal(dwIndex, pPlan->cCleanActions); 177 Assert::Equal(dwIndex, pPlan->cCleanActions);
174 178
175 UINT uIndex = 0; 179 UINT uIndex = 0;
@@ -277,6 +281,9 @@ namespace Bootstrapper
277 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal); 281 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal);
278 282
279 dwIndex = 0; 283 dwIndex = 0;
284 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
285
286 dwIndex = 0;
280 ValidateCleanAction(pPlan, dwIndex++, L"PackageC"); 287 ValidateCleanAction(pPlan, dwIndex++, L"PackageC");
281 ValidateCleanAction(pPlan, dwIndex++, L"PackageB"); 288 ValidateCleanAction(pPlan, dwIndex++, L"PackageB");
282 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 289 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
@@ -350,6 +357,9 @@ namespace Bootstrapper
350 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal); 357 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal);
351 358
352 dwIndex = 0; 359 dwIndex = 0;
360 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
361
362 dwIndex = 0;
353 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 363 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
354 ValidateCleanCompatibleAction(pPlan, dwIndex++, L"PackageA"); 364 ValidateCleanCompatibleAction(pPlan, dwIndex++, L"PackageA");
355 Assert::Equal(dwIndex, pPlan->cCleanActions); 365 Assert::Equal(dwIndex, pPlan->cCleanActions);
@@ -438,6 +448,9 @@ namespace Bootstrapper
438 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal); 448 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
439 449
440 dwIndex = 0; 450 dwIndex = 0;
451 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
452
453 dwIndex = 0;
441 Assert::Equal(dwIndex, pPlan->cCleanActions); 454 Assert::Equal(dwIndex, pPlan->cCleanActions);
442 455
443 UINT uIndex = 0; 456 UINT uIndex = 0;
@@ -508,6 +521,9 @@ namespace Bootstrapper
508 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal); 521 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal);
509 522
510 dwIndex = 0; 523 dwIndex = 0;
524 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
525
526 dwIndex = 0;
511 Assert::Equal(dwIndex, pPlan->cCleanActions); 527 Assert::Equal(dwIndex, pPlan->cCleanActions);
512 528
513 UINT uIndex = 0; 529 UINT uIndex = 0;
@@ -579,6 +595,9 @@ namespace Bootstrapper
579 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal); 595 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
580 596
581 dwIndex = 0; 597 dwIndex = 0;
598 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
599
600 dwIndex = 0;
582 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 601 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
583 Assert::Equal(dwIndex, pPlan->cCleanActions); 602 Assert::Equal(dwIndex, pPlan->cCleanActions);
584 603
@@ -658,6 +677,10 @@ namespace Bootstrapper
658 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal); 677 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal);
659 678
660 dwIndex = 0; 679 dwIndex = 0;
680 ValidateRestoreRelatedBundle(pPlan, dwIndex++, L"{FD9920AD-DBCA-4C6C-8CD5-B47431CE8D21}", BOOTSTRAPPER_ACTION_STATE_INSTALL, NULL);
681 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
682
683 dwIndex = 0;
661 Assert::Equal(dwIndex, pPlan->cCleanActions); 684 Assert::Equal(dwIndex, pPlan->cCleanActions);
662 685
663 UINT uIndex = 0; 686 UINT uIndex = 0;
@@ -744,6 +767,10 @@ namespace Bootstrapper
744 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal); 767 Assert::Equal(3ul, pPlan->cOverallProgressTicksTotal);
745 768
746 dwIndex = 0; 769 dwIndex = 0;
770 ValidateRestoreRelatedBundle(pPlan, dwIndex++, L"{FD9920AD-DBCA-4C6C-8CD5-B47431CE8D21}", BOOTSTRAPPER_ACTION_STATE_INSTALL, NULL);
771 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
772
773 dwIndex = 0;
747 Assert::Equal(dwIndex, pPlan->cCleanActions); 774 Assert::Equal(dwIndex, pPlan->cCleanActions);
748 775
749 UINT uIndex = 0; 776 UINT uIndex = 0;
@@ -805,6 +832,9 @@ namespace Bootstrapper
805 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal); 832 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal);
806 833
807 dwIndex = 0; 834 dwIndex = 0;
835 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
836
837 dwIndex = 0;
808 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 838 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
809 Assert::Equal(dwIndex, pPlan->cCleanActions); 839 Assert::Equal(dwIndex, pPlan->cCleanActions);
810 840
@@ -879,6 +909,9 @@ namespace Bootstrapper
879 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal); 909 Assert::Equal(1ul, pPlan->cOverallProgressTicksTotal);
880 910
881 dwIndex = 0; 911 dwIndex = 0;
912 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
913
914 dwIndex = 0;
882 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 915 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
883 Assert::Equal(dwIndex, pPlan->cCleanActions); 916 Assert::Equal(dwIndex, pPlan->cCleanActions);
884 917
@@ -946,6 +979,9 @@ namespace Bootstrapper
946 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal); 979 Assert::Equal(0ul, pPlan->cOverallProgressTicksTotal);
947 980
948 dwIndex = 0; 981 dwIndex = 0;
982 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
983
984 dwIndex = 0;
949 Assert::Equal(dwIndex, pPlan->cCleanActions); 985 Assert::Equal(dwIndex, pPlan->cCleanActions);
950 986
951 UINT uIndex = 0; 987 UINT uIndex = 0;
@@ -1057,6 +1093,9 @@ namespace Bootstrapper
1057 Assert::Equal(5ul, pPlan->cOverallProgressTicksTotal); 1093 Assert::Equal(5ul, pPlan->cOverallProgressTicksTotal);
1058 1094
1059 dwIndex = 0; 1095 dwIndex = 0;
1096 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
1097
1098 dwIndex = 0;
1060 Assert::Equal(dwIndex, pPlan->cCleanActions); 1099 Assert::Equal(dwIndex, pPlan->cCleanActions);
1061 1100
1062 UINT uIndex = 0; 1101 UINT uIndex = 0;
@@ -1147,6 +1186,9 @@ namespace Bootstrapper
1147 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal); 1186 Assert::Equal(2ul, pPlan->cOverallProgressTicksTotal);
1148 1187
1149 dwIndex = 0; 1188 dwIndex = 0;
1189 Assert::Equal(dwIndex, pPlan->cRestoreRelatedBundleActions);
1190
1191 dwIndex = 0;
1150 ValidateCleanAction(pPlan, dwIndex++, L"PatchA"); 1192 ValidateCleanAction(pPlan, dwIndex++, L"PatchA");
1151 ValidateCleanAction(pPlan, dwIndex++, L"PackageA"); 1193 ValidateCleanAction(pPlan, dwIndex++, L"PackageA");
1152 Assert::Equal(dwIndex, pPlan->cCleanActions); 1194 Assert::Equal(dwIndex, pPlan->cCleanActions);
@@ -1829,6 +1871,28 @@ namespace Bootstrapper
1829 NativeAssert::StringEqual(wzName, pProvider->sczName); 1871 NativeAssert::StringEqual(wzName, pProvider->sczName);
1830 } 1872 }
1831 1873
1874 void ValidateRestoreRelatedBundle(
1875 __in BURN_PLAN* pPlan,
1876 __in DWORD dwIndex,
1877 __in LPCWSTR wzPackageId,
1878 __in BOOTSTRAPPER_ACTION_STATE action,
1879 __in LPCWSTR wzIgnoreDependencies
1880 )
1881 {
1882 BURN_EXECUTE_ACTION* pAction = ValidateRestoreRelatedBundleActionExists(pPlan, dwIndex);
1883 Assert::Equal<DWORD>(BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE, pAction->type);
1884 NativeAssert::StringEqual(wzPackageId, pAction->relatedBundle.pRelatedBundle->package.sczId);
1885 Assert::Equal<DWORD>(action, pAction->relatedBundle.action);
1886 NativeAssert::StringEqual(wzIgnoreDependencies, pAction->relatedBundle.sczIgnoreDependencies);
1887 Assert::Equal<BOOL>(FALSE, pAction->fDeleted);
1888 }
1889
1890 BURN_EXECUTE_ACTION* ValidateRestoreRelatedBundleActionExists(BURN_PLAN* pPlan, DWORD dwIndex)
1891 {
1892 Assert::InRange(dwIndex + 1ul, 1ul, pPlan->cRestoreRelatedBundleActions);
1893 return pPlan->rgRestoreRelatedBundleActions + dwIndex;
1894 }
1895
1832 void ValidateUninstallMsiCompatiblePackage( 1896 void ValidateUninstallMsiCompatiblePackage(
1833 __in BURN_PLAN* pPlan, 1897 __in BURN_PLAN* pPlan,
1834 __in BOOL fRollback, 1898 __in BOOL fRollback,