On 28. 11. 22 20:55, Mark Brown wrote:
On Tue, Nov 08, 2022 at 12:59:14PM +0100, Jaroslav Kysela wrote:
--- a/tools/testing/selftests/alsa/Makefile +++ b/tools/testing/selftests/alsa/Makefile @@ -7,6 +7,8 @@ ifeq ($(LDLIBS),) LDLIBS += -lasound endif
-TEST_GEN_PROGS := mixer-test +TEST_GEN_PROGS := mixer-test pcm-test
+pcm-test: pcm-test.c conf.c
include ../lib.mk
This breaks out of tree kselftest builds - if you specify an output directory with O= (as all the main automated test systems do) then any target specific rules need to prepend $(OUTPUT)/ to specify the right location for the output (this also works fine with in tree builds, a default OUTPUT is generated). Unfortunately looking at this just now simply fixing that is causing only pcm-test to be built and not the existing mixer-test, and explicitly specifying commands for mixer-test causes that to be built and not pcm-test even explicitly asking to build "all" as the target for reasons I'm not yet clear on.
You can see an example failure in:
https://storage.kernelci.org/next/master/next-20221128/arm64/defconfig/gcc-10/logs/kselftest.log
The whole kselftest build setup is rather fragile and frustrating to work with unfortunately, especially with tests built from multiple objects. The only fix I've come up with thus far is to inline conf.c into pcm-test.c (a #include will do the trick) which isn't great.
Thanks Mark for the feedback. I tried to resolve this issue using the rules found in the rseq tests programs - create a shared library and link both test programs to this library. It seems working for me. Patch [1].
Jaroslav
[1] https://lore.kernel.org/alsa-devel/20221129085306.2345763-1-perex@perex.cz/