From 209c92111928a98972d7f0f9d6d620ab566564d9 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 10 Nov 2022 22:48:05 -0600 Subject: Automate the test for GetRelatedBundleVariable. --- .../BafRelatedBundleVariableTesting.cpp | 102 ++++++++++++++++ .../BafRelatedBundleVariableTesting.def | 6 + .../BafRelatedBundleVariableTesting.vcxproj | 66 ++++++++++ .../BafRelatedBundleVariableTesting/precomp.cpp | 48 ++++++++ .../BafRelatedBundleVariableTesting/precomp.h | 43 +++++++ .../BAFunctionsTests/BundleAv1/BundleA.props | 14 +++ .../BAFunctionsTests/BundleAv1/BundleAv1.wixproj | 10 ++ .../BAFunctionsTests/BundleAv1/BundleAv1.wxs | 15 +++ .../BAFunctionsTests/BundleAv2/BundleAv2.wixproj | 13 ++ .../BAFunctionsTests/BundleAv2/BundleAv2.wxs | 15 +++ .../BAFunctionsTests/PackageAv1/PackageA.props | 9 ++ .../BAFunctionsTests/PackageAv1/PackageAv1.wixproj | 4 + .../BAFunctionsTests/PackageAv2/PackageAv2.wixproj | 7 ++ .../BafRelatedBundleVariableTesting.cpp | 133 --------------------- .../BafRelatedBundleVariableTesting.def | 6 - .../BafRelatedBundleVariableTesting.vcxproj | 66 ---------- .../BafRelatedBundleVariableTesting/precomp.cpp | 48 -------- .../BafRelatedBundleVariableTesting/precomp.h | 43 ------- .../burn/TestData/Manual/BundleD/BundleD.wixproj | 22 ---- src/test/burn/TestData/Manual/BundleD/BundleD.wxs | 17 --- .../burn/TestData/Manual/BundleD/ManualTests.txt | 10 -- .../WixToolsetTest.BurnE2E/BAFunctionsTests.cs | 31 +++++ 22 files changed, 383 insertions(+), 345 deletions(-) create mode 100644 src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp create mode 100644 src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def create mode 100644 src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj create mode 100644 src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp create mode 100644 src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h create mode 100644 src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleA.props create mode 100644 src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wixproj create mode 100644 src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wxs create mode 100644 src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wixproj create mode 100644 src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wxs create mode 100644 src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageA.props create mode 100644 src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageAv1.wixproj create mode 100644 src/test/burn/TestData/BAFunctionsTests/PackageAv2/PackageAv2.wixproj delete mode 100644 src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp delete mode 100644 src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def delete mode 100644 src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj delete mode 100644 src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.cpp delete mode 100644 src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.h delete mode 100644 src/test/burn/TestData/Manual/BundleD/BundleD.wixproj delete mode 100644 src/test/burn/TestData/Manual/BundleD/BundleD.wxs delete mode 100644 src/test/burn/TestData/Manual/BundleD/ManualTests.txt create mode 100644 src/test/burn/WixToolsetTest.BurnE2E/BAFunctionsTests.cs (limited to 'src') diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp new file mode 100644 index 00000000..01750b4b --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp @@ -0,0 +1,102 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +#include "precomp.h" +#include "BalBaseBAFunctions.h" +#include "BalBaseBAFunctionsProc.h" + +const LPCWSTR STRING_VARIABLE = L"AString"; +const LPCWSTR NUMBER_VARIABLE = L"ANumber"; + +class CBafRelatedBundleVariableTesting : public CBalBaseBAFunctions +{ +public: // IBAFunctions + + +public: //IBootstrapperApplication + virtual STDMETHODIMP OnDetectRelatedBundle( + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in_z LPCWSTR wzBundleTag, + __in BOOL fPerMachine, + __in LPCWSTR wzVersion, + __in BOOL fMissingFromCache, + __inout BOOL* pfCancel + ) + { + + HRESULT hr = S_OK; + LPWSTR wzValue = NULL; + + hr = BalGetRelatedBundleVariable(wzBundleId, STRING_VARIABLE, &wzValue); + + ExitOnFailure(hr, "Failed to get related bundle string variable."); + + if (wzValue) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: AString = %ws", wzValue); + } + + hr = BalGetRelatedBundleVariable(wzBundleId, NUMBER_VARIABLE, &wzValue); + + if (wzValue) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: ANumber = %ws", wzValue); + } + + hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); + LExit: + ReleaseStr(wzValue); + return hr; + } +private: + + +public: + // + // Constructor - initialize member variables. + // + CBafRelatedBundleVariableTesting( + __in HMODULE hModule, + __in IBootstrapperEngine* pEngine, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs + ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) + { + } + + // + // Destructor - release member variables. + // + ~CBafRelatedBundleVariableTesting() + { + } + +private: +}; + + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + CBafRelatedBundleVariableTesting* pBAFunctions = NULL; + IBootstrapperEngine* pEngine = NULL; + + hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + pBAFunctions = new CBafRelatedBundleVariableTesting(hModule, pEngine, pArgs); + ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CBafRelatedBundleVariableTesting object."); + + pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; + pResults->pvBAFunctionsProcContext = pBAFunctions; + pBAFunctions = NULL; + +LExit: + ReleaseObject(pBAFunctions); + ReleaseObject(pEngine); + + return hr; +} diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def new file mode 100644 index 00000000..6e016dad --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def @@ -0,0 +1,6 @@ +; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + + +EXPORTS + BAFunctionsCreate + BAFunctionsDestroy diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj new file mode 100644 index 00000000..94d44ac3 --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj @@ -0,0 +1,66 @@ + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {DDD02BDE-B44F-4F37-A359-CE802750CB45} + DynamicLibrary + Unicode + BafRelatedBundleVariableTesting + BafRelatedBundleVariableTesting.def + true + + + + + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib + + + + + + Create + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp new file mode 100644 index 00000000..fc9d1177 --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +#include "precomp.h" + +static HINSTANCE vhInstance = NULL; + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vhInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vhInstance = NULL; + break; + } + + return TRUE; +} + +extern "C" HRESULT WINAPI BAFunctionsCreate( + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + + hr = CreateBAFunctions(vhInstance, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create BAFunctions interface."); + +LExit: + return hr; +} + +extern "C" void WINAPI BAFunctionsDestroy( + __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, + __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ + ) +{ + BalUninitialize(); +} diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h new file mode 100644 index 00000000..2e14786a --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h @@ -0,0 +1,43 @@ +#pragma once +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + + +#include + +#pragma warning(push) +#pragma warning(disable:4458) // declaration of 'xxx' hides class member +#include +#pragma warning(pop) + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dutil.h" +#include "dictutil.h" +#include "fileutil.h" +#include "locutil.h" +#include "memutil.h" +#include "pathutil.h" +#include "procutil.h" +#include "strutil.h" +#include "thmutil.h" +#include "regutil.h" +#include "xmlutil.h" + +#include "BalBaseBootstrapperApplication.h" +#include "balutil.h" + +#include "BAFunctions.h" +#include "IBAFunctions.h" + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ); diff --git a/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleA.props b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleA.props new file mode 100644 index 00000000..e6cc34cd --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleA.props @@ -0,0 +1,14 @@ + + + + Bundle + hyperlinkLicense + {98ACBCF6-B54A-46AF-8990-DFB8795B965B} + + + + + + + + diff --git a/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wixproj b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wixproj new file mode 100644 index 00000000..b2045deb --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wixproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wxs b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wxs new file mode 100644 index 00000000..4aba7a2f --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BundleAv1/BundleAv1.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wixproj b/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wixproj new file mode 100644 index 00000000..dee120d7 --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wixproj @@ -0,0 +1,13 @@ + + + + + 2.0.0.0 + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wxs b/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wxs new file mode 100644 index 00000000..8608512c --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/BundleAv2/BundleAv2.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageA.props b/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageA.props new file mode 100644 index 00000000..ded7f36b --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageA.props @@ -0,0 +1,9 @@ + + + + {F5E0E236-395D-4E7F-BE0A-00B20F7EAF4B} + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageAv1.wixproj b/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageAv1.wixproj new file mode 100644 index 00000000..45d3b2c8 --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/PackageAv1/PackageAv1.wixproj @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/BAFunctionsTests/PackageAv2/PackageAv2.wixproj b/src/test/burn/TestData/BAFunctionsTests/PackageAv2/PackageAv2.wixproj new file mode 100644 index 00000000..b419f663 --- /dev/null +++ b/src/test/burn/TestData/BAFunctionsTests/PackageAv2/PackageAv2.wixproj @@ -0,0 +1,7 @@ + + + + + 2.0.0.0 + + \ No newline at end of file diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp b/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp deleted file mode 100644 index 5da7b170..00000000 --- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -#include "precomp.h" -#include "BalBaseBAFunctions.h" -#include "BalBaseBAFunctionsProc.h" - -const DWORD VARIABLE_GROW_FACTOR = 80; -const LPCWSTR STRING_VARIABLE = L"AString"; -const LPCWSTR NUMBER_VARIABLE = L"ANumber"; - -static void CALLBACK BafRelatedBundleVariableTestingTraceError( - __in_z LPCSTR szFile, - __in int iLine, - __in REPORT_LEVEL rl, - __in UINT source, - __in HRESULT hrError, - __in_z __format_string LPCSTR szFormat, - __in va_list args - ); - -class CBafRelatedBundleVariableTesting : public CBalBaseBAFunctions -{ -public: // IBAFunctions - - -public: //IBootstrapperApplication - virtual STDMETHODIMP OnDetectRelatedBundle( - __in_z LPCWSTR wzBundleId, - __in BOOTSTRAPPER_RELATION_TYPE relationType, - __in_z LPCWSTR wzBundleTag, - __in BOOL fPerMachine, - __in LPCWSTR wzVersion, - __in BOOL fMissingFromCache, - __inout BOOL* pfCancel - ) - { - - HRESULT hr = S_OK; - LPWSTR wzValue = NULL; - - hr = BalGetRelatedBundleVariable(wzBundleId, STRING_VARIABLE, &wzValue); - - ExitOnFailure(hr, "Failed to get related bundle string variable."); - - if (wzValue) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "AString = %ws", wzValue); - } - - hr = BalGetRelatedBundleVariable(wzBundleId, NUMBER_VARIABLE, &wzValue); - - if (wzValue) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "ANumber = %ws", wzValue); - } - - hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); - LExit: - ReleaseStr(wzValue); - return hr; - } -private: - - -public: - // - // Constructor - initialize member variables. - // - CBafRelatedBundleVariableTesting( - __in HMODULE hModule, - __in IBootstrapperEngine* pEngine, - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs - ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) - { - } - - // - // Destructor - release member variables. - // - ~CBafRelatedBundleVariableTesting() - { - } - -private: -}; - - -HRESULT WINAPI CreateBAFunctions( - __in HMODULE hModule, - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, - __inout BA_FUNCTIONS_CREATE_RESULTS* pResults - ) -{ - HRESULT hr = S_OK; - CBafRelatedBundleVariableTesting* pBAFunctions = NULL; - IBootstrapperEngine* pEngine = NULL; - - DutilInitialize(&BafRelatedBundleVariableTestingTraceError); - - hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); - ExitOnFailure(hr, "Failed to initialize Bal."); - - pBAFunctions = new CBafRelatedBundleVariableTesting(hModule, pEngine, pArgs); - ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CBafRelatedBundleVariableTesting object."); - - pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; - pResults->pvBAFunctionsProcContext = pBAFunctions; - pBAFunctions = NULL; - -LExit: - ReleaseObject(pBAFunctions); - ReleaseObject(pEngine); - - return hr; -} - -static void CALLBACK BafRelatedBundleVariableTestingTraceError( - __in_z LPCSTR /*szFile*/, - __in int /*iLine*/, - __in REPORT_LEVEL /*rl*/, - __in UINT source, - __in HRESULT hrError, - __in_z __format_string LPCSTR szFormat, - __in va_list args - ) -{ - // BalLogError currently uses the Exit... macros, - // so if expanding the scope need to ensure this doesn't get called recursively. - if (DUTIL_SOURCE_THMUTIL == source) - { - BalLogErrorArgs(hrError, szFormat, args); - } -} diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def b/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def deleted file mode 100644 index 6e016dad..00000000 --- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def +++ /dev/null @@ -1,6 +0,0 @@ -; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - - -EXPORTS - BAFunctionsCreate - BAFunctionsDestroy diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj b/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj deleted file mode 100644 index 94d44ac3..00000000 --- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {DDD02BDE-B44F-4F37-A359-CE802750CB45} - DynamicLibrary - Unicode - BafRelatedBundleVariableTesting - BafRelatedBundleVariableTesting.def - true - - - - - - - comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib - - - - - - Create - - - - - - - - - - - - - - - diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.cpp b/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.cpp deleted file mode 100644 index fc9d1177..00000000 --- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -#include "precomp.h" - -static HINSTANCE vhInstance = NULL; - -extern "C" BOOL WINAPI DllMain( - IN HINSTANCE hInstance, - IN DWORD dwReason, - IN LPVOID /* pvReserved */ - ) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - ::DisableThreadLibraryCalls(hInstance); - vhInstance = hInstance; - break; - - case DLL_PROCESS_DETACH: - vhInstance = NULL; - break; - } - - return TRUE; -} - -extern "C" HRESULT WINAPI BAFunctionsCreate( - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, - __inout BA_FUNCTIONS_CREATE_RESULTS* pResults - ) -{ - HRESULT hr = S_OK; - - hr = CreateBAFunctions(vhInstance, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create BAFunctions interface."); - -LExit: - return hr; -} - -extern "C" void WINAPI BAFunctionsDestroy( - __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, - __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ - ) -{ - BalUninitialize(); -} diff --git a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.h b/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.h deleted file mode 100644 index 2e14786a..00000000 --- a/src/test/burn/TestData/Manual/BafRelatedBundleVariableTesting/precomp.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - - -#include - -#pragma warning(push) -#pragma warning(disable:4458) // declaration of 'xxx' hides class member -#include -#pragma warning(pop) - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dutil.h" -#include "dictutil.h" -#include "fileutil.h" -#include "locutil.h" -#include "memutil.h" -#include "pathutil.h" -#include "procutil.h" -#include "strutil.h" -#include "thmutil.h" -#include "regutil.h" -#include "xmlutil.h" - -#include "BalBaseBootstrapperApplication.h" -#include "balutil.h" - -#include "BAFunctions.h" -#include "IBAFunctions.h" - -HRESULT WINAPI CreateBAFunctions( - __in HMODULE hModule, - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, - __inout BA_FUNCTIONS_CREATE_RESULTS* pResults - ); diff --git a/src/test/burn/TestData/Manual/BundleD/BundleD.wixproj b/src/test/burn/TestData/Manual/BundleD/BundleD.wixproj deleted file mode 100644 index 1df1f895..00000000 --- a/src/test/burn/TestData/Manual/BundleD/BundleD.wixproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - Bundle - customHyperlinkLicense - {98ACBCF6-B54A-46AF-8990-DFB8795B965B} - 1.0.0.0 - - - - - - - - - - - - - - - diff --git a/src/test/burn/TestData/Manual/BundleD/BundleD.wxs b/src/test/burn/TestData/Manual/BundleD/BundleD.wxs deleted file mode 100644 index a877e214..00000000 --- a/src/test/burn/TestData/Manual/BundleD/BundleD.wxs +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/test/burn/TestData/Manual/BundleD/ManualTests.txt b/src/test/burn/TestData/Manual/BundleD/ManualTests.txt deleted file mode 100644 index 309338cc..00000000 --- a/src/test/burn/TestData/Manual/BundleD/ManualTests.txt +++ /dev/null @@ -1,10 +0,0 @@ -BafRelatedBundleVariableTesting -# Building, Run initial build w/ no parameters, run a second (re)build w/ a /p:Version=1.1.0.0 (ensure it actually builds, as CLI params aren't accounted in the build optimization) -1. Run BundleD.exe (v1.0). -2. Click Install. -3. Verify that the Bundle installs successfully. -4. Run BundleD.exe (v1.1). -5. Check the log file in %TEMP% There should be lines reporting: -[0708:04B4]i000: AString = This is a test -[0708:04B4]i000: ANumber = 42 - diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BAFunctionsTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BAFunctionsTests.cs new file mode 100644 index 00000000..5ca3d452 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/BAFunctionsTests.cs @@ -0,0 +1,31 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolsetTest.BurnE2E +{ + using WixTestTools; + using Xunit; + using Xunit.Abstractions; + + public class BAFunctionsTests : BurnE2ETests + { + public BAFunctionsTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } + + [RuntimeFact] + public void LogsPersistedRelatedBundleVariables() + { + this.CreatePackageInstaller("PackageAv1"); + this.CreatePackageInstaller("PackageAv2"); + var bundleAv1 = this.CreateBundleInstaller("BundleAv1"); + var bundleAv2 = this.CreateBundleInstaller("BundleAv2"); + + bundleAv1.Install(); + bundleAv1.VerifyRegisteredAndInPackageCache(); + + var bundleAv2InstallLogFilePath = bundleAv2.Install(); + bundleAv2.VerifyRegisteredAndInPackageCache(); + + Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"Retrieved related bundle variable with BAFunctions: ANumber = 42")); + Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"Retrieved related bundle variable with BAFunctions: AString = This is a test")); + } + } +} -- cgit v1.2.3-55-g6feb