How can I detect that LLDB is running from within the test suite?

When the test suite runs, there’s a few things I need to do differently than when the test suite doesn’t run.

  1. I need to configure Windows so that instead of popping up an error dialog and waiting for user interaction whenever we crash, it just silently crashes and generates a dump.

  2. I need to force inferiors to launch without a console window.

Both of these things are very Windows-specific, so if I were to add a method to the public API, the method wouldn’t make sense for other platforms.

Also, #2 is probably something that we always want when running from the test suite, but #1 is something that I can imagine wanting to be configurable. For example, when running the test suite on a build bot, obviously we must not have any popups that require user interaction. But when running the test suite locally, we would want the popup so that we can easily attach a debugger and figure out why the test is crashing.

Any thoughts as to the best way to achieve this? One idea I had was to have the test suite set an environment variable, and have LLDB look for this environment variable. That seems like a bit of a hack, so I’m open to other suggestions.

When the test suite runs, there's a few things I need to do differently than when the test suite doesn't run.

1) I need to configure Windows so that instead of popping up an error dialog and waiting for user interaction whenever we crash, it just silently crashes and generates a dump.

You aren't manually popping up an alert from a command line tool are you? Is this something built into windows? Or is this LLDB that is crashing? If it is LLDB or python that is crashing, then I can see adding something to detect this.

2) I need to force inferiors to launch without a console window.

Both of these things are very Windows-specific, so if I were to add a method to the public API, the method wouldn't make sense for other platforms.

Also, #2 is probably something that we always want when running from the test suite, but #1 is something that I can imagine wanting to be configurable. For example, when running the test suite on a build bot, obviously we must not have any popups that require user interaction. But when running the test suite locally, we would want the popup so that we can easily attach a debugger and figure out why the test is crashing.

I would never pop anything up in a dialog box if possible. If you are debugging a process and it crashes, the debugger should show you the crash.

Any thoughts as to the best way to achieve this? One idea I had was to have the test suite set an environment variable, and have LLDB look for this environment variable. That seems like a bit of a hack, so I'm open to other suggestions.

If this is detecting when LLDB or python crashes, then I would suppress this using an environment variable that is set by something in lldbtest.py for windows only.

Its a windows thing, built into the os. Nothing we’re doing, although we can opt out of it by making a few system calls at startup.

In general its very useful because it allows to attach to a process that crashed without having to use a dump, and have full access to the process’s address space, but obviously we want to turn this off when lldb is being automated, as in the case of the test suite.

Also yes this is for the case when lldb, used as a python module, crashes. But we only want to disable it in the extension module case. The default behavior when you run lldb from the command line should be to pop up the dialog, since that is the normal behavior when windows apps crash