abi-cafe
abi-cafe copied to clipboard
A way to print tests
It would be very helpful to be able to print the actual test code that's being compiled.
This way ABI differences can be studied for failed tests. Maybe even print the ASM being generated if possible, if not, the compiler parameters so they can be input to godbolt.
I should document this better: the test harness will created a generated_impls dir whose structure and file names reflect the test cases. All of the source code being used is freely viewable in a pretty-printed form there. For the sake of effeciency, many tests are however grouped/linked/run together. This may make it hard to "isolate" the test in question, although it's mostly a matter of CTRL+Fing.
Unforuntately it's a bit hard to pull the code out in its current form, because each side refers to symbols that the harness DLL provides (all the WRITE/FINISH stuff).
The code is currently written such that we could support an "alternate output" mode which tries to spit out something more self-contained that could potentially be more easily copy-pasted to godbolt. hmm.
For the godbolt usecase you wouldn't actually need anything to "work" right? You can just have one side calling a forward-declared extern, and the other side just declaring a function?
Ideally, the code should contain the function call, and (optionally) a function using the parameters, though, I don't think this is really necessary.
The code would then be pasted in godbolt, and the asm would be studied after compilation with different compilers, and checked for differences.
I'm not sure what you mean by "work". If godbolt can output asm for a program that doesn't contain a main function, that should be enough, yes.
Thanks!
I was assuming the typical usecase you were interested in was mixed-compiler (e.g. clang_calls_gcc), and so you would have two files using two separate "compilers" in godbolt, one for the callee, one for the caller, and and comparing the ASM on both sides.
In this case neither side is actually a properly executable program, but just a staticlib (which godbolt is totally fine with).
Yes, that would be the exact usecase.