wrapQtAppsHook: support structuredAttrs#526277
Conversation
|
I'd like to include a test, does anyone know where this hook's tests live?
EDIT: I couldn't find any existing qt hook tests, so I added passthru tests and exposed them to the top-level in |
7cc16c2 to
ec54798
Compare
|
Why do the |
Context
When I was iterating on the fix locally, I needed a "full" integration test with makeCWrapper, as my initial approach "fixed" the shell variables in the hook but resulted in args not being passed to makeCWrapper. I wrote the test to align with my manual debugging method (inspecting the actual wrapper). And the test caught that what I thought was an internal Sourcing the hook and printing out It would be slightly less coverage, in that it only asserts the expected array is produced; it wouldn't test that the array is used to produce the expected wrapper. Even if we kept a |
ec54798 to
21c05c3
Compare
|
I've re-thought the test coverage and removed the The test coverage is now structured as:
This preserves coverage of both the hook's argument handling and its effect on the final wrapped executable, without relying on inspecting the generated binary wrapper. The patches to |
21c05c3 to
f2cb7c5
Compare
f2cb7c5 to
0c0980f
Compare
|
I pushed a further simplification to the tests: https://github.com/NixOS/nixpkgs/compare/f2cb7c5d4a144bcf9026d5c1ce232a7cedd1b5fa..0c0980f13122c07211ca0c6ad4992a162f62bcab It turns out Therefore, only the |
Test that wrapQtAppsHook: - normalizes qtWrapperArgs to a bash array - preserves user-supplied wrapper arguments - appends the expected Qt wrapper arguments - produces wrappers with the expected runtime behaviour
With `__structuredAttrs = true`, `qtWrapperArgs` is provided as an array; without it, it is provided as a string. Use stdenv's `concatTo` helper to normalize `qtWrapperArgs` to a bash array, regardless of its representation. Adjust the hook's tests to cover both __structuredAttrs true and false.
0c0980f to
cd5e77d
Compare
|
FWIW you can avoid the C compile dance by just explicitly doing wrapQtApp on a bash script or whatever. |
|
I started off with a bash script, but it didn't seem to be getting wrapped. I assumed the hook was only wrapping binary executables? Edit: looks like that's intentional: nixpkgs/pkgs/development/libraries/qt-6/hooks/wrap-qt-apps-hook.sh Lines 92 to 93 in 4346a1c EDIT
That's true, although my goal with the runtime test was to exercise the normal I think the C compiled fixture is a reasonable trade-off here, as the hook's main entrypoint filters for ELF binaries. |
Use stdenv's
concatTohelper to normalizeqtWrapperArgs, instead of assuming a single string representation. This handles both structuredAttrs modes: when__structuredAttrs = true,qtWrapperArgsis already an array.Tests are added to cover both structuredAttrs modes and verify that wrapper behaviour remains identical across both configurations, including argument propagation and runtime behaviour.
Fixes #526275, which is blocking #461881.
AI assistance disclosure
Things done
passthru.tests.nix-build -A tests.qt5 -A tests.qt6nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.