Out of tree builds#4235
Merged
Merged
Conversation
Contributor
|
Should one or more of the travis builds be done out of tree so this doesn't regress? |
Member
Author
|
I thought about the same. One solution would be to simply do a "chmod -R a-w /path/to/sources" for all our build jobs and then building out-of-tree. |
Member
Author
|
Something like this maybe. Untested as of now, will probably not build. Opinions? |
b04578a to
45f58a0
Compare
Member
Author
|
So my approach to simply do a chmod does not work, as we're just copying all files into our temporary test directory without adjusting permissions. So I'll just leave our builds as-is for now. |
45f58a0 to
55bc95b
Compare
55bc95b to
99deb34
Compare
Our generate.py script is used to extract and write test suite declarations into the clar.suite file. As is, the script accepts multiple directories on the command line and will generate this file for each of these directories. The generate.py script will always write the clar.suite file into the directory which is about to be scanned. This actually breaks out-of-tree builds with libgit2, as the file will be generated in the source tree instead of in the build tree. This is noticed especially in the case where the source tree is mounted read-only, rendering us unable to build unit tests. Due to us accepting multiple paths which are to be scanned, it is not trivial to fix though. The first solution which comes into mind would be to re-create the directory hierarchy at a given output path or use unique names for the clar.suite files, but this is rather cumbersome and magical. The second and cleaner solution would be to fold all directories into a single clar.suite file, but this would probably break some use-cases. Seeing that we do not ever pass multiple directories to generate.py, we will now simply retire support for this. This allows us to later on introduce an additional option to specify the path where the clar.suite file will be generated at, defaulting to "clar.suite" inside of the scanned directory.
The generate.py script will currently always write the generated clar.suite file into the scanned directory, breaking out-of-tree builds with read-only source directories. Fix this issue by adding another option to allow overriding the output path of the generated file.
The source directory should usually not be touched when using out-of-tree builds. But next to the previously fixed "clar.suite" file, we are also writing the ".clarcache" into the project's source tree, breaking the builds. Fix this by also honoring the output directory for the ".clarcache" file.
Change the output path of generate.py to generate the clar.suite file inside of the binary directory. This fixes out of tree builds with read-only source trees as we now refrain from writing anything into the source tree.
The test `index::tests::can_lock_index` operates on the "testrepo.git" repository located inside of our source tree. While this is okay for tests which do read-only operations on these resouces, this specific test tries to lock the index by creating a lock. This will obviously fail on out-of-tree builds with read-only source trees. Fix the issue by creating a sandbox first.
The test `refs::crashes::double_free` operates on our in-source "testrepo.git" repository without creating a copy first. As the test will try to create a new symbolic reference, this will fail when we want to do a pure out-of-tree build with a read-only source tree. Fix the issue by creating a sandbox first.
99deb34 to
b6ed67c
Compare
Member
Author
|
Fixed missing sandbox cleanup. Should pass now on AppVeyor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I recently started setting up a Docker-based build infrastructure to test several different Linux distributions (e.g. Debian, Ubuntu, Fedora, etc.). It just become too tedious to always set up a new VM for every issue specific to some kind of distribution. Not sure if it's valuable to upstream the Dockerfiles later on, but I guess it wouldn't hurt after all.
I currently mount the libgit2 sources as a read-only volume into the container. This left me unable to build our tree as our out-of-tree builds are broken. We write both the clar.suite and .clarcache files into the source tree rather than into the binary directory. This PR fixes these issues and brings us back to true out-of-tree builds.