-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize the environment variable names used by crashtracking #5898
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,55 +80,5 @@ public void EnsureAppDoesNotCrashIfProfilerDeactivateAndTracerActivated(string a | |
var lines = File.ReadAllLines(logFile); | ||
lines.Should().ContainMatch(expectedErrorMessage); | ||
} | ||
|
||
[TestAppFact("Samples.ExceptionGenerator")] | ||
public void RedirectCrashHandler(string appName, string framework, string appAssembly) | ||
{ | ||
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, enableTracer: true, commandLine: "--scenario 7"); | ||
|
||
runner.Environment.SetVariable("COMPlus_DbgMiniDumpType", string.Empty); | ||
|
||
RegisterCrashHandler(runner); | ||
|
||
using var processHelper = runner.LaunchProcess(); | ||
|
||
runner.WaitForExitOrCaptureDump(processHelper.Process, milliseconds: 30_000).Should().BeTrue(); | ||
processHelper.Drain(); | ||
processHelper.ErrorOutput.Should().Contain("Unhandled exception. System.InvalidOperationException: Task failed successfully"); | ||
processHelper.StandardOutput.Should().MatchRegex(@"createdump [\w\.\/]+createdump \d+") | ||
.And.NotContain("Writing minidump"); | ||
} | ||
|
||
[TestAppFact("Samples.ExceptionGenerator")] | ||
public void DontRedirectCrashHandlerIfPathNotSet(string appName, string framework, string appAssembly) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe keep this test and rename it into GenerateDumpIfDbgRequested to validate that existing CLR behavior is still working with CrashTracking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 904b7eb |
||
{ | ||
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, enableTracer: true, commandLine: "--scenario 7"); | ||
|
||
// Don't set DD_TRACE_CRASH_HANDLER. In that case, the call to createdump shouldn't be redirected | ||
runner.Environment.SetVariable("COMPlus_DbgEnableMiniDump", "1"); | ||
runner.Environment.SetVariable("COMPlus_DbgMiniDumpName", "/dev/null"); | ||
runner.Environment.SetVariable("COMPlus_DbgMiniDumpType", string.Empty); | ||
|
||
using var processHelper = runner.LaunchProcess(); | ||
|
||
runner.WaitForExitOrCaptureDump(processHelper.Process, milliseconds: 30_000).Should().BeTrue(); | ||
processHelper.Drain(); | ||
processHelper.ErrorOutput.Should().Contain("Unhandled exception. System.InvalidOperationException: Task failed successfully"); | ||
processHelper.StandardOutput.Should().NotMatchRegex(@"createdump [\w\.\/]+createdump \d+") | ||
.And.Contain("Writing minidump"); | ||
} | ||
|
||
private void RegisterCrashHandler(TestApplicationRunner runner) | ||
{ | ||
var crashHandler = "/bin/echo"; | ||
|
||
if (!File.Exists(crashHandler)) | ||
{ | ||
_output.WriteLine($"Crash handler {crashHandler} does not exist."); | ||
throw new FileNotFoundException($"Crash handler {crashHandler} does not exist."); | ||
} | ||
|
||
runner.Environment.SetVariable("DD_TRACE_CRASH_HANDLER", crashHandler); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constants for env var names to avoid repeating them and maybe introduce typos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 904b7eb