This document explains how to build and validate reboot-manager locally and in CI.
It is written for developers who are new to the component and need repeatable,
diagnostic-friendly test workflows.
Testing for reboot-manager verifies:
- Correct reboot reason classification and metadata persistence.
- Correct cyclic reboot loop detection/defer behavior.
- Correct pre-reboot cleanup behavior.
- Safe reboot orchestration and fallback behavior.
- Interface correctness for RBUS and utility modules.
reboot-manager uses two primary test layers:
-
L1 Unit tests (GTest)
- Fast feedback on module/function behavior.
- Uses mocks/stubs for platform dependencies.
-
L2 Functional tests (pytest)
- End-to-end behavioral tests for reboot flows.
- Validates component interactions and file outputs.
sudo apt-get update
sudo apt-get install -y \
build-essential autoconf automake libtool pkg-config \
lcov gcovr python3-pipRecommended Python packages:
pip3 install pytest pytest-json-reportrun_l2.sh expects:
pytest+pytest-json-reportlibjsonrpccpp-dev(installed in script)/usr/local/bin/update-reboot-infoexecutable (environment dependent)
If your local environment does not provide target platform services, run L2 tests in a compatible integration environment/container.
From repository root:
autoreconf -fi
./configure
make -j$(nproc)Optional feature flags:
./configure --enable-t2api --enable-breakpad --enable-cpcUse these flags only when your environment provides the corresponding dependencies.
./unit_test.shThis script performs:
- cleanup/regeneration of autotools files in
unittest/ - optional coverage instrumentation setup
- build of all gtest binaries
- execution of all test binaries
- lcov capture/listing (default mode)
reboot_utils_gtestreboot_rbus_gtestreboot_cyclic_gtestreboot_system_gtestreboot_main_gtest
Run without coverage instrumentation:
./unit_test.sh --disable-covUse this mode for faster local iteration.
- Script exits
0when all tests pass. - Script exits non-zero when any binary fails.
- On coverage mode,
coverage.infois generated and listed vialcov.
./run_l2.shThe script runs selected pytest modules and emits JSON reports under /tmp/l2_test_report.
Current test module set:
tests/functional_tests/test/test_cyclic_reboot.pytests/functional_tests/test/test_reboot_crash_maintenance.pytests/functional_tests/test/test_system_cleanup.pytests/functional_tests/test/test_reboot_triggered.py
Feature specifications are in tests/functional_tests/features/.
/tmp/l2_test_report/cyclicreboot.json/tmp/l2_test_report/crashmaintainence.json/tmp/l2_test_report/systemcleanup.json/tmp/l2_test_report/rebootTest.json
Review these JSON files for summary and per-test failures.
For code changes in this component, use this order:
- Build the project.
- Run
./unit_test.sh --disable-covfor quick correctness. - Run full
./unit_test.shfor coverage-enabled validation. - Run
./run_l2.shwhen behavior affects end-to-end reboot flows.
This minimizes cycle time while still giving strong confidence.
GitHub workflows:
.github/workflows/L1-tests.yml.github/workflows/L2-tests.yml
Use local commands in this document to reproduce CI failures quickly.
docs/reboot-manager-hld.mddocs/reboot-manager-lld.mddocs/diagrams/flowchart.mddocs/diagrams/sequence-diagram.md