-
Notifications
You must be signed in to change notification settings - Fork 3
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
WIP: automatic discovery and build of tests and examples #73
Conversation
- if a test folder is found, clang-build will try to build an executable from the sources - a "tests" subcategory of the target configuration can be used to control sources, flags and dependencies - the command line flags are not yet connected
The default is true. If set to false, one executable is created per source file.
With this, as intended, the --tests flag is needed to build tests.
Codecov Report
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
- Coverage 81.07% 80.43% -0.64%
==========================================
Files 12 12
Lines 983 1094 +111
==========================================
+ Hits 797 880 +83
- Misses 186 214 +28
Continue to review full report at Codecov.
|
Todo: warnings, if tests dependencies cannot be found.
Also added a todo comment that we need to improve detection of circular dependencies.
Can't we already have tests, if we group them in a test folder? Aren't tests basically normal targets? |
In #72 I describe how I would expect the feature to work. The point would be to not have to manually specify tests and examples targets. For small projects this could eliminate the need to have a configuration file. Also, this feature would allow building (maybe later also running?) tests recursively for all targets and their dependencies using the One issue that I ran into is the linking of shared library targets, since they are not placed into the test or example binary directories. So executing the tests and examples only works out of the box for static libraries (see also #25). |
The dependency graph now includes tests and examples and their dependencies.
This fixes problems with include folders etc. Also added `rankdir="BT"` global attribute to dependency graph.
ebbfe4a
to
62546c3
Compare
62546c3
to
2dd91b8
Compare
Also amended the customisations docs to explain the `sources` and `sources_exclude` keywords.
This example makes use of the automatic tests and exmaples feature.
- fixed relative paths of sources for tests and examples - fixed a bug with Windows paths being parsed from the depfile - fixed Project.get_targets, which now correctly returns also the test and example targets
This is for targets and examples.
Closing this PR. The implementation on this PR is unsuitable for proper usage. The tests/examples might not only depend on the given target itself, but also on other libraries, potentially from a different subproject. This means that tests/examples dependencies need to be resolved after the creation of the full dependency graph. The build stage improvements described in issue #64 should be implemented first, and a new version of this feature should be implemented. |
Not yet ready for merging
The goal of this PR is to bring this feature far enough that at least a few boost libraries can be built including tests and examples and that there be some reasonable way of executing the tests.
GLFW will be another case to try this on.