[llvm] [llvm][llvm-lit] Add option to create unique result file names if results already exist (PR #112729)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 01:13:47 PDT 2024
================
@@ -14,11 +16,43 @@ def by_suite_and_test_path(test):
return (test.suite.name, id(test.suite), test.path_in_suite)
-class JsonReport(object):
+class Report(object):
def __init__(self, output_file):
self.output_file = output_file
+ # Set by the option parser later.
+ self.use_unique_output_file_name = False
def write_results(self, tests, elapsed):
+ if self.use_unique_output_file_name:
+ file = None
+ filepath = self.output_file
+ attempt = 0
+ while file is None:
----------------
jh7370 wrote:
Rather than looping and incrementing a counter, have you considered either using a UUID as a name suffix or `tempfile.mkstemp`? The latter should provide the functionality you need, unless you specifically want the incrementing behaviour, of course.
https://github.com/llvm/llvm-project/pull/112729
More information about the llvm-commits
mailing list