From 77317a1723ad65f554789753231d77f857f7152f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 4 Oct 2021 08:53:29 -0400 Subject: [PATCH] TT#14008 add test for multi-intf handling Change-Id: I9c1392ca521640d8e39eb6f67d146e70d44ee7d0 --- t/Makefile | 15 +++++++- t/auto-daemon-tests-intfs.pl | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 t/auto-daemon-tests-intfs.pl diff --git a/t/Makefile b/t/Makefile index f1f9794a3..e6d2dbde7 100644 --- a/t/Makefile +++ b/t/Makefile @@ -87,7 +87,8 @@ COMMONOBJS= str.o auxlib.o rtplib.o loglib.o ssllib.o include ../lib/common.Makefile .PHONY: all-tests unit-tests daemon-tests daemon-tests \ - daemon-tests-main daemon-tests-jb daemon-tests-dtx daemon-tests-dtx-cn daemon-tests-pubsub + daemon-tests-main daemon-tests-jb daemon-tests-dtx daemon-tests-dtx-cn daemon-tests-pubsub \ + daemon-tests-intfs TESTS= test-bitstr aes-crypt aead-aes-crypt test-const_str_hash.strhash ifeq ($(with_transcoding),yes) @@ -109,7 +110,8 @@ endif unit-tests: $(TESTS) for x in $(TESTS); do echo testing: $$x; G_DEBUG=fatal-warnings ./$$x || exit 1; done -daemon-tests: daemon-tests-main daemon-tests-jb daemon-tests-pubsub daemon-tests-websocket +daemon-tests: daemon-tests-main daemon-tests-jb daemon-tests-pubsub daemon-tests-websocket \ + daemon-tests-intfs daemon-test-deps: tests-preload.so $(MAKE) -C ../daemon @@ -162,6 +164,15 @@ daemon-tests-websocket: daemon-test-deps test "$$(ls fake-$@-sockets)" = "" rmdir fake-$@-sockets +daemon-tests-intfs: tests-preload.so + $(MAKE) -C ../daemon + rm -rf fake-$@-sockets + mkdir fake-$@-sockets + LD_PRELOAD=../t/tests-preload.so RTPE_BIN=../daemon/rtpengine TEST_SOCKET_PATH=./fake-$@-sockets \ + perl -I../perl auto-daemon-tests-intfs.pl + test "$$(ls fake-$@-sockets)" = "" + rmdir fake-$@-sockets + test-bitstr: test-bitstr.o spandsp_send_fax_pcm: spandsp_send_fax_pcm.o diff --git a/t/auto-daemon-tests-intfs.pl b/t/auto-daemon-tests-intfs.pl new file mode 100644 index 000000000..a9ef31c53 --- /dev/null +++ b/t/auto-daemon-tests-intfs.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use NGCP::Rtpengine::Test; +use NGCP::Rtpclient::SRTP; +use NGCP::Rtpengine::AutoTest; +use Test::More; +use NGCP::Rtpclient::ICE; +use POSIX; + + +autotest_start(qw(--config-file=none -t -1 -i foo/203.0.113.1 -i foo/2001:db8:4321::1 + -i bar/203.0.113.2 -i bar/2001:db8:4321::2 + -n 2223 -c 12345 -f -L 7 -E -u 2222 --silence-detect=1)) + or die; + + +my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $ssrc_b, $resp, + $sock_ax, $sock_bx, $port_ax, $port_bx, + $srtp_ctx_a, $srtp_ctx_b, $srtp_ctx_a_rev, $srtp_ctx_b_rev, $ufrag_a, $ufrag_b, + @ret1, @ret2, @ret3, @ret4, $srtp_key_a, $srtp_key_b, $ts, $seq); + + + + + +new_call; + +offer('intfs selection', { direction => [qw(foo bar)] }, <