Thoughts on tight coupling of tests to system GNU ld #1120
Replies: 4 comments 4 replies
-
|
This would only disable the diffing with other linkers, but the integration tests would still run, right? |
Beta Was this translation helpful? Give feedback.
-
|
I suggest relaxing (hah) the notion of equality to equivalence in the integration tests. It shouldn't matter if GNU ld or lld report slightly different answers from wild. Indeed, they sometimes disagree with each other. These linkers: result in these integration test "failures": Moreover, the relaxations are applied to whichever |
Beta Was this translation helpful? Give feedback.
-
|
I've got a proposal. Wild could have a second and third suite of integration tests, named quite differently from the one that exists now. The second suite of integration tests would pass or fail based on a computation of some kind. That is, they'd have to produce binaries. Those binaries would have to actually load and execute and produce some kind of a signal that they're kosher. You could embed additional data produced by wild as "evidence". I'll spell out the tradeoffs: Pros:
Cons:
The third integration test suite is something I am far more in favor of. It requires conviction - conviction that wild's is good enough to "self test". For the record, I think it is. That is, each test case:
The primary difference between today's integration tests and this third category I am proposing is that "what did ld do" is removed as an input, entirely. The reason this should be a separate test suite is that linker-diff is too useful to not be part of the regular development process. For the most part, ld does the right thing, and simply figuring out what it did, what wild did, and comparing them, with colorised output and decoded instructions is invaluable. The clearest benefit of this, third, test suite over today's integ tests is that what it loses in fidelity (if anything) is made up by the sheer volume of tests that can be run. You can take a particular test case and specialize it for every platform and architecture. All the idiosyncrasies and subtle differences between platforms are runnable from almost any machine. It'd be great if you could make a change on say, Linux, and see how it cascades to the Illumos/FreeBSD specific tests without having to actually run it on such a machine. In my experience, this technique - self-inflicted combinatorial explosion - is very effective. Plus, there's nothing like a huge test suite to incentivize people to write fast software. |
Beta Was this translation helpful? Give feedback.
-
|
Made it possible to disable diffing and only diffing as a test setting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Following on from a comment on #1104...The tight coupling of the tests to the system's GNU ld has definitely had its challenges. I'm unsure of what's best to do. Testing against GNU ld (and lld) often makes it easier to see what we did wrong. This is especially the case when making a change that's supposed to be a refactoring. If you make a change that you think shouldn't affect things, then a test or two fails, when we diff against the GNU ld output, we can often see exactly what we got wrong in the binary, whereas if the binary just segfaulted or gave the wrong result, it might be a lot harder to figure out what we did wrong.
Also, we have on a few occasions discovered actual bugs when we attempted to run the tests on a new platform with different GCC / GNU ld versions / default config etc.
The downside of course is that if people want to run the tests to make sure the linker works on their platform, they see failed test that aren't "the linker is broken" but just "the linker produced a different result than GNU ld".
We also end up running on a lot of different platforms in our CI, but likely the linker doesn't behave differently on these different platforms, it's just that the object files produced by GCC and the system linker against which we compare are slightly different.
For actually developing on the linker and verifying changes to the linker, I think the diff-testing approach works well. For people who just want a quick check that the linker works, I'm less sure.
One option might be to add an additional settings to
test-config.tomlthat turns diffing on and off. We could then have it off by default, on in CI and recommend that developers who are making changes turn it on.I'm curious as to what others think.
Beta Was this translation helpful? Give feedback.
All reactions