-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[llvm][lit] fix writing results to --time-trace-output file #130845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-testing-tools Author: Ebuka Ezike (da-viper) ChangesFix crash when time tracing. Full diff: https://github.com/llvm/llvm-project/pull/130845.diff 1 Files Affected:
diff --git a/llvm/utils/lit/lit/reports.py b/llvm/utils/lit/lit/reports.py
index 8312dcddc769a..cd32f0396677c 100755
--- a/llvm/utils/lit/lit/reports.py
+++ b/llvm/utils/lit/lit/reports.py
@@ -286,7 +286,8 @@ def _write_results_to_file(self, tests, elapsed, file):
json_data = {"traceEvents": events}
- json.dump(json_data, time_trace_file, indent=2, sort_keys=True)
+ with open(self.output_file, "w") as time_trace_file:
+ json.dump(json_data, time_trace_file, indent=2, sort_keys=True)
def _get_test_event(self, test, first_start_time):
test_name = test.getFullName()
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: is lit unconditionally failing with a python error here, because time_trace_file
is an unknown identifier?
If so, LGTM, assuming that self.output_file
is a file path and not a file object... (I haven't dug into all the code).
Yes, this is the case. see llvm-project/llvm/utils/lit/lit/reports.py Lines 19 to 23 in 369c0a7
|
Okay, thanks. Do you have commit access or do you need me to merge this for you? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, cancelling my LGTM. I'm not convinced about this change anymore.
I decided to dig into the background of this a bit more and it looks like it's a bug caused by @DavidSpickett's work in 8507dba. As far as I can see, this _write_results_to_file
method shouldn't be called, except via the Report.write_results
method. That method opens the file itself and then passes it into this function.
I think the correct fix is simply to use the passed-in file. @DavidSpickett should be able to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM again, but I'd like @DavidSpickett to just take a quick look to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this looks correct. file
will be the uniquely named file if it's been requested. Thanks for fixing this.
@da-viper, sorry I didn't raise this before, but I just realised that you've got your email address marked as private in GitHub, which means we can't merge this per LLVM policy. See https://llvm.org/docs/DeveloperPolicy.html#email-addresses. Also, I forgot to comment on your PR description/title, since those form the final commit message once this is merged. Since this PR is specific to a particular option, I suggest mentioning that in the title, e.g. "fix writing results to --time-trace file" (I can't remember the actual option name, please use the correct one!). In the description, you don't need to repeat what's in the title, but I'd suggest you add a reference to the commit that caused the issue (i.e. something like "This patch fixes an issue introduced with 8507dba.") Let me know once you've addressed these issues and I'll click the merge button. (NB: if this doesn't happen by about 4pm GMT today, I'll not see your comment and am then off work for 2+ weeks, so you'll need to ask somebody else to merge the PR). |
@jh7370 Should be all done. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/13059 Here is the relevant piece of the build log for the reference
|
) This patch fixes an issue introduced with commit: llvm@8507dba
This patch fixes an issue introduced with commit: 8507dba