Repository navigation
tools/kernel-pr-check: build an included .c through the file that includes it - #851
Conversation
…ludes it A KUnit test that its driver #includes at the end (drm_panic.c and tests/drm_panic_test.c upstream) can't build on its own, so the W=1 step failed it. A touched .c is still built alone first; only when that fails is a .c in the same or the parent directory that includes it built instead, and the output says so, including when the include isn't compiled under the current config.
|
Thanks, Lef: this is a real gap, and upstream does use the pattern, so the gate has to cope with it. I ran main's tool and yours side by side in the build container on kernel #265, and I get exactly what you describe: main fails The part I'd like changed is what happens after the second line. On #265 the include is under Could you:
Two smaller things, as you like: when the build goes through the includer, the W=1 warnings line is printed under the test file's name though the warnings are the includer's, so naming the includer there would help; and the comment says "the same or the parent directory" while the search covers everything under the parent. Once this is in I'll re-run #265's check. Its test file will then show as not compiled here, which is right: your UML run is the evidence for it, so please keep that result in #265's description. |
A .c reached through its includer counted as built even when the include sits under a config that is off, so nothing of it was compiled. It now counts only when the includer's .cmd lists it (paths with ../ resolved); otherwise the result is a SKIP that names it and its includer. The includer is tried only when no Makefile or Kbuild from the file's directory up to the searched parent names the file's .o. The W=1 warnings line names the includer, a touched includer's warnings aren't listed twice, and the comment matches the search (anywhere under the parent directory). tests/kernel-pr-check covers each case with a stand-in compiler.
|
Thanks @derekross, good catch with the decoy, that's exactly the hole. Fixed in 4062ae7:
The two small ones are in too: the warnings line names the includer, and the comment says the search covers anywhere under the parent directory. I haven't run it against #265 in the build container yet, so its result there is yours to see. I'll keep the UML run in #265's description. |
|
Thanks, Lef. You said you hadn't run it in the build container, so I did, your tool beside main's:
CI is green. Merging, and then I'll re-run #265's check; it should come back green with that SKIP line, and your UML run stays the evidence for the test itself. |
kernel-pr-check --buildbuilds each touched.con its own, so a KUnit test that its driver#includes at the end can't pass. That's what failed on derekross/linux-omarchy-mobile#265:max77759_charger_test.cuses the driver's static functions, so built alone it stops at "undeclared function guard_classify". Upstream does the same thing in a few places, e.g.drm_panic.cwithtests/drm_panic_test.c, firewire'snode-tree-test.cand x86'scpa-test.c.Now a touched
.cis still built alone first, exactly as before. Only if that fails does it look for the.cfiles in the same or the parent directory that include it (the include path is resolved, not just the name matched) and build the first of them that builds. It prints a line when it does, and a second one when the include isn't compiled under the current config, so a test behind an off KUNIT option is reported as not build-tested instead of passing quietly.Tested:
tests/kernel-pr-checkpasses (22 ok). Run by hand on #265's branch with--build --mergein the build container, every check is ok and it says:The KUnit tests themselves I run under UML (10 of 10 pass on #265), since omamobile.config has no KUNIT. There's no case for this in the test script because the builds there are run by hand, as its header says.