Skip to contentSkip to conversation

selftests: alsa - move shared library configuration code to conf.c

PATCH Applied Jaroslav Kysela 3 participants 3 messages Nov 29, 2022

Subsystems (3)
lore
Share & tools
lore

Jaroslav Kysela

author maintainer
#0 lore raw

PATCH 1/1 selftests: alsa - move shared library configuration code to conf.c

The minimal alsa-lib configuration code is similar in both mixer and pcm tests. Move this code to the shared conf.c source file.

Also, fix the build rules inspired by rseq tests. Build libatest.so which is linked to the both test utilities dynamically.

Also, set the TEST_FILES variable for lib.mk.

---
 tools/testing/selftests/alsa/Makefile     | 13 ++++-
 tools/testing/selftests/alsa/alsa-local.h |  2 +
 tools/testing/selftests/alsa/conf.c       | 69 ++++++++++++++++++++++
 tools/testing/selftests/alsa/mixer-test.c | 53 +----------------
 tools/testing/selftests/alsa/pcm-test.c   | 70 -----------------------
 5 files changed, 85 insertions(+), 122 deletions(-)
tools/testing/selftests/alsa/Makefile +12 -1
index 8ac22d2eb2ba..a8c0383878d3 100644
@@ -6,9 +6,20 @@ LDLIBS += $(shell pkg-config --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound
 endif
+CFLAGS += -L$(OUTPUT) -Wl,-rpath=./
+
+OVERRIDE_TARGETS = 1
 
 TEST_GEN_PROGS := mixer-test pcm-test
 
-pcm-test: pcm-test.c conf.c
+TEST_GEN_PROGS_EXTENDED := libatest.so
+
+TEST_FILES := conf.d
 
 include ../lib.mk
+
+$(OUTPUT)/libatest.so: conf.c alsa-local.h
+	$(CC) $(CFLAGS) -shared -fPIC $< $(LDLIBS) -o $@
+
+$(OUTPUT)/%: %.c $(TEST_GEN_PROGS_EXTENDED) alsa-local.h
+	$(CC) $(CFLAGS) $< $(LDLIBS) -latest -o $@
tools/testing/selftests/alsa/alsa-local.h +2 -0
index fd0771ac600d..65f197ea9773 100644
@@ -10,6 +10,8 @@
 
 #include <alsa/asoundlib.h>
 
+snd_config_t *get_alsalib_config(void);
+
 void conf_load(void);
 void conf_free(void);
 snd_config_t *conf_by_card(int card);
tools/testing/selftests/alsa/conf.c +69 -0

75 lines not on this page · raw message

tools/testing/selftests/alsa/mixer-test.c +2 -51

76 lines not on this page · raw message

tools/testing/selftests/alsa/pcm-test.c +0 -70

82 lines not on this page · raw message

Signature · 1 line
2.35.3
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 2 lines · Jaroslav Kysela

The minimal alsa-lib configuration code is similar in both mixer and pcm tests. Move this code to the shared conf.c source file.

Applied
#2 lore raw
In reply to Jaroslav Kysela
Quoted 7 lines · Jaroslav Kysela

The minimal alsa-lib configuration code is similar in both mixer and pcm tests. Move this code to the shared conf.c source file.

Also, fix the build rules inspired by rseq tests. Build libatest.so which is linked to the both test utilities dynamically.

Quoted 6 lines

Also, set the TEST_FILES variable for lib.mk.

Thanks, applied now.

Takashi