Repository navigation
test(lifecycle): compile the app checks into test_app_lifecycle - #55
Conversation
test_app_lifecycle.c checks each category under #ifdef EAPPS_BUILD_<CATEGORY>, but tests/CMakeLists.txt only used those names as CMake options and never passed them to the compiler. The test compiled to an empty main(), ran 0 assertions and always passed. Pass each enabled category as a compile definition, and link esettings and ebot (the test references both, so the link fails without them). CMake also counts the enabled categories from the options themselves and passes that count in; the test fails if it checked a different number of categories, or if no check ran at all. The test is skipped, with a status message, when every category is off.
Reviewer's GuideConfigurationConfigure
DocumentationDocument the lifecycle test fix and its safeguards in the unreleased changelog.
TestsRequire the expected category count at compile time and make the lifecycle test fail if it runs no checks or checks fewer categories than CMake enabled.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
You've used all your free Kodus-paid PR reviews 🎁Your trial is still active — this just means the PR reviews we cover during the trial are used up. Connect your own AI key to keep Kody reviewing — unlimited reviews, on any plan (Free included). Want more trial reviews to finish evaluating before adding a key? Talk to our founders. 😎 |
|
ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
PR Summary by QodoMake app lifecycle tests run for enabled categories
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
| @@ -1,5 +1,14 @@ | |||
| # Changelog | |||
|
|
|||
| ## [Unreleased] | |||
There was a problem hiding this comment.
1. Release notes omit pending additions 🐞 Bug ≡ Correctness
The new ## [Unreleased] heading precedes an existing Unreleased section, while the stable-release workflow extracts only the first such section. When that workflow publishes a release, it stops at the intervening ## [3.0.1] heading and excludes the existing AI capability and permission-model entries.
Agent Prompt
## Issue description
The new Unreleased heading causes the stable-release workflow to omit pending entries from its release notes.
## Fix Focus Areas
- CHANGELOG.md[3-11]
- CHANGELOG.md[47-57]
## Recommended Fix
Move the new Fixed entry into the existing Unreleased section and remove the newly added duplicate heading, so the workflow extracts both the existing Added entries and this fix.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| target_compile_definitions(test_app_lifecycle PRIVATE ${LIFECYCLE_DEFS} | ||
| EAPPS_LIFECYCLE_EXPECTED_CATEGORIES=${LIFECYCLE_EXPECTED}) |
There was a problem hiding this comment.
2. Missing app names crash the lifecycle test 🐞 Bug ☼ Reliability
The newly compiled category checks use CHECK_APP, which records a NULL id or name but then calls strlen on that pointer without stopping. If an app has the missing metadata this test is meant to detect, execution can terminate before TEST_EXIT summarizes the assertion failure or checks the remaining apps.
Agent Prompt
## Issue description
Activating the lifecycle checks exposes a NULL dereference when an app has a missing id or name.
## Fix Focus Areas
- tests/test_app_lifecycle.c[86-102]
- tests/CMakeLists.txt[90-91]
## Recommended Fix
Make `CHECK_APP` skip each length assertion when its corresponding pointer is NULL, while retaining the NULL assertion failure and continuing to check other apps.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| endif() | ||
| if(EAPPS_BUILD_SECURITY) | ||
| list(APPEND LIFECYCLE_LIBS evpn eguard evirustower) | ||
| list(APPEND LIFECYCLE_LIBS evpn eguard evirustower ebot) |
There was a problem hiding this comment.
3. Windows gcc builds cannot link the test 🐞 Bug ≡ Correctness
Adding ebot to LIFECYCLE_LIBS makes the security-enabled lifecycle executable pull in ebot.c, which calls Winsock functions without a CMake link dependency on ws2_32. On Windows GCC builds, the source's MSVC-specific link pragma does not supply that library, leaving the test executable with unresolved socket symbols.
Agent Prompt
## Issue description
The new ebot dependency introduces unresolved Winsock references in Windows GCC lifecycle-test builds.
## Fix Focus Areas
- tests/CMakeLists.txt[78-80]
- apps/ebot/CMakeLists.txt[7-13]
## Recommended Fix
Add a Windows-conditional `ws2_32` link dependency to the ebot target so executables consuming the static library, including the lifecycle test, receive it.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/CMakeLists.txt" line_range="79" />
<code_context>
endif()
if(EAPPS_BUILD_SECURITY)
- list(APPEND LIFECYCLE_LIBS evpn eguard evirustower)
+ list(APPEND LIFECYCLE_LIBS evpn eguard evirustower ebot)
+ list(APPEND LIFECYCLE_DEFS EAPPS_BUILD_SECURITY)
endif()
</code_context>
<issue_to_address>
**Lifecycle test cannot link**
When `EAPPS_BUILD_SECURITY` is ON and no `lvgl` target is available, `tests/CMakeLists.txt` appends `ebot` to `LIFECYCLE_LIBS` while `apps/ebot/CMakeLists.txt` skips creating that target, so the lifecycle test fails to link and the build fails.
Only append `ebot` to `LIFECYCLE_LIBS` when its target is created.
</issue_to_address>Linked issues
#54 [BUG] test_app_lifecycle runs 0 checks and always passes · 2 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Run the lifecycle checks for every enabled app category, checking each listed app’s info and lifecycle fields. | ✅ Met | CMake passes each enabled category define to the test; each app’s CHECK_APP performs the six requested checks, and the test verifies that at least one check ran and that all enabled categories were checked. |
| 2 | Link the missing esettings and ebot libraries when their checks are compiled. | ✅ Met | The productivity and security library lists now include esettings and ebot, respectively. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/CMakeLists.txt:79
| endif() | ||
| if(EAPPS_BUILD_SECURITY) | ||
| list(APPEND LIFECYCLE_LIBS evpn eguard evirustower) | ||
| list(APPEND LIFECYCLE_LIBS evpn eguard evirustower ebot) |
There was a problem hiding this comment.
🟡 Medium · Lifecycle test cannot link
When EAPPS_BUILD_SECURITY is ON and no lvgl target is available, tests/CMakeLists.txt appends ebot to LIFECYCLE_LIBS while apps/ebot/CMakeLists.txt skips creating that target, so the lifecycle test fails to link and the build fails.
Only append ebot to LIFECYCLE_LIBS when its target is created.
Prompt for AI agents
In `tests/CMakeLists.txt` at line 79:
**Lifecycle test cannot link**
When `EAPPS_BUILD_SECURITY` is ON and no `lvgl` target is available, `tests/CMakeLists.txt` appends `ebot` to `LIFECYCLE_LIBS` while `apps/ebot/CMakeLists.txt` skips creating that target, so the lifecycle test fails to link and the build fails.
Only append `ebot` to `LIFECYCLE_LIBS` when its target is created.From AGENTS.md L39:
Preserve platform portability and existing public catalog fields.|
Premise: pass — master tests/CMakeLists.txt:66-71 never passed EAPPS_BUILD_* defines (0 assertions); SECURITY lacked ebot, PRODUCTIVITY lacked esettings; fixes #54. |
Pull Request
Closing issue
Fixes #54
Description
test_app_lifecycleran 0 checks and always passed. Its checks are all under#ifdef EAPPS_BUILD_<CATEGORY>, and the build never defined those names for the compiler. This PR passes the enabled categories to the test as compile definitions and links the two apps the test needs but did not link (esettings,ebot).It also adds two guards so the test cannot quietly go back to checking nothing, or to checking only some categories:
EAPPS_BUILD_<CATEGORY>options, separately from the list of defines it passes, and hands the count to the test. The test counts the categories it actually checked and fails on any difference. Dropping one category's define now fails withgot 5, expected 6.t_passes + t_failures > 0).Motivation
The test is meant to catch an app whose
*_infoor*_lifecyclestruct is missing or empty. On master it cannot fail, but every workflow that builds withBUILD_TESTING=ONcounts it as a passing test. Details are in the linked issue.Changes
tests/CMakeLists.txt:LIFECYCLE_DEFSlist, which is passed to the test withtarget_compile_definitions(... PRIVATE ...).LIFECYCLE_EXPECTEDcounts the categories whose option is ON and is passed asEAPPS_LIFECYCLE_EXPECTED_CATEGORIES.esettingsis linked with the productivity apps andebotwith the security apps, because the test references both.test_app_lifecycle skipped: every EAPPS_BUILD_<CATEGORY> option is OFF.tests/test_app_lifecycle.c:main()counts the categories it ran, then checks that at least one check ran and that this count equalsEAPPS_LIFECYCLE_EXPECTED_CATEGORIES.#errorstops compilation if the count is not defined, so the file can't be built without it.CHECK_APPline changes.CHANGELOG.md:[Unreleased]/ Fixed entry, asCONTRIBUTING.mdasks.No app code changes. All 43 apps the test covers already fill in their structs correctly, so the test passes once it actually runs.
etrackand the system appehmiare built but have noCHECK_APPline, on master and here. That gap is left for a separate change.Testing
Run on macOS 26 arm64, Apple clang 21.0.0, CMake 4.4.2, LVGL
release/v9.2via FetchContent,-j2, at commit302bcc9. Log paths are shortened to<repo>.84ae0fb)ctest --test-dir _build -R test_app_lifecycle -V0 passed, 0 failed, ctest "Passed"tests/CMakeLists.txttest_app_lifecycle#error "EAPPS_LIFECYCLE_EXPECTED_CATEGORIES must be set by tests/CMakeLists.txt", not builtEAPPS_BUILD_MEDIAdefine line deletedctest -R test_app_lifecycle -Vgot 5, expected 6;229 passed, 1 failed; ctest exit 8EAPPS_BUILD_SECURITYdefine line deletedgot 5, expected 6;235 passed, 1 failed; ctest exit 8at least one app check ran;got 0, expected 6); ctest exit 8260 passed, 0 failed(43 apps × 6 checks = 258, plus the 2 guards)esettings/ebottest_app_lifecycle_ebot_info,_ebot_lifecycle,_esettings_info,_esettings_lifecycle(this is why both are now linked)test_app_lifecycle26 passed/86 passed, 0 failed, exit 0cmake -DBUILD_TESTING=ON -DEAPPS_BUILD_{PRODUCTIVITY,MEDIA,GAMES,CONNECTIVITY,SECURITY,WEB}=OFF,ctest -Ncmake --build _build -j2ctest --test-dir _build --output-on-failureclang-format --dry-run --Werror --lines=...on every added range oftests/test_app_lifecycle.c(clang-format 23.1.5, repo.clang-format)git diff --check HEAD~1 HEADcppcheck,clang-tidyThe image shows master, the new test file against master's CMake, the dropped-define case and this branch:
Checklist
ctest --test-dir build --output-on-failure)clang-format): added lines onlycppcheck,clang-tidy): NOT RUN, see aboveSummary by Sourcery
Ensure the app lifecycle test validates all enabled application categories and cannot silently pass without running its checks.
Bug Fixes:
Enhancements:
Build:
Tests:
Chores:
Summary by CodeRabbit