From 4a176b759c47fa1970fcfd0d9e25c294bda82ef4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 22 Dec 2019 13:51:35 +1100 Subject: Update the MbaHost test project to use an external exe to load the BA, which allows loading a different .NET than the one running the tests. This also allows writing the tests in C# instead of C++/CLI. --- src/test/examples/TestEngine/ShutdownEngine.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/examples/TestEngine/ShutdownEngine.cpp (limited to 'src/test/examples/TestEngine/ShutdownEngine.cpp') diff --git a/src/test/examples/TestEngine/ShutdownEngine.cpp b/src/test/examples/TestEngine/ShutdownEngine.cpp new file mode 100644 index 00000000..69321d91 --- /dev/null +++ b/src/test/examples/TestEngine/ShutdownEngine.cpp @@ -0,0 +1,23 @@ +// 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" + +HRESULT RunShutdownEngine( + __in LPCWSTR wzBAFilePath + ) +{ + HRESULT hr = S_OK; + TestEngine* pTestEngine = NULL; + + pTestEngine = new TestEngine(); + ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); + + hr = pTestEngine->LoadBA(wzBAFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); + + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); + +LExit: + return hr; +} -- cgit v1.2.3-55-g6feb