Test the installed package, not just the build tree
Found by building a consumer against a fresh install: an installed libakstdlib was not usable. akstdlibConfig.cmake calls find_dependency(akerror), and the top-level build pulls the submodule in EXCLUDE_FROM_ALL, so `cmake --install` on this project installs only this project and leaves that dependency unresolvable. CI had been hiding it by installing libakerror@main in a separate step -- a different libakerror from the one actually compiled, which is the inconsistency TODO.md 2.3 recorded and the previous commit removed. Removing it exposed the real gap. CI now installs deps/libakerror, the same commit the top-level build compiles, so there is one libakerror in play and the install is consumable. tests/consumer/ is the check that would have caught it: a standalone project, configured against CMAKE_PREFIX_PATH rather than as part of this build, because being part of this build is exactly what would let it pass without testing anything. It exercises what only an install has -- find_package with a version request against the generated version file, find_dependency(akerror) resolving, and the exported akstdlib::akstdlib target -- and touches one function from each of the four sources, so a library installed with a source file missing from its link line fails there rather than in the next consumer to find it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y cmake gcc moreutils
|
||||
# This step used to clone and install libakerror@main as well. That was two
|
||||
# This step used to clone and install libakerror@main. That was two
|
||||
# different libakerrors depending on where you built: the install went to
|
||||
# /usr/local, while the build below is top-level and so compiles
|
||||
# deps/libakerror at the pinned commit via add_subdirectory -- the
|
||||
@@ -25,8 +25,16 @@ jobs:
|
||||
#
|
||||
# The submodule wins. It is the version this repository pins, tests and
|
||||
# ships against, and a CI that tests a different one is testing something
|
||||
# nobody runs. `cmake --install` below still installs both, so the
|
||||
# find_package and pkg-config paths are exercised.
|
||||
# nobody runs. It is installed here as well as compiled, because an
|
||||
# installed libakstdlib is not usable without it: akstdlibConfig.cmake
|
||||
# calls find_dependency(akerror), and the top-level build pulls the
|
||||
# submodule in EXCLUDE_FROM_ALL so `cmake --install` on this project
|
||||
# installs only this project.
|
||||
- name: install the pinned libakerror
|
||||
run: |
|
||||
cmake -S deps/libakerror -B build-akerror
|
||||
cmake --build build-akerror
|
||||
sudo cmake --install build-akerror
|
||||
- name: build and test
|
||||
run: |
|
||||
# -DAKSL_WERROR=ON here and not locally: a warning that stops the build
|
||||
@@ -36,6 +44,16 @@ jobs:
|
||||
cmake --build build
|
||||
sudo cmake --install build
|
||||
ctest --test-dir build --output-on-failure
|
||||
# Build something against what was just installed. The suite links the
|
||||
# build tree, so it says nothing about whether the *installed* package is
|
||||
# usable -- and the two have come apart before: find_dependency(akerror)
|
||||
# resolving is a property of the install, not of the build.
|
||||
- name: consume the installed package
|
||||
run: |
|
||||
sudo ldconfig
|
||||
cmake -S tests/consumer -B build-consumer
|
||||
cmake --build build-consumer
|
||||
./build-consumer/consumer
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
||||
# The sanitizer build is its own job rather than a step on the one above,
|
||||
|
||||
Reference in New Issue
Block a user