Skip to content

Out of tree builds#4235

Merged
pks-t merged 6 commits into
libgit2:masterfrom
pks-t:pks/out-of-tree-builds
Jun 27, 2017
Merged

Out of tree builds#4235
pks-t merged 6 commits into
libgit2:masterfrom
pks-t:pks/out-of-tree-builds

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented May 10, 2017

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.

@tkelman
Copy link
Copy Markdown
Contributor

tkelman commented May 10, 2017

Should one or more of the travis builds be done out of tree so this doesn't regress?

@pks-t
Copy link
Copy Markdown
Member Author

pks-t commented May 10, 2017

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.

@pks-t
Copy link
Copy Markdown
Member Author

pks-t commented May 10, 2017

Something like this maybe. Untested as of now, will probably not build. Opinions?

@pks-t pks-t force-pushed the pks/out-of-tree-builds branch from b04578a to 45f58a0 Compare May 15, 2017 05:32
@pks-t
Copy link
Copy Markdown
Member Author

pks-t commented May 15, 2017

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.

@pks-t pks-t force-pushed the pks/out-of-tree-builds branch from 45f58a0 to 55bc95b Compare June 6, 2017 07:30
@pks-t pks-t force-pushed the pks/out-of-tree-builds branch from 55bc95b to 99deb34 Compare June 21, 2017 06:04
pks-t added 6 commits June 23, 2017 15:17
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.
@pks-t pks-t force-pushed the pks/out-of-tree-builds branch from 99deb34 to b6ed67c Compare June 23, 2017 13:18
@pks-t
Copy link
Copy Markdown
Member Author

pks-t commented Jun 23, 2017

Fixed missing sandbox cleanup. Should pass now on AppVeyor.

@pks-t pks-t merged commit 6b2133b into libgit2:master Jun 27, 2017
@pks-t pks-t deleted the pks/out-of-tree-builds branch June 27, 2017 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants