Skip to content

Commit

Permalink
MT#55283 restore AMR unit tests
Browse files Browse the repository at this point in the history
These had unintentionally been disabled and so have fallen derelict.

Replace the makefile `with_amr_tests` conditional with
`RTPENGINE_EXTENDED_TESTS`. The previous `with_amr_tests` was not
actually set anywhere and so these tests never ran. The new
`RTPENGINE_EXTENDED_TESTS` is used as switch for other tests already.

Bring the tests up to date so that they compile and run.

Allow for alternative AMR bit encodings as different versions of the
codec produce different outputs.

Use an inline `struct cb_args` to pass these expected strings to the
callback functions.

Update `int` to `size_t` where appropriate.

Make a copy of the format string in `__sdp_pt_fmt` as the parsing
function temporarily writes into the string, which means a readonly
string literal doesn't work.

Update the AMR tests in test-transcode to the new API and new expected
values.

Change-Id: Ic3332e696522a28595ea06be9996001d3ab7686e
  • Loading branch information
rfuchs committed Aug 14, 2023
1 parent 9081d39 commit 2d2c987
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 106 deletions.
2 changes: 2 additions & 0 deletions t/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ audio_player.c
mix_in_x64_avx2.S
mix_in_x64_avx512bw.S
mix_in_x64_sse2.S
test-amr-decode
test-amr-encode
12 changes: 7 additions & 5 deletions t/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CFLAGS+= $(shell pkg-config --cflags libevent_pthreads)
CFLAGS+= $(shell pkg-config xmlrpc_client --cflags 2> /dev/null || xmlrpc-c-config client --cflags)
CFLAGS+= $(shell pkg-config xmlrpc --cflags 2> /dev/null)
CFLAGS+= $(shell pkg-config xmlrpc_util --cflags 2> /dev/null)
ifeq ($(with_amr_tests),yes)
ifeq ($(RTPENGINE_EXTENDED_TESTS),1)
CFLAGS+= -DWITH_AMR_TESTS
endif
CFLAGS+= $(shell mysql_config --cflags)
Expand Down Expand Up @@ -72,7 +72,7 @@ ifeq ($(with_transcoding),yes)
SRCS+= test-transcode.c test-dtmf-detect.c test-payload-tracker.c test-resample.c test-stats.c
SRCS+= spandsp_recv_fax_pcm.c spandsp_recv_fax_t38.c spandsp_send_fax_pcm.c \
spandsp_send_fax_t38.c test-mix-buffer.c
ifeq ($(with_amr_tests),yes)
ifeq ($(RTPENGINE_EXTENDED_TESTS),1)
SRCS+= test-amr-decode.c test-amr-encode.c
endif
LIBSRCS+= codeclib.strhash.c resample.c socket.c streambuf.c dtmflib.c poller.c
Expand All @@ -99,7 +99,7 @@ include ../lib/common.Makefile
TESTS= test-bitstr aes-crypt aead-aes-crypt test-const_str_hash.strhash
ifeq ($(with_transcoding),yes)
TESTS+= test-transcode test-dtmf-detect test-payload-tracker test-resample test-stats test-mix-buffer
ifeq ($(with_amr_tests),yes)
ifeq ($(RTPENGINE_EXTENDED_TESTS),1)
TESTS+= test-amr-decode test-amr-encode
endif
endif
Expand Down Expand Up @@ -197,9 +197,11 @@ spandsp_recv_fax_t38: spandsp_recv_fax_t38.o

spandsp_raw_fax_tests: spandsp_send_fax_pcm spandsp_recv_fax_pcm spandsp_send_fax_t38 spandsp_recv_fax_t38

test-amr-decode: test-amr-decode-test.o $(COMMONOBJS) codeclib.strhash.o resample.o dtmflib.o resample.o
test-amr-decode: test-amr-decode.o $(COMMONOBJS) codeclib.strhash.o resample.o dtmflib.o resample.o \
mvr2s_x64_avx2.o mvr2s_x64_avx512.o

test-amr-encode: test-amr-encode-test.o $(COMMONOBJS) codeclib.strhash.o resample.o dtmflib.o
test-amr-encode: test-amr-encode.o $(COMMONOBJS) codeclib.strhash.o resample.o dtmflib.o \
mvr2s_x64_avx2.o mvr2s_x64_avx512.o

test-dtmf-detect: test-dtmf-detect.o

Expand Down
Loading

0 comments on commit 2d2c987

Please sign in to comment.