tests: fix linking of ai unit tests - #21761
Open
da-phil wants to merge 2 commits into
Open
Conversation
dt_stubs.c had not kept up with the AI backend: add the missing dt_conf_get_bool, dt_conf_get_int, dt_conf_key_exists, dt_control_log and dt_loc_get_user_cache_dir stubs. Make dt_conf_get_string key-aware -- returning "cpu" for every key made _init_ort_api() treat plugins/ai/ort_library_path as a custom library path and fail to load ONNX Runtime. Give the test a fixed environment: an empty XDG_DATA_HOME so locally installed models do not leak into the model discovery assertions, and LD_LIBRARY_PATH for the bundled ORT, which is lazy-loaded by bare filename.
Every matrix entry used the skiptest target, so BUILD_TESTING was never configured and the unit tests were neither compiled nor run. Add one Linux entry with target: build, which enables them and calls ctest. cmocka is a hard requirement of BUILD_TESTING, so add libcmocka-dev to the package list. The new entry shares distro, compiler and build type with an existing one, hence the name suffix; it is undefined for the other entries, so their job names are unchanged.
Contributor
Author
|
Turns out I need #21752 to be merged first, to make it possible to build cmocka unit tests with the recent version of cmocka which is part of the ubuntu 26.04 build environment. Will cherry-pick the fixing commit 721fbeb in the meantime. EDIT: and removed it again. |
da-phil
marked this pull request as ready for review
August 8, 2026 13:39
da-phil
force-pushed
the
add_missing_ai_unittest_stubs
branch
from
August 8, 2026 22:31
5dc4307 to
93bd1e9
Compare
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.
The ai unit tests have grown since a while, however five stubs in the AI backend had been missing for a successful unit test build (dt_conf_get_bool/get_int/key_exists, dt_control_log, dt_loc_get_user_cache_dir). This requires building darktable via
-DBUILD_TESTING=ON -DUSE_AI=ON.Also made dt_conf_get_string key-aware so ort_library_path isn't mistaken for a real path, and pinned the test's XDG_DATA_HOME and LD_LIBRARY_PATH so it doesn't depend on the developer's machine.
To prevent such a breakage I went ahead and added one Linux matrix entry in our gitlab ci pipenline with target "build", the branch of ci-script.sh that sets
BUILD_TESTING=ONand calls ctest, which no matrix entry had ever selected.See successful run in CI:
CC: @andriiryzhkov
Disclaimer: this work has been co-created with Claude.