aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2024-06-20 08:19:45 -0700
committerAdrian Prantl <aprantl@apple.com>2024-06-20 09:45:58 -0700
commit869f5517605224944d6037716e234d9f1f0e7067 (patch)
tree1551cc7af991e6bc0af90597eb8830aad12ef47c /lldb
parentc65fb32ddd2f35ecda4db58e78290839f9249c23 (diff)
downloadllvm-869f5517605224944d6037716e234d9f1f0e7067.zip
llvm-869f5517605224944d6037716e234d9f1f0e7067.tar.gz
llvm-869f5517605224944d6037716e234d9f1f0e7067.tar.bz2
[lldb] Give more time to test/API/multiple-debuggers
This test occasionally fails on two of the busiest CI bots (asan and matrix), and we can't reproduce it locally. This leads to the hypothesis that the test is timing out (in the sense of the number of "join attempts" performed by this test's driver). This commit doubles the number of iterations performed and also does an NFC refactor of the main test loop so that it can be more easily understood.
Diffstat (limited to 'lldb')
-rw-r--r--lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp55
1 files changed, 30 insertions, 25 deletions
diff --git a/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp b/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
index 5cf5ff3..c9c0bcf 100644
--- a/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
+++ b/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
@@ -216,6 +216,22 @@ void *do_one_debugger (void *in)
return (void*) 1;
}
+int count_completed_threads(int num_threads) {
+ int num_completed_threads = 0;
+ for (int i = 0; i < num_threads; i++)
+ if (completed_threads_array[i])
+ num_completed_threads++;
+ return num_completed_threads;
+}
+
+int count_successful_threads(int num_threads) {
+ int num_successful_threads = 0;
+ for (int i = 0; i < num_threads; i++)
+ if (successful_threads_array[i])
+ num_successful_threads++;
+ return num_successful_threads;
+}
+
int main (int argc, char **argv)
{
#if !defined(_MSC_VER)
@@ -241,26 +257,15 @@ int main (int argc, char **argv)
}
- int max_time_to_wait = 20; // 20 iterations, or 60 seconds
- int iter = 0;
- while (1)
- {
+ int max_time_to_wait = 40; // 40 iterations, or 120 seconds
+ if (getenv("ASAN_OPTIONS"))
+ max_time_to_wait *= 4;
+ for (int iter = 0; iter < max_time_to_wait; iter++) {
std::this_thread::sleep_for(std::chrono::seconds(3));
- bool all_done = true;
- int successful_threads = 0;
- int total_completed_threads = 0;
- for (uint64_t i = 0; i < NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS; i++)
- {
- if (successful_threads_array[i] == true)
- successful_threads++;
- if (completed_threads_array[i] == true)
- total_completed_threads++;
- if (completed_threads_array[i] == false)
- {
- all_done = false;
- }
- }
- if (all_done)
+ int successful_threads = count_successful_threads(NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS);
+ int total_completed_threads = count_completed_threads(NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS);
+
+ if (total_completed_threads == NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS)
{
#if DEBUG == 1
printf ("All threads completed.\n");
@@ -275,14 +280,14 @@ int main (int argc, char **argv)
printf ("%d threads completed so far (%d successfully), out of %d\n", total_completed_threads, successful_threads, NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS);
#endif
}
- if (iter++ == max_time_to_wait)
- {
- printf ("reached maximum timeout but only %d threads have completed so far (%d successfully), out of %d. Exiting.\n", total_completed_threads, successful_threads, NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS);
- break;
- }
+ if (iter == max_time_to_wait)
+ printf("reached maximum timeout but only %d threads have completed "
+ "so far "
+ "(%d successfully), out of %d. Exiting.\n",
+ total_completed_threads, successful_threads,
+ NUMBER_OF_SIMULTANEOUS_DEBUG_SESSIONS);
}
-
SBDebugger::Terminate();
exit (1);
}