aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-11-10 22:48:05 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-11-10 23:49:10 -0600
commit209c92111928a98972d7f0f9d6d620ab566564d9 (patch)
treefd13d81105b02e63cc61c7819dba6f5c6c7e936e /src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
parent3f6a633769a9c732db765411ef9b810133ad3957 (diff)
downloadwix-209c92111928a98972d7f0f9d6d620ab566564d9.tar.gz
wix-209c92111928a98972d7f0f9d6d620ab566564d9.tar.bz2
wix-209c92111928a98972d7f0f9d6d620ab566564d9.zip
Automate the test for GetRelatedBundleVariable.
Diffstat (limited to '')
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp (renamed from src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp)37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
index 5da7b170..01750b4b 100644
--- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
@@ -4,20 +4,9 @@
4#include "BalBaseBAFunctions.h" 4#include "BalBaseBAFunctions.h"
5#include "BalBaseBAFunctionsProc.h" 5#include "BalBaseBAFunctionsProc.h"
6 6
7const DWORD VARIABLE_GROW_FACTOR = 80;
8const LPCWSTR STRING_VARIABLE = L"AString"; 7const LPCWSTR STRING_VARIABLE = L"AString";
9const LPCWSTR NUMBER_VARIABLE = L"ANumber"; 8const LPCWSTR NUMBER_VARIABLE = L"ANumber";
10 9
11static void CALLBACK BafRelatedBundleVariableTestingTraceError(
12 __in_z LPCSTR szFile,
13 __in int iLine,
14 __in REPORT_LEVEL rl,
15 __in UINT source,
16 __in HRESULT hrError,
17 __in_z __format_string LPCSTR szFormat,
18 __in va_list args
19 );
20
21class CBafRelatedBundleVariableTesting : public CBalBaseBAFunctions 10class CBafRelatedBundleVariableTesting : public CBalBaseBAFunctions
22{ 11{
23public: // IBAFunctions 12public: // IBAFunctions
@@ -32,7 +21,7 @@ public: //IBootstrapperApplication
32 __in LPCWSTR wzVersion, 21 __in LPCWSTR wzVersion,
33 __in BOOL fMissingFromCache, 22 __in BOOL fMissingFromCache,
34 __inout BOOL* pfCancel 23 __inout BOOL* pfCancel
35 ) 24 )
36 { 25 {
37 26
38 HRESULT hr = S_OK; 27 HRESULT hr = S_OK;
@@ -44,14 +33,14 @@ public: //IBootstrapperApplication
44 33
45 if (wzValue) 34 if (wzValue)
46 { 35 {
47 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "AString = %ws", wzValue); 36 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: AString = %ws", wzValue);
48 } 37 }
49 38
50 hr = BalGetRelatedBundleVariable(wzBundleId, NUMBER_VARIABLE, &wzValue); 39 hr = BalGetRelatedBundleVariable(wzBundleId, NUMBER_VARIABLE, &wzValue);
51 40
52 if (wzValue) 41 if (wzValue)
53 { 42 {
54 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "ANumber = %ws", wzValue); 43 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: ANumber = %ws", wzValue);
55 } 44 }
56 45
57 hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); 46 hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel);
@@ -95,8 +84,6 @@ HRESULT WINAPI CreateBAFunctions(
95 CBafRelatedBundleVariableTesting* pBAFunctions = NULL; 84 CBafRelatedBundleVariableTesting* pBAFunctions = NULL;
96 IBootstrapperEngine* pEngine = NULL; 85 IBootstrapperEngine* pEngine = NULL;
97 86
98 DutilInitialize(&BafRelatedBundleVariableTestingTraceError);
99
100 hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); 87 hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine);
101 ExitOnFailure(hr, "Failed to initialize Bal."); 88 ExitOnFailure(hr, "Failed to initialize Bal.");
102 89
@@ -113,21 +100,3 @@ LExit:
113 100
114 return hr; 101 return hr;
115} 102}
116
117static void CALLBACK BafRelatedBundleVariableTestingTraceError(
118 __in_z LPCSTR /*szFile*/,
119 __in int /*iLine*/,
120 __in REPORT_LEVEL /*rl*/,
121 __in UINT source,
122 __in HRESULT hrError,
123 __in_z __format_string LPCSTR szFormat,
124 __in va_list args
125 )
126{
127 // BalLogError currently uses the Exit... macros,
128 // so if expanding the scope need to ensure this doesn't get called recursively.
129 if (DUTIL_SOURCE_THMUTIL == source)
130 {
131 BalLogErrorArgs(hrError, szFormat, args);
132 }
133}