#1141867 vlock: Two issues were found in the project's tests

Package:
vlock
Source:
vlock
Description:
Virtual Console locking program
Submitter:
Dmitri Vinogradov
Date:
2026-07-11 19:53:02 UTC
Severity:
normal
#1141867#5
Date:
2026-07-11 19:50:38 UTC
From:
To:
Dear Maintainer,


Makefile linking error – `vlock-test` fails to link because `-lcunit` is placed in `LDFLAGS` instead of `LDLIBS`.
Bad designed unit test – `test_wait_for_death` in `tests/test_process.c` relies on timing that is platform‑dependent, causing failures on slower systems (e.g., Banana Pi 5).

  * What led up to the situation?
- The project’s test suite was executed on a new target platform (Banana Pi 5).
- The build failed because the `vlock-test` target could not link against the CUnit library - the linker reported unresolved symbols.
- After fixing the linking, the test suite ran but `test_wait_for_death` consistently failed on the Banana Pi 5, although it had passed on faster x86 development machines.

  * What exactly did you do (or not do) that was effective (or ineffective)?

- Ineffective: I initially kept `-lcunit` in `LDFLAGS`, thinking the flag order was the only problem. I tried rearranging the link line manually, but the library still wasn’t pulled in correctly because `LDFLAGS` is processed too early in the build recipe.
- Effective: I moved `-lcunit` from `LDFLAGS` to `LDLIBS` (using `override LDLIBS += -lcunit`).

- Ineffective: I attempted to adjust the sleep values (e.g., increasing 2000 ms to 5000 ms) to accommodate slower hardware. This did work, but does not guarantt reliable test passing on all paltforms.
- Effective: I replaced the external command `/bin/true` with a controlled child process that explicitly `sleep` before exiting. This makes the test’s independent of platform speed.

  * What was the outcome of this action?
- After the Makefile fix, the `vlock-test` binary compiled and linked without errors.
- After the test fix, `test_wait_for_death` now passes reliably on all platforms, we tested: fast x86, slower ARM (Banana Pi 5).

  * What outcome did you expect instead?
- For the build, I expected the `vlock-test` target to link cleanly against CUnit without manual intervention. Using `LDLIBS` is the standard practice, so the fix aligns with expected Makefile behaviour.
- For the test, I expected a unit test to be deterministic and portable - it should pass or fail based on the logic of `wait_for_death`, not on the OS scheduler or the execution speed of an external binary.