summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-07-30 16:42:52 +0100
committerOlivier Crête <olivier.crete@collabora.com>2018-12-14 14:47:01 -0500
commit0e0f89d2b916dc0475787e0970bb692882ee3de2 (patch)
treee63653836a4e07fd0d54c5b2b5b52d7535d37c91 /tests
parented70ea09b6b283b25d3047443c00a14c8cb29e1a (diff)
downloadlibnice-0e0f89d2b916dc0475787e0970bb692882ee3de2.tar.gz
Add support for Meson build system
Diffstat (limited to 'tests')
-rwxr-xr-xtests/check-test-fullmode-with-stun.sh12
-rw-r--r--tests/meson.build85
-rwxr-xr-xtests/test-pseudotcp-random.sh17
3 files changed, 109 insertions, 5 deletions
diff --git a/tests/check-test-fullmode-with-stun.sh b/tests/check-test-fullmode-with-stun.sh
index 4ce082e..7be4190 100755
--- a/tests/check-test-fullmode-with-stun.sh
+++ b/tests/check-test-fullmode-with-stun.sh
@@ -1,6 +1,12 @@
#! /bin/sh
-STUND=../stun/tools/stund
+if test -n "${BUILT_WITH_MESON}"; then
+ STUND=$1
+ TEST_FULLMODE=$2
+else
+ STUND=../stun/tools/stund
+ TEST_FULLMODE=./test-fullmode
+fi
echo "Starting ICE full-mode with STUN unit test."
@@ -15,13 +21,13 @@ pidfile=./stund.pid
export NICE_STUN_SERVER=127.0.0.1
export NICE_STUN_SERVER_PORT=3800
-echo "Launching stund on port ${NICE_STUN_SERVER_PORT}."
+echo "Launching $STUND on port ${NICE_STUN_SERVER_PORT}."
rm -f -- "$pidfile"
(sh -c "echo \$\$ > \"$pidfile\" && exec "$STUND" ${NICE_STUN_SERVER_PORT}") &
sleep 1
-./test-fullmode
+"${TEST_FULLMODE}"
error=$?
kill "$(cat "$pidfile")"
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..2aea0c7
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,85 @@
+nice_tests = [
+ 'test-pseudotcp',
+ 'test-pseudotcp-fin',
+ 'test-pseudotcp-fuzzy',
+ 'test-bsd',
+ 'test',
+ 'test-address',
+ 'test-add-remove-stream',
+ 'test-build-io-stream',
+ 'test-io-stream-thread',
+ 'test-io-stream-closing-write',
+ 'test-io-stream-closing-read',
+ 'test-io-stream-cancelling',
+ 'test-io-stream-pollable',
+ 'test-send-recv',
+ 'test-socket-is-based-on',
+ 'test-priority',
+ 'test-fullmode',
+ 'test-different-number-streams',
+ 'test-restart',
+ 'test-fallback',
+ 'test-thread',
+ 'test-dribble',
+ 'test-new-dribble',
+ 'test-tcp',
+ 'test-icetcp',
+ 'test-credentials',
+ 'test-turn',
+ 'test-drop-invalid',
+ 'test-nomination',
+]
+
+tenv = environment()
+tenv.set('BUILT_WITH_MESON', '1')
+
+foreach tname : nice_tests
+ if tname.startswith('test-io-stream') or tname.startswith('test-send-recv')
+ extra_src = ['test-io-stream-common.c']
+ else
+ extra_src = []
+ endif
+ exe = executable('nice-@0@'.format(tname),
+ '@0@.c'.format(tname), extra_src,
+ c_args: '-DG_LOG_DOMAIN="libnice-tests"',
+ include_directories: nice_incs,
+ dependencies: [nice_deps, libm],
+ link_with: [libagent, libstun, libsocket, librandom],
+ install: false)
+ set_variable(tname.underscorify(), exe)
+ test(tname, exe, env: tenv)
+endforeach
+
+if gst_dep.found()
+ gst_check = dependency('gstreamer-check-1.0', required: get_option('gstreamer'),
+ fallback : ['gstreamer', 'gst_check_dep'])
+ if gst_check.found()
+ exe = executable('nice-test-gstreamer',
+ 'test-gstreamer.c', extra_src,
+ c_args: '-DG_LOG_DOMAIN="libnice-tests"',
+ include_directories: nice_incs,
+ dependencies: [nice_deps, gst_check, libm],
+ link_with: libnice,
+ install: false)
+ test('test-gstreamer', exe, env: tenv)
+ endif
+endif
+
+if find_program('sh', required : false).found()
+ dd = find_program('dd', required : false)
+ diff = find_program('diff', required : false)
+ if dd.found() and diff.found()
+ test('test-pseudotcp-random', find_program('test-pseudotcp-random.sh'),
+ args: test_pseudotcp,
+ env: tenv)
+ endif
+
+ test('test-fullmode-with-stun', files('check-test-fullmode-with-stun.sh'),
+ args: [stund_exe, test_fullmode],
+ env: tenv)
+endif
+
+debugenv = environment()
+debugenv.set('G_MESSAGES_DEBUG', 'all')
+debugenv.set('NICE_DEBUG', 'all')
+add_test_setup('debug', env: debugenv)
diff --git a/tests/test-pseudotcp-random.sh b/tests/test-pseudotcp-random.sh
index 7cdbde0..f98d12e 100755
--- a/tests/test-pseudotcp-random.sh
+++ b/tests/test-pseudotcp-random.sh
@@ -1,6 +1,19 @@
#!/bin/sh
+set -e
+
+if test -n "${BUILT_WITH_MESON}"; then
+ TEST_PSEUDOTCP=$1
+else
+ TEST_PSEUDOTCP=./test-pseudotcp
+fi
+
+cleanup() {
+ rm -rf rand rand-copy
+}
+
+trap cleanup EXIT
+
dd if=/dev/urandom of=rand count=1024 ibs=1024
-./test-pseudotcp rand rand-copy
+"${TEST_PSEUDOTCP}" rand rand-copy
diff rand rand-copy
-rm -rf rand rand-copy