[PATCH] D48050: [lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it on Windows

Stella Stamenova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 13:27:13 PDT 2018


stella.stamenova created this revision.
stella.stamenova added reviewers: labath, zturner, asmith.
Herald added a subscriber: llvm-commits.

test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails.
During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable).
This change also fixes both the positive and negative cases on Windows. There were a few issues:

1. In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success.
2. In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF).
3. In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string.


Repository:
  rL LLVM

https://reviews.llvm.org/D48050

Files:
  packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
  packages/Python/lldbsuite/test/lldbtest.py
  source/Host/windows/ProcessLauncherWindows.cpp
  source/Plugins/Process/Windows/Common/DebuggerThread.cpp
  source/Plugins/Process/Windows/Common/ProcessWindows.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48050.150828.patch
Type: text/x-patch
Size: 6351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/445e086a/attachment.bin>


More information about the llvm-commits mailing list