Author: labath Date: Sun Apr 21 06:02:41 2019 New Revision: 358847 URL: http://llvm.org/viewvc/llvm-project?rev=358847&view=rev Log: Make TestVSCode_step pass reliably
Summary: The test was failing occasionally (1% of runs or so), because of unpredictable timings between the two threads spawned by the test. If the second thread hit the breakpoint right as we were stepping out of the function on the first thread, we would still be stuck at the inner frame when the process stopped. This would cause errors like: File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm/tools/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py", line 67, in test_step self.assertEqual(x1, x3, 'verify step out variable') AssertionError: 2 != 1 : verify step out variable AFAICT, lldb-vscode is doing the right thing here, and the problem is that the test is not taking this sequence of events into account. Since the test is about testing stepping, it does not seem necessary to have threads in the inferior at all, so I just rewrite the test to execute the code we're supposed to step through directly on the main thread. Reviewers: clayborg, jgorbe Subscribers: jfb, lldb-commits Differential Revision: https://reviews.llvm.org/D60608 Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp?rev=358847&r1=358846&r2=358847&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp Sun Apr 21 06:02:41 2019 @@ -1,5 +1,3 @@ -#include <thread> - int function(int x) { if ((x % 2) == 0) return function(x-1) + x; // breakpoint 1 @@ -8,9 +6,5 @@ int function(int x) { } int main(int argc, char const *argv[]) { - std::thread thread1(function, 2); - std::thread thread2(function, 4); - thread1.join(); - thread2.join(); - return 0; + return function(2); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits