Skip to content

test infra: re-run tests when their own sources change - #90

Open
andreykarpenko-qc wants to merge 1 commit into
masterfrom
makefile_test_infra
Open

test infra: re-run tests when their own sources change#90
andreykarpenko-qc wants to merge 1 commit into
masterfrom
makefile_test_infra

Conversation

@andreykarpenko-qc

Copy link
Copy Markdown
Contributor

Per-test results.txt and cov.txt in scripts/Makefile.coverage depended only on $(INSTALLPATH)/manifest (sha256 of the kernel/lib/booter install). Editing a test's own sources (test.c/Makefile/etc.) left manifest unchanged, so make treated the stale results.txt as up to date and never rebuilt or re-ran the test on an incremental make test. The stale PASS/FAIL was reported -- the reason a full clean_build_test was needed as a workaround.

Add a test_src_deps function returning a test's own source files (Makefile, tested_functions, .c/.h/.S/.s/.cpp/.cc/.py/.dat/.cfg), excluding generator outputs (scenarios.h, generated_tests.dat, threadmap.py) to mirror the recipe's find whitelist. Enable .SECONDEXPANSION and add $(call test_src_deps,$) as a prerequisite to both the results.txt and cov.txt pattern rules.

Validated: editing a test with manifest unchanged now re-runs only that test. A/B vs pre-fix shows identical steady-state no-op behavior, so the fix adds no spurious re-runs.

@github-actions github-actions Bot added the untested Mark untested PRs label Aug 2, 2026
Per-test results.txt and cov.txt in scripts/Makefile.coverage depended
only on $(INSTALLPATH)/manifest (sha256 of the kernel/lib/booter install).
Editing a test's own sources (test.c/Makefile/etc.) left manifest
unchanged, so make treated the stale results.txt as up to date and never
rebuilt or re-ran the test on an incremental `make test`. The stale
PASS/FAIL was reported -- the reason a full clean_build_test was needed
as a workaround.

Add a test_src_deps function returning a test's own source files
(Makefile, tested_functions, *.c/.h/.S/.s/.cpp/.cc/.py/.dat/.cfg),
excluding generator outputs (scenarios.h, generated_tests.dat,
threadmap.py) to mirror the recipe's find whitelist. Enable
.SECONDEXPANSION and add $(call test_src_deps,$*) as a prerequisite to
both the results.txt and cov.txt pattern rules.

Validated: editing a test with manifest unchanged now re-runs only that
test. A/B vs pre-fix shows identical steady-state no-op behavior, so the
fix adds no spurious re-runs.

Signed-off-by: Andrey Karpenko <andreyk@qti.qualcomm.com>
@andreykarpenko-qc
andreykarpenko-qc marked this pull request as ready for review August 5, 2026 09:45
@zbelinsk

zbelinsk commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

I found that with the proposed change we do have a recompilation of the relevant src files, but it isn't making the test to run again. So, if I have changed the src, but still have stale results.txt- it follows is and not the src.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untested Mark untested PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants