Skip to content

Commit a21ffd6

Browse files
committed
CI: fix aplay resampler test and coverage
1 parent b63c2db commit a21ffd6

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

.github/workflows/build-and-test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- --enable-debug --enable-mp3lame --enable-mpg123
2121
- --enable-faststream --enable-midi --enable-mp3lame
2222
- --enable-ofono --enable-opus --enable-upower
23-
- --disable-aplay --enable-aplay-resampler --enable-rfcomm --enable-manpages
23+
- --disable-aplay --with-libsamplerate --enable-rfcomm --enable-manpages
2424
- --disable-ctl --enable-aptx --enable-aptx-hd --with-libopenaptx
2525
fail-fast: false
2626
runs-on: ubuntu-22.04

.github/workflows/codecov-report.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
--enable-opus \
4040
--enable-upower \
4141
--enable-aplay \
42-
--enable-aplay-resampler \
42+
--with-libsamplerate \
4343
--enable-ctl \
4444
--enable-test \
4545
--with-coverage

Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif
1414

1515
if WITH_COVERAGE
1616
cov:
17-
$(MAKE) $(AM_MAKEFLAGS) check CFLAGS="$(CFLAGS) -O0 --coverage"
17+
$(MAKE) $(AM_MAKEFLAGS) check CFLAGS="$(CFLAGS) -O0 --coverage -fprofile-update=atomic"
1818
$(LCOV) --capture -d src -d utils -d test \
1919
--exclude '$(abs_builddir)/*' --exclude '/usr/*' --exclude '*/test/*' \
2020
--output-file lcov.info

test/test-utils-aplay.c

+44
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,47 @@ CK_START_TEST(test_play_dbus_signals) {
305305

306306
} CK_END_TEST
307307

308+
#if WITH_LIBSAMPLERATE
309+
CK_START_TEST(test_play_resampler) {
310+
311+
struct spawn_process sp_ba_mock;
312+
ck_assert_int_ne(spawn_bluealsa_mock(&sp_ba_mock, NULL, true,
313+
"--profile=a2dp-sink",
314+
NULL), -1);
315+
316+
struct spawn_process sp_ba_aplay;
317+
ck_assert_int_ne(spawn_bluealsa_aplay(&sp_ba_aplay,
318+
"--profile-a2dp",
319+
"--pcm=null",
320+
"--resampler=fastest",
321+
"--volume=none",
322+
"-v", "-v", "-v", "-v", "-v",
323+
NULL), -1);
324+
spawn_terminate(&sp_ba_aplay, 500);
325+
326+
char output[8192] = "";
327+
ck_assert_int_gt(spawn_read(&sp_ba_aplay, NULL, 0, output, sizeof(output)), 0);
328+
329+
ck_assert_ptr_ne(strstr(output,
330+
"Used configuration for 12:34:56:78:9A:BC"), NULL);
331+
ck_assert_ptr_ne(strstr(output,
332+
"Used configuration for 23:45:67:89:AB:CD"), NULL);
333+
ck_assert_ptr_ne(strstr(output,
334+
"Resampler method: fastest"), NULL);
335+
336+
#if DEBUG
337+
/* check if the resampler correctly configured */
338+
ck_assert_ptr_ne(strstr(output,
339+
"Resampler rate ratio: 1.00000000"), NULL);
340+
#endif
341+
342+
spawn_close(&sp_ba_aplay, NULL);
343+
spawn_terminate(&sp_ba_mock, 0);
344+
spawn_close(&sp_ba_mock, NULL);
345+
346+
} CK_END_TEST
347+
#endif
348+
308349
int main(int argc, char *argv[]) {
309350
preload(argc, argv, ".libs/libaloader.so");
310351

@@ -330,6 +371,9 @@ int main(int argc, char *argv[]) {
330371
tcase_add_test(tc, test_play_single_audio);
331372
tcase_add_test(tc, test_play_mixer_setup);
332373
tcase_add_test(tc, test_play_dbus_signals);
374+
#if WITH_LIBSAMPLERATE
375+
tcase_add_test(tc, test_play_resampler);
376+
#endif
333377

334378
srunner_run_all(sr, CK_ENV);
335379
int nf = srunner_ntests_failed(sr);

0 commit comments

Comments
 (0)