From d4c76dd11f5a096b4fd3ee9c5efc1f44559ac3da Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 17 Apr 2021 20:58:32 -0500 Subject: Send more progress during cache verification. Add verifyStep to OnCacheVerifyProgress. Send OnContainerOrPayloadVerify events only if file existed in cache. --- src/test/BurnUnitTest/CacheTest.cpp | 46 ++++++++++++++++++++++++++++++++++++- src/test/BurnUnitTest/PlanTest.cpp | 10 ++++---- 2 files changed, 50 insertions(+), 6 deletions(-) (limited to 'src/test') diff --git a/src/test/BurnUnitTest/CacheTest.cpp b/src/test/BurnUnitTest/CacheTest.cpp index fc0b4531..d0cc237f 100644 --- a/src/test/BurnUnitTest/CacheTest.cpp +++ b/src/test/BurnUnitTest/CacheTest.cpp @@ -2,6 +2,26 @@ #include "precomp.h" +static HRESULT CALLBACK CacheTestEventRoutine( + __in BURN_CACHE_MESSAGE* pMessage, + __in LPVOID pvContext + ); + +static DWORD CALLBACK CacheTestProgressRoutine( + __in LARGE_INTEGER TotalFileSize, + __in LARGE_INTEGER TotalBytesTransferred, + __in LARGE_INTEGER StreamSize, + __in LARGE_INTEGER StreamBytesTransferred, + __in DWORD dwStreamNumber, + __in DWORD dwCallbackReason, + __in HANDLE hSourceFile, + __in HANDLE hDestinationFile, + __in_opt LPVOID lpData + ); + +typedef struct _CACHE_TEST_CONTEXT +{ +} CACHE_TEST_CONTEXT; namespace Microsoft { @@ -33,6 +53,7 @@ namespace Bootstrapper LPWSTR sczPayloadPath = NULL; BYTE* pb = NULL; DWORD cb = NULL; + CACHE_TEST_CONTEXT context = { }; try { @@ -51,7 +72,7 @@ namespace Bootstrapper payload.pbHash = pb; payload.cbHash = cb; - hr = CacheCompletePayload(package.fPerMachine, &payload, package.sczCacheId, sczPayloadPath, FALSE); + hr = CacheCompletePayload(package.fPerMachine, &payload, package.sczCacheId, sczPayloadPath, FALSE, CacheTestEventRoutine, CacheTestProgressRoutine, &context); Assert::Equal(S_OK, hr); } finally @@ -73,3 +94,26 @@ namespace Bootstrapper } } } + +static HRESULT CALLBACK CacheTestEventRoutine( + __in BURN_CACHE_MESSAGE* /*pMessage*/, + __in LPVOID /*pvContext*/ + ) +{ + return S_OK; +} + +static DWORD CALLBACK CacheTestProgressRoutine( + __in LARGE_INTEGER /*TotalFileSize*/, + __in LARGE_INTEGER /*TotalBytesTransferred*/, + __in LARGE_INTEGER /*StreamSize*/, + __in LARGE_INTEGER /*StreamBytesTransferred*/, + __in DWORD /*dwStreamNumber*/, + __in DWORD /*dwCallbackReason*/, + __in HANDLE /*hSourceFile*/, + __in HANDLE /*hDestinationFile*/, + __in_opt LPVOID /*lpData*/ + ) +{ + return PROGRESS_QUIET; +} diff --git a/src/test/BurnUnitTest/PlanTest.cpp b/src/test/BurnUnitTest/PlanTest.cpp index c073696b..a7c1d83c 100644 --- a/src/test/BurnUnitTest/PlanTest.cpp +++ b/src/test/BurnUnitTest/PlanTest.cpp @@ -71,7 +71,7 @@ namespace Bootstrapper Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); Assert::Equal(107082ull, pPlan->qwEstimatedSize); - Assert::Equal(303687ull, pPlan->qwCacheSizeTotal); + Assert::Equal(506145ull, pPlan->qwCacheSizeTotal); fRollback = FALSE; dwIndex = 0; @@ -308,7 +308,7 @@ namespace Bootstrapper Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); Assert::Equal(35694ull, pPlan->qwEstimatedSize); - Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); + Assert::Equal(168715ull, pPlan->qwCacheSizeTotal); fRollback = FALSE; dwIndex = 0; @@ -388,7 +388,7 @@ namespace Bootstrapper Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); Assert::Equal(33743ull, pPlan->qwEstimatedSize); - Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); + Assert::Equal(168715ull, pPlan->qwCacheSizeTotal); fRollback = FALSE; dwIndex = 0; @@ -458,7 +458,7 @@ namespace Bootstrapper Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); Assert::Equal(35694ull, pPlan->qwEstimatedSize); - Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); + Assert::Equal(168715ull, pPlan->qwCacheSizeTotal); fRollback = FALSE; dwIndex = 0; @@ -739,7 +739,7 @@ namespace Bootstrapper Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); Assert::Equal(3055111ull, pPlan->qwEstimatedSize); - Assert::Equal(106496ull, pPlan->qwCacheSizeTotal); + Assert::Equal(212992ull, pPlan->qwCacheSizeTotal); fRollback = FALSE; dwIndex = 0; -- cgit v1.2.3-55-g6feb