forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (63 loc) · 1.74 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (63 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "PackageManager.h"
#include "Tests.h"
using namespace std::string_view_literals;
int main(int argc, const char** argv) try
{
const TestParameters testParameters(argc, argv);
testParameters.OutputDetails();
if (!testParameters.InitializeTestState())
{
return 2;
}
auto test = testParameters.CreateTest();
for (int i = 0; i < testParameters.Iterations; ++i)
{
std::cout << "Begin iteration " << (i + 1) << std::endl;
if (!testParameters.InitializeIterationState())
{
return 2;
}
if (test && !test->RunIterationWork())
{
return 3;
}
if (!testParameters.SkipClearFactories)
{
winrt::clear_factory_cache();
}
if (testParameters.WorkTestSleepInterval)
{
Sleep(testParameters.WorkTestSleepInterval);
}
if (test && !test->RunIterationTest())
{
return 4;
}
std::cout << "Iteration " << (i + 1) << " completed" << std::endl;
}
if (test && !test->RunFinal())
{
return 5;
}
testParameters.UninitializeTestState();
std::cout << "Tests completed" << std::endl;
return 0;
}
catch (const std::exception& e)
{
std::cout << "Caught std exception: " << e.what() << std::endl;
return 1;
}
catch (const winrt::hresult_error& hre)
{
std::cout << "Caught winrt exception: " << winrt::to_string(hre.message()) << std::endl;
return 1;
}
catch (...)
{
std::cout << "Caught unknown exception" << std::endl;
return 1;
}