-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathComputer01Test.cs
157 lines (137 loc) · 7.46 KB
/
Computer01Test.cs
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// <copyright file="Computer01Test.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
// </copyright>
using Datadog.Profiler.IntegrationTests.Helpers;
using Xunit;
using Xunit.Abstractions;
namespace Datadog.Profiler.SmokeTests
{
public class Computer01Test
{
private readonly ITestOutputHelper _output;
public Computer01Test(ITestOutputHelper output)
{
_output = output;
}
// NOTE: now that .NET Framework is supported by default, the profiler tries to connect
// to connect to the Agent using namedpipe. Since the Agent does not exist in CI,
// the ETW support is disabled in the tests for .NET Framework.
// scenarios implemented in Computer01:
// -----------------------------------------------------------------------------------------
// 1: start threads with specific callstacks in another appdomain
// 2: start threads with generic type and method having long parameters list in callstack
// 3: start threads that sleep/task.delay for 10s, 20s, 30s, 40s every minute
// 4: start a thread to compute pi at a certain precision(high CPU usage)
// 5: start a to compute fibonacci (high CPU usage + deep stacks)
// -----------------------------------------------------------------------------------------
[TestAppFact("Samples.Computer01")]
public void CheckAppDomain(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 1", output: _output);
if (framework == "net462")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
runner.RunAndCheck();
}
[TestAppFact("Samples.Computer01")]
public void CheckGenerics(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 2", output: _output);
if (framework == "net462")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
runner.RunAndCheck();
}
[TestAppFact("Samples.Computer01")]
public void CheckPi(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 4", output: _output);
if (framework == "net462")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
runner.RunAndCheck();
}
[TestAppFact("Samples.Computer01")]
public void CheckFibonacci(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 5", output: _output);
if (framework == "net462")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckAppDomainForOldWayToStackWalk(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 1", output: _output);
runner.EnvironmentHelper.CustomEnvironmentVariables[EnvironmentVariables.UseBacktrace2] = "0";
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckGenericsForOldWayToStackWalk(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 2", output: _output);
runner.EnvironmentHelper.CustomEnvironmentVariables[EnvironmentVariables.UseBacktrace2] = "0";
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckPiForOldWayToStackWalk(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 4", output: _output);
runner.EnvironmentHelper.CustomEnvironmentVariables[EnvironmentVariables.UseBacktrace2] = "0";
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckFibonacciForOldWayToStackWalk(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 5", output: _output);
runner.EnvironmentHelper.CustomEnvironmentVariables[EnvironmentVariables.UseBacktrace2] = "0";
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckAppDomainForNewCpuProfiler(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 1", output: _output);
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerType, "TimerCreate");
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerEnabled, "1");
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckGenericsForNewCpuProfiler(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 2", output: _output);
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerType, "TimerCreate");
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerEnabled, "1");
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckPiForNewCpuProfiler(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 4", output: _output);
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerType, "TimerCreate");
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerEnabled, "1");
runner.RunAndCheck();
}
[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.Computer01")]
public void CheckFibonacciForNewCpuProfiler(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 5", output: _output);
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerType, "TimerCreate");
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.CpuProfilerEnabled, "1");
runner.RunAndCheck();
}
}
}