This patch will add printing of the output of stdout during compile errors, right below output of stderr.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Changed back to original function signature, as this method gets called once outside the class.
lldb/packages/Python/lldbsuite/test_event/build_exception.py | ||
---|---|---|
7 | This .decode call will be incorrect on python3 if lldb_extensions ever does not contain the stderr_content field. (That's because "<error output unavailable>", a string object, does not have a decode method -- only bytes objects can be decoded in python3. By the looks of things, stderr_content will always be filled in, so you should be able to just replace this with direct member access (called_process_error.lldb_extensions.stderr_content.decode(...)). Also, if I'm not mistaken, this will just concatenate stdout and stderr without any sort of delimiters, or caring about the order in which they are produced. That could end up being confusing because the compilers stderr will come before the compiler command which wrote it. If we're not going to be merging the two streams in the proper sequence (I described one way in https://reviews.llvm.org/D81697#2138665), then it would be better to prefix each stream with it's own header (like you've done in https://reviews.llvm.org/file/data/wxosaassniqt7keadc2v/PHID-FILE-6o2ea7gsgnrznam5k4ua/image.png), so that it is clear that one is looking at two independent streams. | |
lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py | ||
253–269 ↗ | (On Diff #276590) | I believe this file is pretty much unused now. I've created D83545 to remove it. |
PS: Don't worry about the harbormaster failures too much. It's very picky these days...
Hi Pavel,
When I change the stderr argument to point to STDOUT inside the Popen function, which is inside the lldbtest.system function, the output actually gets mixed up. Whereas currently,, after running a couple times, the contents of stderr always gets printed out first and then stdout. In any case, should I just make two headers then?
Using two headers is ok, though I'd like to know what you meant by the "mixed up" comment. Are you saying that the contents comes out nondeterministically? Can you provide an example of that?
Yeah so in this pic,
, you can see in the code that both stdout and stderr point to PIPE, and what gets printed out is the concatenation of the two. However, in , where stderr now points to stdout, and I just print the stdout output, the "clang-11: error" messages from stderr gets mixed up with the results from stdout,Yes, that's exactly what I wanted! :) It matches the output I would get when running that command in the terminal and it makes the error come out right after the compiler command which produced it (it more complex makefiles it may not be so clear which compiler command produced what error).
The fact that the first "random flag" error seemingly comes out before any compiler command is weird but not related to this problem. That happens because our makefile runs a silent (without echoing the command) compiler invocation to build the dependency file. We may possibly want to echo that too, but it doesn't matter that much -- in more realistic scenarios, the error will not be as simple as a missing flag, and the dependency command will succeed, but the error will come from the compilation step.
Modified stderr output instead of concatenating the stderr and stdout output strings.
Ok, I have revised the patch with the code from the first pic. I also moved the decode back to the format_build_error since it was there to begin with(not sure how much of a difference it makes). Also while we finalize this patch, is there another fix I can get started on?
Sure. I don't want to bore you with something too menial. How big of a project would you be interested in? One thing that would be very helpful is to come up with some kind of a strategy for testing the "gui" mode of lldb, as we currently have no good way of testing that. I've described one idea in https://reviews.llvm.org/D82522#2113608, but I'm open to other options too....
lldb/packages/Python/lldbsuite/test/lldbtest.py | ||
---|---|---|
443 | Setting this no longer makes sense, as it will always be empty. Please remove that. Maybe also rename stdout_content to indicate it also contains stderr. Just plain "output" might suffice? | |
448 | this error result also doesn't make sense. It looks like you'll also need to update the usage in getCompilerVersion (line 1276). |
Changed getCompilerVersion and a function in TestDataFormatterSkipSummary to account for stderr being merged with stdout now
Setting this no longer makes sense, as it will always be empty. Please remove that. Maybe also rename stdout_content to indicate it also contains stderr. Just plain "output" might suffice?
Ok, deleted it and changed "stdout_content" to "combined_content".
this error result also doesn't make sense. It looks like you'll also need to update the usage in getCompilerVersion
Ohh your right. I should have check whether other functions depended on stderr stream. So checking the rest of the codebase, it seems the output of system is also used in TestDataFormatterSkipSummary.py, but b/c it only triggers on Macs, I didn't see a failure when I made the change. I have now modified both files accordingly.
Thanks this looks good now. I presume you don't have commit access and need someone to commit this for you?
this error result also doesn't make sense. It looks like you'll also need to update the usage in getCompilerVersion
Ohh your right. I should have check whether other functions depended on stderr stream. So checking the rest of the codebase, it seems the output of system is also used in TestDataFormatterSkipSummary.py, but b/c it only triggers on Macs, I didn't see a failure when I made the change.
LOL, I wonder when was the last time anyone ran the lldb test suite against gcc on a mac. @aprantl, can we just delete the version check blurb in TestDataFormatterSkipSummary.py?
I presume you don't have commit access and need someone to commit this for you?
Yup, that would be great!
Setting this no longer makes sense, as it will always be empty. Please remove that. Maybe also rename stdout_content to indicate it also contains stderr. Just plain "output" might suffice?