This patch focuses on adding additional testing for the --source switch. For reference, the source-interleave-x86_64.ll has been split into two parts - the input (shared with the other tests) and the test itself.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
2 ↗ | (On Diff #199776) | Rename.. |
test/tools/llvm-objdump/X86/source-interleave-missing-source.test | ||
5 ↗ | (On Diff #199776) | I wanted to ask whether sed -e 's,SRC_COMPDIR,%p,' works on Windows, if it works, we don't need to use %/p. In a *nix shell, printf %s '\a\b' => \a\b |
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
2 ↗ | (On Diff #199776) | Rename which bit? I can't rename the file to two different files (as things stand I've renamed X86/source-interleave-x86_64.ll to X86/source-interleave-x86_64.test). Also, my patch creation process may sometimes mess things up (sometimes it thinks things are modified, not added for example), but the final commit will actually be a rename. If you're referring to renaming "source-interleave-x86_64.c" to something else, then no, because that needs to point at the .c file that this .ll was generated from (and that is unchanged). |
test/tools/llvm-objdump/X86/source-interleave-missing-source.test | ||
5 ↗ | (On Diff #199776) | %p doesn't work in that string, because it becomes something like "C:\test\directory" and the \t and \d get interpreted as escape characters. See also https://reviews.llvm.org/D61856. Note: I do most of my development on Windows, so I'll pick up issues like that. |
I do not feel I am right person to accept that, would be nice to have someone else to take a look.
But I read carefully all the test cases and what is going on looks reasonable to me, so I think it is correct.
Minor question is inlined.
test/tools/llvm-objdump/X86/source-interleave-invalid-source.test | ||
---|---|---|
5 ↗ | (On Diff #199776) | May be silly question, but what if it is lower? I.e. s,line: 7,line: -1,g? |
test/tools/llvm-objdump/X86/source-interleave-invalid-source.test | ||
---|---|---|
5 ↗ | (On Diff #199776) | I don't think so. That sounds like it's testing llc's handling of weird looking data. I'll experiment though to see what it actually ends up as. |
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
2 ↗ | (On Diff #199776) | Oh I thought you renamed source-interleave-x86_64.c to source-interleave.c. If the C source hasn't been renamed, why do you rename the .ll file? |
17 ↗ | (On Diff #199776) | I don't know how you feel about it, but I think these functions can just be empty. That is sufficient to emit debug info entries which will be used by the line table parser. |
test/tools/llvm-objdump/X86/source-interleave-missing-source.test | ||
5 ↗ | (On Diff #199776) | That test said \t didn't work in double quotes. If \t doesn't work in single quotes, either, %/p seems fine. |
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
17 ↗ | (On Diff #199776) | I think having the real implementation (even if it's relatively short) will be a more realistic test of interleaved source. But maybe I don't understand your comment? |
41 ↗ | (On Diff #199776) | Mind adding a comment here (or maybe at the top) that tests using this file need to run sed to fix this? Took me longer than I would like to admit to realize that. |
test/tools/llvm-objdump/X86/source-interleave-x86_64.test | ||
1 ↗ | (On Diff #199776) | Change ; to # for the test now that it doesn't have to parse as a .ll file |
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
17 ↗ | (On Diff #199776) | I ask because I find these irrelevant lines make the test hard to read. I am fine if you decide to keep the status quo. What is important here is the source, the IR is just to provide debug information. If the function body is empty, we may argue that after optimizations the function is known to be empty..... |
Address some review comments (discussed inline). Change a %t to %/t, and tidy up a couple of double spaces.
test/tools/llvm-objdump/X86/Inputs/source-interleave.ll | ||
---|---|---|
2 ↗ | (On Diff #199776) | I can name it source-interleave-x86_64.ll if you prefer. It's in a different directory to where the code comes from, so it's still a new file. |
17 ↗ | (On Diff #199776) | I'm okay doing this, but maybe in a separate patch, since that keeps the diffs cleaner, and shouldn't impact the new tests. By the way, the original contributor was specifically asked to produce the .ll from the .c file for the original test. |
41 ↗ | (On Diff #199776) | I've added the comment to the top of the file. |
test/tools/llvm-objdump/X86/source-interleave-invalid-source.test | ||
5 ↗ | (On Diff #199776) | As I suspected, llc emits an error if passed a negative number. |
test/tools/llvm-objdump/X86/source-interleave-missing-source.test | ||
5 ↗ | (On Diff #199776) | I've tried single-quotes, and it doesn't work unfortunately. |
@MaskRay, are you happy with this as is, or would you like any further changes in this patch?
I just wanted to ask if you want to make the test easier to read (making the function body empty), or to make it realistic (no change). I'm happy with either choice.
I started looking at simplifying the test input, but quickly realised that I'm not familiar enough with the format, and couldn't get it to work easily. As there isn't a desperate need to change things, I'm inclined to leave it as is, although if others want to make that change, I'm not opposed to it.
This caused lit failures for somebody who had 'main' in their directory tree, so I am changing the --implicit-check-not=main lines into --implicit-check-not='main()'. Let me know if anybody thinks this is a bad idea.