Trick-17 / clang-build

Clang-based cross platform build system written in Python
https://clang-build.readthedocs.io
MIT License
8 stars 3 forks source link

WIP: automatic discovery and build of tests and examples #73

Closed GPMueller closed 5 years ago

GPMueller commented 6 years ago

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.

codecov[bot] commented 6 years ago

Codecov Report

Merging #73 into master will decrease coverage by 0.63%. The diff coverage is 81.04%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
clang_build/clang_build.py 71.28% <100%> (+2.63%) :arrow_up:
clang_build/io_tools.py 100% <100%> (ø) :arrow_up:
clang_build/dependency_tools.py 70.45% <100%> (+6.56%) :arrow_up:
clang_build/project.py 66.11% <29.03%> (-5.72%) :arrow_down:
clang_build/target.py 89.96% <92.13%> (-0.12%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 88f833d...cfd0ca1. Read the comment docs.

NOhs commented 5 years ago

Can't we already have tests, if we group them in a test folder? Aren't tests basically normal targets?

GPMueller commented 5 years ago

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. Further, most tests and examples have almost identical content, as they should test the same library, and this can become especially annoying when one wants to define many test executables.

Also, this feature would allow building (maybe later also running?) tests recursively for all targets and their dependencies using the --test-recursive flag (and analogous for examples).

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).

GPMueller commented 5 years ago

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.