From dea25ba9bcfd65200b60339c2e4bc060cdf20723 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Mar 2024 01:44:51 -0800 Subject: Move wixstdba functions to Bal.wixext build --- .../Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp | 47 ++++++++++++++++ .../Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp | 39 ++++++++++++++ .../Bal/test/WixStdFnUnitTest/TestBAFunctions.h | 8 +++ .../TestBootstrapperApplication.cpp | 30 +++++++++++ .../WixStdFnUnitTest/TestBootstrapperApplication.h | 6 +++ .../test/WixStdFnUnitTest/WixStdFnUnitTest.filters | 45 ++++++++++++++++ .../test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj | 62 ++++++++++++++++++++++ src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp | 3 ++ src/ext/Bal/test/WixStdFnUnitTest/precomp.h | 27 ++++++++++ 9 files changed, 267 insertions(+) create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp create mode 100644 src/ext/Bal/test/WixStdFnUnitTest/precomp.h (limited to 'src/ext/Bal/test') diff --git a/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp b/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp new file mode 100644 index 00000000..ba04c1bb --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp @@ -0,0 +1,47 @@ +// 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" + +using namespace System; +using namespace Xunit; +using namespace WixInternal::TestSupport; +using namespace WixInternal::TestSupport::XunitExtensions; + +namespace BalUtilTests +{ + public ref class BAFunctions + { + public: + [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BAFunctions.")] + void CanCreateTestBAFunctions() + { + HRESULT hr = S_OK; + BA_FUNCTIONS_CREATE_ARGS args = { }; + BA_FUNCTIONS_CREATE_RESULTS results = { }; + IBootstrapperEngine* pEngine = NULL; + BOOTSTRAPPER_COMMAND command = { }; + IBAFunctions* pBAFunctions = NULL; + + args.cbSize = sizeof(args); + args.pEngine = pEngine; + args.pCommand = &command; + + results.cbSize = sizeof(results); + + try + { + BalInitialize(pEngine); + + hr = CreateBAFunctions(NULL, &args, &results); + NativeAssert::Succeeded(hr, "Failed to create BAFunctions."); + + pBAFunctions = reinterpret_cast(results.pvBAFunctionsProcContext); + } + finally + { + ReleaseObject(pEngine); + ReleaseObject(pBAFunctions); + } + } + }; +} diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp new file mode 100644 index 00000000..3e850442 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp @@ -0,0 +1,39 @@ +// 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" + +class CTestBAFunctions : public CBalBaseBAFunctions +{ +public: + CTestBAFunctions( + __in HMODULE hModule + ) : CBalBaseBAFunctions(hModule) + { + } +}; + +HRESULT CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + CTestBAFunctions* pFunction = NULL; + + pFunction = new CTestBAFunctions(hModule); + ExitOnNull(pFunction, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object."); + + hr = pFunction->OnCreate(pArgs->pEngine, pArgs->pCommand); + ExitOnFailure(hr, "Failed to initialize new test bafunctions."); + + pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; + pResults->pvBAFunctionsProcContext = pFunction; + pFunction = NULL; + +LExit: + ReleaseObject(pFunction); + return hr; +} diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h new file mode 100644 index 00000000..e25e40c3 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h @@ -0,0 +1,8 @@ +#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. + +HRESULT CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ); diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp new file mode 100644 index 00000000..b345ab9f --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp @@ -0,0 +1,30 @@ +// 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 "BalBaseBootstrapperApplication.h" + +class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication +{ +public: + CTestBootstrapperApplication() : CBalBaseBootstrapperApplication() + { + } +}; + +HRESULT CreateBootstrapperApplication( + __out IBootstrapperApplication** ppApplication + ) +{ + HRESULT hr = S_OK; + CTestBootstrapperApplication* pApplication = NULL; + + pApplication = new CTestBootstrapperApplication(); + ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); + + *ppApplication = pApplication; + pApplication = NULL; + +LExit: + ReleaseObject(pApplication); + return hr; +} diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h new file mode 100644 index 00000000..313bfede --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h @@ -0,0 +1,6 @@ +#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. + +HRESULT CreateBootstrapperApplication( + __out IBootstrapperApplication** ppApplication + ); diff --git a/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters new file mode 100644 index 00000000..0b3b60be --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters @@ -0,0 +1,45 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj new file mode 100644 index 00000000..c0be8e11 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj @@ -0,0 +1,62 @@ + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} + {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631} + UnitTest + ManagedCProj + DynamicLibrary + Unicode + true + false + true + + + + + + + ..\..\..\..\api\burn\inc;..\..\..\..\api\burn\balutil\inc;..\..\wixstdfn\inc;..\..\..\..\libs\dutil\WixToolset.Dutil\inc + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;$(RootBuildFolder)libs\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\dutil.lib;$(RootBuildFolder)api\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\balutil.lib + + + + + + Create + + 4564;4691 + + + + + + + + + + + + {D786C02F-9488-421F-A5A5-D1D31E8E648B} + + + + + + diff --git a/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp b/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp @@ -0,0 +1,3 @@ +// 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" diff --git a/src/ext/Bal/test/WixStdFnUnitTest/precomp.h b/src/ext/Bal/test/WixStdFnUnitTest/precomp.h new file mode 100644 index 00000000..4cdd262c --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/precomp.h @@ -0,0 +1,27 @@ +#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 "TestBAFunctions.h" +#include "TestBootstrapperApplication.h" + +#pragma managed +#include -- cgit v1.2.3-55-g6feb