-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
build: unvendor gtest #9272
build: unvendor gtest #9272
Conversation
9bf0c46
to
fd2feea
Compare
I cannot be certain as to the original intent of vendoring the library, but my best guess would be a concern regarding version mismatches and the attendant behavior changes: With the vendored version, if a test fails on one platform and succeeds on another, the behavior change likely doesn't owe to differing gtest versions; how much would relying on platform libraries alter that probability calculation? |
We currently only run tests in this CI job. The job uses the installed GTest library from Ubuntu, rather than the vendored library. The CMake is configured such that it prefers a platform library if available. I agree that using an unpinned library for (automated) tests is a risk. The builds in this job are development builds, not release builds. They use different tools and library versions from release builds. The code we test is not equal to the code we ship! We currently do not know if tests would have failed had they been built in a release environment. What I want to move towards with this PR and #9271 is a way to test release builds with a pinned version of GTest. So that we have a CI job that runs a Guix release build and then runs tests with the GTest as defined in Now, this PR is mostly concerned with maintainability. I could of course configure CMake to not prefer system libraries as an alternative solution. But, the issue remains that vendored code of this order of magnitude is messier to update than a package definition in |
I think your strategy for changing CI and testing release builds makes sense. I tend to dislike vendored libraries, so, absent a prior setup, would support your proposal without comment. However, I also think it important to consider the rationale for any decision prior to changing it, so that the change has a solid foundation. Doing my best to infer the reasoning for the original decision, one concern lingers: When you do not control the execution environment, the test behavior itself can change, which introduces interference. This potential problem manifests in two scenarios:
|
The vendored GTest library has existed since one of the first commits in this repository: 296ae46 ("moved all stuff to github"). I don't think we'll ever know precisely why it was vendored. Later that year, in #180, the behavior was changed to prefer using an "external gtest" if available. There are no illuminating comments on that PR explaining the change. The test suite has preferred to use the system library for over a decade and this has (to my knowledge) not resulted in any bug reports. Tests are known to succeed with the latest version of GTest. Unvendoring GTest would not break a local development workflow. Instead of always using the system library (as this PR proposes), we could opt to add it as a submodule instead. This way updating the library doesn't involve copy and pasting a bunch of code and it would guarantee that the same GTest version is used in all testing environments. |
Given that releases presently don't include the test suite, I'm OK with just using the system library, as I agree with your assessment that a submodule would work, if warranted, at a later date. It would be helpful, in my view, to consider generating a separate release artifact which includes the tests with gtest statically linked, but that's outside the scope of your work here. |
Looks like there are some merge conflicts. |
fd2feea
to
ade54a5
Compare
Looks like there's a test failure in |
Happens occasionally, needs further investigation. See also, this run for an unrelated PR. |
ade54a5
to
9ec4b04
Compare
Force pushed without changes to trigger another run, so we can be sure no other problems emerge. |
For testing release builds we would use the GTest from #9271, which is built statically. So this is possible with the current approach. |
On second thought, I prefer the submodule option:
|
Ok, I'll open another PR for that shortly. Would it be okay if we move forward with this PR, and then close #9271 in favor of the submodule PR? |
Yea, I'm fine with this PR, it still net improves the situation. |
I decided to wrap this into #9715 to avoid adding gtest packages to CI, only to remove them there. |
This does not need to exist in our source tree.