Skip to content

[lit] Honor --max-time as an absolute deadline#202324

Open
prasoon054 wants to merge 1 commit into
llvm:mainfrom
prasoon054:fix/lit-max-time
Open

[lit] Honor --max-time as an absolute deadline#202324
prasoon054 wants to merge 1 commit into
llvm:mainfrom
prasoon054:fix/lit-max-time

Conversation

@prasoon054
Copy link
Copy Markdown
Contributor

Currently, Run._wait_for snapshots the time budget once and reuses it for every AsyncResults.get(), so only the first wait honors the deadline. --max-time then stops capping total testing time, a run can exceed it.

With this change, deadline-time.time() is recomputed on each wait.

Currently, Run._wait_for snapshots the time budget once and reuses it for every AsyncResults.get(), so only the first wait honors the deadline. --max-time then stops capping total testing time, a run can exceed it.

With this change, deadline-time.time() is recomputed on each wait.

Signed-off-by: Prasoon Kumar <prasoonkumar054@gmail.com>
@llvmorg-github-actions
Copy link
Copy Markdown

@llvm/pr-subscribers-testing-tools

Author: Prasoon (prasoon054)

Changes

Currently, Run._wait_for snapshots the time budget once and reuses it for every AsyncResults.get(), so only the first wait honors the deadline. --max-time then stops capping total testing time, a run can exceed it.

With this change, deadline-time.time() is recomputed on each wait.


Full diff: https://github.com/llvm/llvm-project/pull/202324.diff

1 Files Affected:

  • (modified) llvm/utils/lit/lit/run.py (+2-2)
diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index 6c6d464a6881a..acab69365ebe0 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -16,6 +16,7 @@
 def _ceilDiv(a, b):
     return (a + b - 1) // b
 
+
 class MaxFailuresError(Exception):
     pass
 
@@ -141,12 +142,11 @@ def _execute(self, deadline):
                 pool.join()
 
     def _wait_for(self, async_results, deadline):
-        timeout = deadline - time.time()
         idx = 0
         while len(async_results) > 0:
             try:
                 ar = async_results.pop(0)
-                test = ar.get(timeout)
+                test = ar.get(deadline - time.time())
             except multiprocessing.TimeoutError:
                 raise TimeoutError()
             else:

@prasoon054
Copy link
Copy Markdown
Contributor Author

Windows failure is #202255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant