aboutsummaryrefslogtreecommitdiff
path: root/src/test/examples/TestEngine/ReloadEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/examples/TestEngine/ReloadEngine.cpp')
-rw-r--r--src/test/examples/TestEngine/ReloadEngine.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/examples/TestEngine/ReloadEngine.cpp b/src/test/examples/TestEngine/ReloadEngine.cpp
new file mode 100644
index 00000000..83541672
--- /dev/null
+++ b/src/test/examples/TestEngine/ReloadEngine.cpp
@@ -0,0 +1,43 @@
1// 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.
2
3#include "precomp.h"
4
5HRESULT RunReloadEngine(
6 __in LPCWSTR wzBundleFilePath,
7 __in LPCWSTR wzBAFilePath
8 )
9{
10 HRESULT hr = S_OK;
11 TestEngine* pTestEngine = NULL;
12
13 pTestEngine = new TestEngine();
14 ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine.");
15
16 hr = pTestEngine->Initialize(wzBundleFilePath);
17 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine.");
18
19 hr = pTestEngine->LoadBA(wzBAFilePath);
20 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA.");
21
22 hr = pTestEngine->SendStartupEvent();
23 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup.");
24
25 hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER);
26 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown.");
27
28 pTestEngine->UnloadBA();
29
30 hr = pTestEngine->LoadBA(wzBAFilePath);
31 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA.");
32
33 hr = pTestEngine->SendStartupEvent();
34 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup.");
35
36 hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART);
37 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown.");
38
39 pTestEngine->UnloadBA();
40
41LExit:
42 return hr;
43}